]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3833] Improved pack_1Byte and pack_2Bytes coding
authorFrancis Dupont <fdupont@isc.org>
Thu, 11 Jun 2015 12:16:54 +0000 (14:16 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 11 Jun 2015 12:16:54 +0000 (14:16 +0200)
src/lib/dhcp/tests/opaque_data_tuple_unittest.cc

index 95f4c6fa8a5e04ea4eb1a35c313575f1cb37a99c..067f7661cd22b25e8043fc4fb352db1a4a0a04de 100644 (file)
@@ -267,7 +267,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
     EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError);
     // Set the data for tuple.
     std::vector<uint8_t> data;
-    for (unsigned i = 0; i < 100; ++i) {
+    for (uint8_t i = 0; i < 100; ++i) {
         data.push_back(i);
     }
     tuple.assign(data.begin(), data.size());
@@ -289,7 +289,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
     out_buf.clear();
     // Fill in the tuple buffer so as it reaches maximum allowed length. The
     // maximum length is 255 when the size of the length field is one byte.
-    for (unsigned i = 100; i < 255; ++i) {
+    for (uint8_t i = 100; i < 255; ++i) {
         data.push_back(i);
     }
     ASSERT_EQ(255, data.size());
@@ -327,7 +327,7 @@ TEST(OpaqueDataTuple, pack2Bytes) {
     // Set the data for tuple.
     std::vector<uint8_t> data;
     for (unsigned i = 0; i < 512; ++i) {
-        data.push_back(i);
+        data.push_back(i & 0xff);
     }
     tuple.assign(data.begin(), data.size());
     // The pack should now succeed.