]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2124] Add some more wire data tests
authorMukund Sivaraman <muks@isc.org>
Mon, 23 Jul 2012 06:14:59 +0000 (11:44 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 23 Jul 2012 06:14:59 +0000 (11:44 +0530)
src/lib/dns/tests/rdata_sshfp_unittest.cc
src/lib/dns/tests/testdata/.gitignore
src/lib/dns/tests/testdata/Makefile.am
src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec [new file with mode: 0644]
src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec [new file with mode: 0644]
src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec [new file with mode: 0644]
src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec [new file with mode: 0644]
src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec [new file with mode: 0644]

index 728b548d153d6874b1c8e9d210bc914083fbc0f9..79d1d66ac9745e20b0a400b3a21688e5ac317c72 100644 (file)
@@ -105,7 +105,27 @@ TEST_F(Rdata_SSHFP_Test, createFromWire) {
     EXPECT_EQ(0, rdata_sshfp.compare(
                   *rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
                                         "rdata_sshfp_fromWire2")));
-    // TBD: more tests
+    // algorithm=1, fingerprint=1
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire3.wire"));
+
+    // algorithm=255, fingerprint=1
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire4.wire"));
+
+    // algorithm=0, fingerprint=1
+    EXPECT_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                      "rdata_sshfp_fromWire5.wire"),
+                 InvalidRdataText);
+
+    // algorithm=5, fingerprint=0
+    EXPECT_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                      "rdata_sshfp_fromWire6.wire"),
+                 InvalidRdataText);
+
+    // algorithm=255, fingerprint=255
+    EXPECT_NO_THROW(rdataFactoryFromFile(RRType("SSHFP"), RRClass("IN"),
+                                         "rdata_sshfp_fromWire7.wire"));
 }
 
 TEST_F(Rdata_SSHFP_Test, toText) {
index e56355b96ca842bb427483401be8e685520df8b8..5b217a8a35ba7f5d4acc70e8bd9bb82bedbebbca 100644 (file)
 /rdata_soa_toWireUncompressed.wire
 /rdata_sshfp_fromWire1.wire
 /rdata_sshfp_fromWire2.wire
+/rdata_sshfp_fromWire3.wire
+/rdata_sshfp_fromWire4.wire
+/rdata_sshfp_fromWire5.wire
+/rdata_sshfp_fromWire6.wire
+/rdata_sshfp_fromWire7.wire
 /rdata_tsig_fromWire1.wire
 /rdata_tsig_fromWire2.wire
 /rdata_tsig_fromWire3.wire
index 043ea559fcb1da88dbedb6d79468d7245ba24884..d4f95fbf80a56f4ff806f985b8fc917157f2e8ba 100644 (file)
@@ -45,6 +45,9 @@ BUILT_SOURCES += rdata_rp_fromWire3.wire rdata_rp_fromWire4.wire
 BUILT_SOURCES += rdata_rp_fromWire5.wire rdata_rp_fromWire6.wire
 BUILT_SOURCES += rdata_rp_toWire1.wire rdata_rp_toWire2.wire
 BUILT_SOURCES += rdata_sshfp_fromWire1.wire rdata_sshfp_fromWire2.wire
+BUILT_SOURCES += rdata_sshfp_fromWire3.wire rdata_sshfp_fromWire4.wire
+BUILT_SOURCES += rdata_sshfp_fromWire5.wire rdata_sshfp_fromWire6.wire
+BUILT_SOURCES += rdata_sshfp_fromWire7.wire
 BUILT_SOURCES += rdata_afsdb_fromWire1.wire rdata_afsdb_fromWire2.wire
 BUILT_SOURCES += rdata_afsdb_fromWire3.wire rdata_afsdb_fromWire4.wire
 BUILT_SOURCES += rdata_afsdb_fromWire5.wire
@@ -129,6 +132,9 @@ EXTRA_DIST += rdata_rp_fromWire5.spec rdata_rp_fromWire6.spec
 EXTRA_DIST += rdata_rp_toWire1.spec rdata_rp_toWire2.spec
 EXTRA_DIST += rdata_sshfp_fromWire rdata_sshfp_fromWire2
 EXTRA_DIST += rdata_sshfp_fromWire1.spec rdata_sshfp_fromWire2.spec
+EXTRA_DIST += rdata_sshfp_fromWire3.spec rdata_sshfp_fromWire4.spec
+EXTRA_DIST += rdata_sshfp_fromWire5.spec rdata_sshfp_fromWire6.spec
+EXTRA_DIST += rdata_sshfp_fromWire7.spec
 EXTRA_DIST += rdata_afsdb_fromWire1.spec rdata_afsdb_fromWire2.spec
 EXTRA_DIST += rdata_afsdb_fromWire3.spec rdata_afsdb_fromWire4.spec
 EXTRA_DIST += rdata_afsdb_fromWire5.spec
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec
new file mode 100644 (file)
index 0000000..bf80ec4
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
+algorithm: 1
+fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec
new file mode 100644 (file)
index 0000000..965c746
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
+algorithm: 255
+fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec
new file mode 100644 (file)
index 0000000..1aff335
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
+algorithm: 0
+fingerprint_type: 1
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec
new file mode 100644 (file)
index 0000000..f71d155
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
+algorithm: 5
+fingerprint_type: 0
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec
new file mode 100644 (file)
index 0000000..6fc63e9
--- /dev/null
@@ -0,0 +1,9 @@
+#
+# SSHFP RDATA
+#
+[custom]
+sections: sshfp
+[sshfp]
+fingerprint: 123456789abcdef67890123456789abcdef67890
+algorithm: 255
+fingerprint_type: 255