2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

- 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
This commit is contained in:
JINMEI Tatuya
2010-01-14 00:26:02 +00:00
parent 467a449308
commit f77ed6a24e
2 changed files with 11 additions and 5 deletions

View File

@@ -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);

View File

@@ -62,10 +62,17 @@ TEST_F(RRParamRegistryTest, addRemove)
EXPECT_EQ(65533, RRClass("TESTCLASS").getCode());
EXPECT_EQ(65534, RRType("TESTTYPE").getCode());
// 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_TRUE(RRParamRegistry::getRegistry().removeType(65534));
EXPECT_EQ(test_type_unknown_str, RRType(test_type_code).toText());
EXPECT_FALSE(RRParamRegistry::getRegistry().removeClass(65533));
}
TEST_F(RRParamRegistryTest, addError)