From: Mukund Sivaraman Date: Mon, 23 Jul 2012 06:14:59 +0000 (+0530) Subject: [2124] Add some more wire data tests X-Git-Tag: trac2351_base~175 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5e7af00c87fdb082fcaf024727de244a822513c5;p=thirdparty%2Fkea.git [2124] Add some more wire data tests --- diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc index 728b548d15..79d1d66ac9 100644 --- a/src/lib/dns/tests/rdata_sshfp_unittest.cc +++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc @@ -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) { diff --git a/src/lib/dns/tests/testdata/.gitignore b/src/lib/dns/tests/testdata/.gitignore index e56355b96c..5b217a8a35 100644 --- a/src/lib/dns/tests/testdata/.gitignore +++ b/src/lib/dns/tests/testdata/.gitignore @@ -79,6 +79,11 @@ /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 diff --git a/src/lib/dns/tests/testdata/Makefile.am b/src/lib/dns/tests/testdata/Makefile.am index 043ea559fc..d4f95fbf80 100644 --- a/src/lib/dns/tests/testdata/Makefile.am +++ b/src/lib/dns/tests/testdata/Makefile.am @@ -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 index 0000000000..bf80ec49d4 --- /dev/null +++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire3.spec @@ -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 index 0000000000..965c74629b --- /dev/null +++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire4.spec @@ -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 index 0000000000..1aff335718 --- /dev/null +++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire5.spec @@ -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 index 0000000000..f71d1553ba --- /dev/null +++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire6.spec @@ -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 index 0000000000..6fc63e9248 --- /dev/null +++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire7.spec @@ -0,0 +1,9 @@ +# +# SSHFP RDATA +# +[custom] +sections: sshfp +[sshfp] +fingerprint: 123456789abcdef67890123456789abcdef67890 +algorithm: 255 +fingerprint_type: 255