BIND 10 trac2396, updated. 261a171c3bd856a32cb40a280320af1d8179c78c [2396] Modified IOAddress tests in light of review

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Dec 6 11:20:56 UTC 2012


The branch, trac2396 has been updated
       via  261a171c3bd856a32cb40a280320af1d8179c78c (commit)
      from  8bc5490b0e4718fcf5759a0b24c02a83c4518e17 (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 261a171c3bd856a32cb40a280320af1d8179c78c
Author: Stephen Morris <stephen at isc.org>
Date:   Thu Dec 6 11:19:41 2012 +0000

    [2396] Modified IOAddress tests in light of review

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

Summary of changes:
 src/lib/asiolink/tests/io_address_unittest.cc |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc
index 55bf361..4bd7626 100644
--- a/src/lib/asiolink/tests/io_address_unittest.cc
+++ b/src/lib/asiolink/tests/io_address_unittest.cc
@@ -86,30 +86,27 @@ TEST(IOAddressTest, fromBytes) {
     EXPECT_EQ(addr.toText(), IOAddress("192.0.2.3").toText());
 }
 
-TEST(IOAddressTest, toBytes) {
-
+TEST(IOAddressTest, toBytesV4) {
     // Address and network byte-order representation of the address.
     const char* V4STRING = "192.0.2.1";
     uint8_t V4[] = {0xc0, 0x00, 0x02, 0x01};
 
+    std::vector<uint8_t> actual = IOAddress(V4STRING).toBytes();
+    ASSERT_EQ(sizeof(V4), actual.size());
+    EXPECT_TRUE(std::equal(actual.begin(), actual.end(), V4));
+}
+
+TEST(IOAddressTest, toBytesV6) {
+    // Address and network byte-order representation of the address.
     const char* V6STRING = "2001:db8:1::dead:beef";
     uint8_t V6[] = {
         0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x00, 0xde, 0xad, 0xbe, 0xef 
     };
 
-
-    // Do the V4 check.
-    IOAddress v4address(V4STRING);
-    std::vector<uint8_t> v4bytes = v4address.toBytes();
-    EXPECT_EQ(sizeof(V4), v4bytes.size());
-    EXPECT_TRUE(std::equal(v4bytes.begin(), v4bytes.end(), &V4[0]));
-
-    // Do the same for V6.
-    IOAddress v6address(V6STRING);
-    std::vector<uint8_t> v6bytes = v6address.toBytes();
-    EXPECT_EQ(sizeof(V6), v6bytes.size());
-    EXPECT_TRUE(std::equal(v6bytes.begin(), v6bytes.end(), &V6[0]));
+    std::vector<uint8_t> actual = IOAddress(V6STRING).toBytes();
+    ASSERT_EQ(sizeof(V6), actual.size());
+    EXPECT_TRUE(std::equal(actual.begin(), actual.end(), V6));
 }
 
 TEST(IOAddressTest, isV4) {



More information about the bind10-changes mailing list