Commit f77ed6a2 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

- added some more tests for wider coverage

- use assertion for conditions that must be met


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/jinmei-dnsrrparams@465 e5f2f494-b856-4b98-b285-d166d9295462
parent 467a4493
......@@ -14,6 +14,7 @@
// $Id$
#include <cassert>
#include <algorithm>
#include <cctype>
#include <functional>
......@@ -213,9 +214,7 @@ bool CICharEqual(char c1, char c2)
bool
caseStringEqual(const string& s1, const string& s2, size_t n)
{
if (s1.size() < n || s2.size() < n) {
return (false);
}
assert(s1.size() >= n && s2.size() >= n);
return (mismatch(s1.begin(), s1.begin() + n, s2.begin(), CICharEqual).first
== s1.begin() + n);
......
......@@ -62,10 +62,17 @@ TEST_F(RRParamRegistryTest, addRemove)
EXPECT_EQ(65533, RRClass("TESTCLASS").getCode());
EXPECT_EQ(65534, RRType("TESTTYPE").getCode());
EXPECT_TRUE(RRParamRegistry::getRegistry().removeClass(65533));
EXPECT_EQ(test_class_unknown_str, RRClass(test_class_code).toText());
// the first removal attempt should succeed
EXPECT_TRUE(RRParamRegistry::getRegistry().removeType(65534));
// then toText() should treat it as an "unknown"
EXPECT_EQ(test_type_unknown_str, RRType(test_type_code).toText());
// attempt of removing non-existent mapping should result in 'false'
EXPECT_FALSE(RRParamRegistry::getRegistry().removeType(65534));
// same set of tests for RR class.
EXPECT_TRUE(RRParamRegistry::getRegistry().removeClass(65533));
EXPECT_EQ(test_class_unknown_str, RRClass(test_class_code).toText());
EXPECT_FALSE(RRParamRegistry::getRegistry().removeClass(65533));
}
TEST_F(RRParamRegistryTest, addError)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment