Browse Source

[2124] Test toWire() with empty fingerprint data

Mukund Sivaraman 12 years ago
parent
commit
31477bf850
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/lib/dns/tests/rdata_sshfp_unittest.cc

+ 16 - 0
src/lib/dns/tests/rdata_sshfp_unittest.cc

@@ -195,9 +195,25 @@ TEST_F(Rdata_SSHFP_Test, emptyFingerprintFromWire) {
 
 TEST_F(Rdata_SSHFP_Test, emptyFingerprintFromString) {
     const generic::SSHFP rdata_sshfp2("5 6");
+    const uint8_t rdata_sshfp2_wiredata[] = {
+        // algorithm
+        0x05,
+        // fingerprint type
+        0x06
+    };
 
     EXPECT_EQ(5, rdata_sshfp2.getSSHFPAlgorithmNumber());
     EXPECT_EQ(6, rdata_sshfp2.getSSHFPFingerprintType());
     EXPECT_EQ(0, rdata_sshfp2.getFingerprintLen());
+
+    this->obuffer.clear();
+    rdata_sshfp2.toWire(this->obuffer);
+
+    EXPECT_EQ(2, this->obuffer.getLength());
+
+    EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
+                        this->obuffer.getData(),
+                        this->obuffer.getLength(),
+                        rdata_sshfp2_wiredata, sizeof(rdata_sshfp2_wiredata));
 }
 }