Index: base/strings/string_number_conversions_unittest.cc |
diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc |
index fe22be9e56154362dd405362a8fabd91036c3113..1c51dee34b26b4f551aa954dbd464f85f1b10e41 100644 |
--- a/base/strings/string_number_conversions_unittest.cc |
+++ b/base/strings/string_number_conversions_unittest.cc |
@@ -317,25 +317,25 @@ TEST(StringNumberConversionsTest, HexStringToUInt64) { |
} cases[] = { |
{"0", 0, true}, |
{"42", 66, true}, |
- {"-42", -66, true}, |
+ {"-42", static_cast<uint64>(-66), false}, |
{"+42", 66, true}, |
{"40acd88557b", GG_INT64_C(4444444448123), true}, |
{"7fffffff", INT_MAX, true}, |
- {"-80000000", INT_MIN, true}, |
+ {"-80000000", static_cast<uint64>(INT_MIN), false}, |
{"ffffffff", 0xffffffff, true}, |
{"DeadBeef", 0xdeadbeef, true}, |
{"0x42", 66, true}, |
- {"-0x42", -66, true}, |
+ {"-0x42", static_cast<uint64>(-66), false}, |
{"+0x42", 66, true}, |
{"0x40acd88557b", GG_INT64_C(4444444448123), true}, |
{"0x7fffffff", INT_MAX, true}, |
- {"-0x80000000", INT_MIN, true}, |
+ {"-0x80000000", static_cast<uint64>(INT_MIN), false}, |
{"0xffffffff", 0xffffffff, true}, |
{"0XDeadBeef", 0xdeadbeef, true}, |
{"0x7fffffffffffffff", kint64max, true}, |
- {"-0x8000000000000000", GG_UINT64_C(0x8000000000000000), true}, |
+ {"-0x8000000000000000", GG_UINT64_C(0x8000000000000000), false}, |
{"0x8000000000000000", GG_UINT64_C(0x8000000000000000), true}, |
- {"-0x8000000000000001", GG_UINT64_C(0x7fffffffffffffff), true}, |
+ {"-0x8000000000000001", GG_UINT64_C(0x7fffffffffffffff), false}, |
{"0xFFFFFFFFFFFFFFFF", kuint64max, true}, |
{"FFFFFFFFFFFFFFFF", kuint64max, true}, |
{"0x0000000000000000", 0, true}, |
@@ -358,8 +358,12 @@ TEST(StringNumberConversionsTest, HexStringToUInt64) { |
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { |
uint64 output = 0; |
- EXPECT_EQ(cases[i].success, HexStringToUInt64(cases[i].input, &output)); |
- EXPECT_EQ(cases[i].output, output); |
+ |
+ bool rv = HexStringToUInt64(cases[i].input, &output); |
+ EXPECT_TRUE(rv == cases[i].success); |
+ if (rv) { |
+ EXPECT_EQ(cases[i].output, output); |
+ } |
} |
// One additional test to verify that conversion of numbers in strings with |
// embedded NUL characters. The NUL and extra data after it should be |