Parcourir la source

Merge branch 'trac2517'

Mukund Sivaraman il y a 11 ans
Parent
commit
06b32bac47
1 fichiers modifiés avec 47 ajouts et 2 suppressions
  1. 47 2
      src/lib/dns/tests/rdata_rrsig_unittest.cc

+ 47 - 2
src/lib/dns/tests/rdata_rrsig_unittest.cc

@@ -35,6 +35,45 @@ using namespace isc::util;
 using namespace isc::dns::rdata;
 
 namespace {
+
+const uint8_t wiredata_rrsig[] = {
+    // type covered = A
+    0x00, 0x01,
+    // algorithm = 5
+    0x05,
+    // labels = 4
+    0x04,
+    // original TTL = 43200 (0x0000a8c0)
+    0x00, 0x00, 0xa8, 0xc0,
+    // signature expiration = 1266961577 (0x4b844ca9)
+    0x4b, 0x84, 0x4c, 0xa9,
+    // signature inception = 1266875177 (0x4b82fb29)
+    0x4b, 0x82, 0xfb, 0x29,
+    // key tag = 8496 (0x2130)
+    0x21, 0x30,
+    // signer's name (isc.org.)
+    // 3     i     s     c     3     o     r     g     0
+    0x03, 0x69, 0x73, 0x63, 0x03, 0x6f, 0x72, 0x67, 0x00,
+    // signature data follows
+    0x7a, 0xfc, 0x61, 0x94, 0x6c,
+    0x75, 0xde, 0x6a, 0x4a, 0x2d, 0x59, 0x0a, 0xb2,
+    0x3a, 0x46, 0xcf, 0x27, 0x12, 0xe6, 0xdc, 0x2d,
+    0x22, 0x8c, 0x4e, 0x9a, 0x53, 0x75, 0xe3, 0x0f,
+    0x6d, 0xe4, 0x08, 0x33, 0x18, 0x19, 0xb3, 0x76,
+    0x21, 0x9d, 0x2c, 0x8a, 0xc5, 0x69, 0xba, 0xab,
+    0xef, 0x66, 0x9f, 0xda, 0xb5, 0x2a, 0xf9, 0x40,
+    0xc1, 0x28, 0xc5, 0x97, 0xba, 0x3c, 0x19, 0x4d,
+    0x95, 0x13, 0xc2, 0xcd, 0xf6, 0xb1, 0x59, 0x5d,
+    0x0c, 0xf9, 0x3f, 0x35, 0xbb, 0x9a, 0x70, 0x93,
+    0x36, 0xe5, 0xf4, 0x17, 0x7e, 0xfe, 0x66, 0x3b,
+    0x70, 0x1f, 0xed, 0x33, 0xa8, 0xa3, 0x0d, 0xc0,
+    0x8c, 0xc6, 0x95, 0x1b, 0xd8, 0x9c, 0x8c, 0x25,
+    0xb4, 0x57, 0x9e, 0x56, 0x71, 0x64, 0x14, 0x7f,
+    0x8f, 0x6d, 0xfa, 0xc5, 0xca, 0x3f, 0x36, 0xe2,
+    0xa4, 0xdf, 0x60, 0xfa, 0xcd, 0x59, 0x3e, 0x22,
+    0x32, 0xa1, 0xf7
+};
+
 class Rdata_RRSIG_Test : public RdataTest {
 protected:
     Rdata_RRSIG_Test() :
@@ -299,13 +338,19 @@ TEST_F(Rdata_RRSIG_Test, createFromLexer) {
 }
 
 TEST_F(Rdata_RRSIG_Test, toWireRenderer) {
-    // FIXME: This doesn't check the result.
     rdata_rrsig.toWire(renderer);
+
+    EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
+                        renderer.getData(), renderer.getLength(),
+                        wiredata_rrsig, sizeof(wiredata_rrsig));
 }
 
 TEST_F(Rdata_RRSIG_Test, toWireBuffer) {
-    // FIXME: This doesn't check the result.
     rdata_rrsig.toWire(obuffer);
+
+    EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
+                        obuffer.getData(), obuffer.getLength(),
+                        wiredata_rrsig, sizeof(wiredata_rrsig));
 }
 
 TEST_F(Rdata_RRSIG_Test, createFromWire) {