Index: test/unittests/wasm/decoder-unittest.cc |
diff --git a/test/unittests/wasm/decoder-unittest.cc b/test/unittests/wasm/decoder-unittest.cc |
index fdb353714e5c320bf1d7c36081d2989a0dccdc15..9f68dc8c95dd04efdeac2633c1fcff2a199a7243 100644 |
--- a/test/unittests/wasm/decoder-unittest.cc |
+++ b/test/unittests/wasm/decoder-unittest.cc |
@@ -19,18 +19,18 @@ class DecoderTest : public TestWithZone { |
Decoder decoder; |
}; |
-#define CHECK_UINT32V_INLINE(expected, expected_length, ...) \ |
- do { \ |
- const byte data[] = {__VA_ARGS__}; \ |
- decoder.Reset(data, data + sizeof(data)); \ |
- unsigned length; \ |
- EXPECT_EQ(expected, \ |
- decoder.checked_read_u32v(decoder.start(), 0, &length)); \ |
- EXPECT_EQ(expected_length, length); \ |
- EXPECT_EQ(data, decoder.pc()); \ |
- EXPECT_TRUE(decoder.ok()); \ |
- EXPECT_EQ(expected, decoder.consume_u32v()); \ |
- EXPECT_EQ(data + expected_length, decoder.pc()); \ |
+#define CHECK_UINT32V_INLINE(expected, expected_length, ...) \ |
+ do { \ |
+ const byte data[] = {__VA_ARGS__}; \ |
+ decoder.Reset(data, data + sizeof(data)); \ |
+ unsigned length; \ |
+ EXPECT_EQ(static_cast<uint32_t>(expected), \ |
+ decoder.checked_read_u32v(decoder.start(), 0, &length)); \ |
+ EXPECT_EQ(static_cast<unsigned>(expected_length), length); \ |
+ EXPECT_EQ(data, decoder.pc()); \ |
+ EXPECT_TRUE(decoder.ok()); \ |
+ EXPECT_EQ(static_cast<uint32_t>(expected), decoder.consume_u32v()); \ |
+ EXPECT_EQ(data + expected_length, decoder.pc()); \ |
} while (false) |
#define CHECK_INT32V_INLINE(expected, expected_length, ...) \ |
@@ -40,7 +40,7 @@ class DecoderTest : public TestWithZone { |
unsigned length; \ |
EXPECT_EQ(expected, \ |
decoder.checked_read_i32v(decoder.start(), 0, &length)); \ |
- EXPECT_EQ(expected_length, length); \ |
+ EXPECT_EQ(static_cast<unsigned>(expected_length), length); \ |
EXPECT_EQ(data, decoder.pc()); \ |
EXPECT_TRUE(decoder.ok()); \ |
EXPECT_EQ(expected, decoder.consume_i32v()); \ |
@@ -52,9 +52,9 @@ class DecoderTest : public TestWithZone { |
const byte data[] = {__VA_ARGS__}; \ |
decoder.Reset(data, data + sizeof(data)); \ |
unsigned length; \ |
- EXPECT_EQ(expected, \ |
+ EXPECT_EQ(static_cast<uint64_t>(expected), \ |
decoder.checked_read_u64v(decoder.start(), 0, &length)); \ |
- EXPECT_EQ(expected_length, length); \ |
+ EXPECT_EQ(static_cast<unsigned>(expected_length), length); \ |
} while (false) |
#define CHECK_INT64V_INLINE(expected, expected_length, ...) \ |
@@ -64,7 +64,7 @@ class DecoderTest : public TestWithZone { |
unsigned length; \ |
EXPECT_EQ(expected, \ |
decoder.checked_read_i64v(decoder.start(), 0, &length)); \ |
- EXPECT_EQ(expected_length, length); \ |
+ EXPECT_EQ(static_cast<unsigned>(expected_length), length); \ |
} while (false) |
TEST_F(DecoderTest, ReadU32v_OneByte) { |
@@ -377,7 +377,7 @@ TEST_F(DecoderTest, ReadU32v_off_end1) { |
unsigned length = 0; |
decoder.Reset(data, data); |
decoder.checked_read_u32v(decoder.start(), 0, &length); |
- EXPECT_EQ(0, length); |
+ EXPECT_EQ(0u, length); |
EXPECT_FALSE(decoder.ok()); |
} |
@@ -432,7 +432,7 @@ TEST_F(DecoderTest, ReadU32v_extra_bits) { |
unsigned length = 0; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_u32v(decoder.start(), 0, &length); |
- EXPECT_EQ(5, length); |
+ EXPECT_EQ(5u, length); |
EXPECT_FALSE(decoder.ok()); |
} |
} |
@@ -443,7 +443,7 @@ TEST_F(DecoderTest, ReadI32v_extra_bits_negative) { |
byte data[] = {0xff, 0xff, 0xff, 0xff, 0x7f}; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_i32v(decoder.start(), 0, &length); |
- EXPECT_EQ(5, length); |
+ EXPECT_EQ(5u, length); |
EXPECT_TRUE(decoder.ok()); |
} |
@@ -453,7 +453,7 @@ TEST_F(DecoderTest, ReadI32v_extra_bits_positive) { |
byte data[] = {0x80, 0x80, 0x80, 0x80, 0x77}; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_i32v(decoder.start(), 0, &length); |
- EXPECT_EQ(5, length); |
+ EXPECT_EQ(5u, length); |
EXPECT_FALSE(decoder.ok()); |
} |
@@ -475,16 +475,16 @@ TEST_F(DecoderTest, ReadU32v_Bits) { |
uint32_t val = kVals[v]; |
if (i < 32) val &= ((1 << i) - 1); |
- int length = 1 + i / 7; |
- for (int j = 0; j < kMaxSize; j++) { |
+ unsigned length = 1 + i / 7; |
+ for (unsigned j = 0; j < kMaxSize; j++) { |
data[j] = static_cast<byte>((val >> (7 * j)) & MASK_7); |
} |
- for (int j = 0; j < length - 1; j++) { |
+ for (unsigned j = 0; j < length - 1; j++) { |
data[j] |= 0x80; |
} |
// foreach buffer size 0...5 |
- for (int limit = 0; limit <= kMaxSize; limit++) { |
+ for (unsigned limit = 0; limit <= kMaxSize; limit++) { |
decoder.Reset(data, data + limit); |
unsigned rlen; |
uint32_t result = decoder.checked_read_u32v(data, 0, &rlen); |
@@ -534,13 +534,13 @@ TEST_F(DecoderTest, ReadU64v_PowerOf2) { |
const int kMaxSize = 10; |
byte data[kMaxSize]; |
- for (int i = 0; i < 64; i++) { |
+ for (unsigned i = 0; i < 64; i++) { |
const uint64_t val = 1ull << i; |
- int index = i / 7; |
+ unsigned index = i / 7; |
data[index] = 1 << (i % 7); |
memset(data, 0x80, index); |
- for (int limit = 0; limit <= kMaxSize; limit++) { |
+ for (unsigned limit = 0; limit <= kMaxSize; limit++) { |
decoder.Reset(data, data + limit); |
unsigned length; |
uint64_t result = decoder.checked_read_u64v(data, 0, &length); |
@@ -572,16 +572,16 @@ TEST_F(DecoderTest, ReadU64v_Bits) { |
uint64_t val = kVals[v]; |
if (i < 64) val &= ((1ull << i) - 1); |
- int length = 1 + i / 7; |
- for (int j = 0; j < kMaxSize; j++) { |
+ unsigned length = 1 + i / 7; |
+ for (unsigned j = 0; j < kMaxSize; j++) { |
data[j] = static_cast<byte>((val >> (7 * j)) & MASK_7); |
} |
- for (int j = 0; j < length - 1; j++) { |
+ for (unsigned j = 0; j < length - 1; j++) { |
data[j] |= 0x80; |
} |
// foreach buffer size 0...10 |
- for (int limit = 0; limit <= kMaxSize; limit++) { |
+ for (unsigned limit = 0; limit <= kMaxSize; limit++) { |
decoder.Reset(data, data + limit); |
unsigned rlen; |
uint64_t result = decoder.checked_read_u64v(data, 0, &rlen); |
@@ -614,16 +614,16 @@ TEST_F(DecoderTest, ReadI64v_Bits) { |
for (int i = 1; i <= 64; i++) { |
const int64_t val = bit_cast<int64_t>(kVals[v] << (64 - i)) >> (64 - i); |
- int length = 1 + i / 7; |
- for (int j = 0; j < kMaxSize; j++) { |
+ unsigned length = 1 + i / 7; |
+ for (unsigned j = 0; j < kMaxSize; j++) { |
data[j] = static_cast<byte>((val >> (7 * j)) & MASK_7); |
} |
- for (int j = 0; j < length - 1; j++) { |
+ for (unsigned j = 0; j < length - 1; j++) { |
data[j] |= 0x80; |
} |
// foreach buffer size 0...10 |
- for (int limit = 0; limit <= kMaxSize; limit++) { |
+ for (unsigned limit = 0; limit <= kMaxSize; limit++) { |
decoder.Reset(data, data + limit); |
unsigned rlen; |
int64_t result = decoder.checked_read_i64v(data, 0, &rlen); |
@@ -646,7 +646,7 @@ TEST_F(DecoderTest, ReadU64v_extra_bits) { |
unsigned length = 0; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_u64v(decoder.start(), 0, &length); |
- EXPECT_EQ(10, length); |
+ EXPECT_EQ(10u, length); |
EXPECT_FALSE(decoder.ok()); |
} |
} |
@@ -657,7 +657,7 @@ TEST_F(DecoderTest, ReadI64v_extra_bits_negative) { |
byte data[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_i64v(decoder.start(), 0, &length); |
- EXPECT_EQ(10, length); |
+ EXPECT_EQ(10u, length); |
EXPECT_TRUE(decoder.ok()); |
} |
@@ -667,7 +667,7 @@ TEST_F(DecoderTest, ReadI64v_extra_bits_positive) { |
byte data[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x77}; |
decoder.Reset(data, data + sizeof(data)); |
decoder.checked_read_i64v(decoder.start(), 0, &length); |
- EXPECT_EQ(10, length); |
+ EXPECT_EQ(10u, length); |
EXPECT_FALSE(decoder.ok()); |
} |