BIND 10 trac2387, updated. a852fc05305f5c062ecf9d3c9ff6a5b836370d6d [2387] Rewrite unified tests using helper methods

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Mar 26 14:27:19 UTC 2013


The branch, trac2387 has been updated
       via  a852fc05305f5c062ecf9d3c9ff6a5b836370d6d (commit)
      from  53e18a35628a7a595d0de637ae4a045e41fe6b64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a852fc05305f5c062ecf9d3c9ff6a5b836370d6d
Author: Mukund Sivaraman <muks at isc.org>
Date:   Tue Mar 26 19:56:58 2013 +0530

    [2387] Rewrite unified tests using helper methods

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/tests/rdata_dnskey_unittest.cc |   67 ++++++++++++++++++----------
 1 file changed, 43 insertions(+), 24 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/tests/rdata_dnskey_unittest.cc b/src/lib/dns/tests/rdata_dnskey_unittest.cc
index 2b31066..a74e5ef 100644
--- a/src/lib/dns/tests/rdata_dnskey_unittest.cc
+++ b/src/lib/dns/tests/rdata_dnskey_unittest.cc
@@ -52,6 +52,37 @@ protected:
         rdata_dnskey2(dnskey_txt2)
     {}
 
+    void checkFromText_None(const string& rdata_str)
+    {
+        checkFromText<generic::DNSKEY, isc::Exception, isc::Exception>(
+            rdata_str, rdata_dnskey2, false, false);
+    }
+
+    void checkFromText_InvalidText(const string& rdata_str)
+    {
+        checkFromText<generic::DNSKEY, InvalidRdataText, InvalidRdataText>(
+            rdata_str, rdata_dnskey2, true, true);
+    }
+
+    void checkFromText_InvalidLength(const string& rdata_str)
+    {
+        checkFromText<generic::DNSKEY, InvalidRdataLength, InvalidRdataLength>(
+            rdata_str, rdata_dnskey2, true, true);
+    }
+
+    void checkFromText_BadValue(const string& rdata_str)
+    {
+        checkFromText<generic::DNSKEY, BadValue, BadValue>(
+            rdata_str, rdata_dnskey2, true, true);
+    }
+
+    void checkFromText_LexerError(const string& rdata_str)
+    {
+        checkFromText
+            <generic::DNSKEY, InvalidRdataText, MasterLexer::LexerError>(
+                rdata_str, rdata_dnskey2, true, true);
+    }
+
     const string dnskey_txt;
     const string dnskey_txt2;
     const generic::DNSKEY rdata_dnskey;
@@ -62,48 +93,36 @@ TEST_F(Rdata_DNSKEY_Test, fromText) {
     EXPECT_EQ(dnskey_txt, rdata_dnskey.toText());
 
     // Space in key data is OK
-    checkFromText<generic::DNSKEY, isc::Exception, isc::Exception>(
-        "257 3 5 YmluZDEw LmlzYy5vcmc=", rdata_dnskey2, false, false);
+    checkFromText_None("257 3 5 YmluZDEw LmlzYy5vcmc=");
 
     // Delimited number in key data is OK
-    checkFromText<generic::DNSKEY, isc::Exception, isc::Exception>(
-        "257 3 5 YmluZDEwLmlzYy 5 vcmc=", rdata_dnskey2, false, false);
+    checkFromText_None("257 3 5 YmluZDEwLmlzYy 5 vcmc=");
 
     // Key data missing
-    checkFromText<generic::DNSKEY, InvalidRdataText, InvalidRdataText>(
-        "257 3 5", rdata_dnskey2, true, true);
+    checkFromText_InvalidText("257 3 5");
 
     // Flags field out of range
-    checkFromText<generic::DNSKEY, InvalidRdataText, InvalidRdataText>(
-        "65536 3 5 YmluZDEwLmlzYy5vcmc=", rdata_dnskey2, true, true);
+    checkFromText_InvalidText("65536 3 5 YmluZDEwLmlzYy5vcmc=");
 
     // Protocol field out of range
-    checkFromText<generic::DNSKEY, InvalidRdataText, InvalidRdataText>(
-        "257 256 5 YmluZDEwLmlzYy5vcmc=", rdata_dnskey2, true, true);
+    checkFromText_InvalidText("257 256 5 YmluZDEwLmlzYy5vcmc=");
 
     // Algorithm field out of range
-    checkFromText<generic::DNSKEY, InvalidRdataText, InvalidRdataText>(
-        "257 3 256 YmluZDEwLmlzYy5vcmc=", rdata_dnskey2, true, true);
+    checkFromText_InvalidText("257 3 256 YmluZDEwLmlzYy5vcmc=");
 
     // Missing algorithm field
-    checkFromText<generic::DNSKEY, InvalidRdataText, MasterLexer::LexerError>(
-        "257 3 YmluZDEwLmlzYy5vcmc=", rdata_dnskey2, true, true);
+    checkFromText_LexerError("257 3 YmluZDEwLmlzYy5vcmc=");
 
     // Invalid key data field (not Base64)
-    checkFromText<generic::DNSKEY, BadValue, BadValue>(
-        "257 3 5 BAAAAAAAAAAAD", rdata_dnskey2, true, true);
+    checkFromText_BadValue("257 3 5 BAAAAAAAAAAAD");
 
     // Key data too short for algorithm=1
-    checkFromText<generic::DNSKEY, InvalidRdataLength, InvalidRdataLength>(
-        "1 1 1 YQ==", rdata_dnskey2, true, true);
+    checkFromText_InvalidLength("1 1 1 YQ==");
 
     // String instead of number
-    checkFromText<generic::DNSKEY, InvalidRdataText, MasterLexer::LexerError>(
-        "foo 3 5 YmFiYWJhYmE=", rdata_dnskey2, true, true);
-    checkFromText<generic::DNSKEY, InvalidRdataText, MasterLexer::LexerError>(
-        "257 foo 5 YmFiYWJhYmE=", rdata_dnskey2, true, true);
-    checkFromText<generic::DNSKEY, InvalidRdataText, MasterLexer::LexerError>(
-        "257 3 foo YmFiYWJhYmE=", rdata_dnskey2, true, true);
+    checkFromText_LexerError("foo 3 5 YmFiYWJhYmE=");
+    checkFromText_LexerError("257 foo 5 YmFiYWJhYmE=");
+    checkFromText_LexerError("257 3 foo YmFiYWJhYmE=");
 }
 
 TEST_F(Rdata_DNSKEY_Test, assign) {



More information about the bind10-changes mailing list