]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4111] Style in checkEmpty
authorFrancis Dupont <fdupont@isc.org>
Sun, 1 Nov 2015 01:08:58 +0000 (02:08 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sun, 1 Nov 2015 01:08:58 +0000 (02:08 +0100)
src/lib/dhcp/tests/option6_addrlst_unittest.cc

index eca7bc9cb5cb8721630bb99a6ac204db1437de6b..6e6d29c2608b2346551a76d2830446136b2549a4 100644 (file)
@@ -255,15 +255,17 @@ TEST_F(Option6AddrLstTest, toText) {
 // Option6AddrLst.  It assumes the option type is D6O_DHCPV4_O_DHCPV6_SERVER.
 void
 checkEmpty(Option6AddrLst& addrs) {
+    uint8_t expected[] = {
+        D6O_DHCPV4_O_DHCPV6_SERVER/256, D6O_DHCPV4_O_DHCPV6_SERVER%256,
+        0, 0
+    };
     EXPECT_EQ(4, addrs.len());  // just 2-byte type and 2-byte len fields
     EXPECT_EQ("type=00088, len=00000:", addrs.toText());
 
     OutputBuffer out_buf(255);
     addrs.pack(out_buf);
     EXPECT_EQ(4, out_buf.getLength());
-    const uint8_t *cp = static_cast<const uint8_t *>(out_buf.getData());
-    EXPECT_EQ(D6O_DHCPV4_O_DHCPV6_SERVER, cp[0] * 256 + cp[1]);
-    EXPECT_EQ(0, cp[2] * 256 + cp[3]);
+    EXPECT_EQ(0, memcmp(expected, out_buf.getData(), 4));
 }
 
 // Confirms no disruption happens for an empty set of addresses.