]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1136] Add more tests from review
authorMukund Sivaraman <muks@isc.org>
Fri, 9 Mar 2012 02:25:46 +0000 (07:55 +0530)
committerMukund Sivaraman <muks@isc.org>
Sun, 11 Mar 2012 09:01:44 +0000 (14:31 +0530)
Specifically:

 * Test lowercase and uppercase
 * Test with different spacing

src/lib/dns/tests/rdata_sshfp_unittest.cc
src/lib/dns/tests/testdata/rdata_sshfp_fromWire2 [new file with mode: 0644]

index 89848fb9e223d346d128195a57ce17f51edc5887..dd133ce53b32b855decc403c3c41e1787cf955f6 100644 (file)
@@ -43,8 +43,17 @@ const string sshfp_txt("2 1 123456789abcdef67890123456789abcdef67890");
 const generic::SSHFP rdata_sshfp(2, 1, "123456789abcdef67890123456789abcdef67890");
 
 TEST_F(Rdata_SSHFP_Test, createFromText) {
+    // Basic test
     const generic::SSHFP rdata_sshfp2(sshfp_txt);
     EXPECT_EQ(0, rdata_sshfp2.compare(rdata_sshfp));
+
+    // With different spacing
+    const generic::SSHFP rdata_sshfp3("2 1   123456789abcdef67890123456789abcdef67890");
+    EXPECT_EQ(0, rdata_sshfp3.compare(rdata_sshfp));
+
+    // Combination of lowercase and uppercase
+    const generic::SSHFP rdata_sshfp4("2 1   123456789ABCDEF67890123456789abcdef67890");
+    EXPECT_EQ(0, rdata_sshfp4.compare(rdata_sshfp));
 }
 
 TEST_F(Rdata_SSHFP_Test, badText) {
@@ -60,9 +69,14 @@ TEST_F(Rdata_SSHFP_Test, copy) {
 }
 
 TEST_F(Rdata_SSHFP_Test, createFromWire) {
+    // Basic test
     EXPECT_EQ(0, rdata_sshfp.compare(
                   *rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
                                         "rdata_sshfp_fromWire")));
+    // Combination of lowercase and uppercase
+    EXPECT_EQ(0, rdata_sshfp.compare(
+                  *rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                        "rdata_sshfp_fromWire2")));
     // TBD: more tests
 }
 
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2 b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire2
new file mode 100644 (file)
index 0000000..a695548
--- /dev/null
@@ -0,0 +1,4 @@
+# SSHFP RDATA, RDLEN=22
+0016
+# ALGORITHM=2 FINGERPRINT_TYPE=1 FINGERPRINT=123456789ABCDEF67890123456789abcdef67890
+02 01 123456789ABCDEF67890123456789abcdef67890