Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2033)

Unified Diff: base/strings/string_number_conversions_unittest.cc

Issue 14109020: HexStringToUInt64 should fail for negative input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clamp to closest value in the type range Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/strings/string_number_conversions.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 937bfb8e1550c8ad892006c7bcbd7808702921c6..4d413d768ac5a35d41e2ca14245a06904d86f0e7 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", static_cast<uint64>(-66), true},
+ {"-42", 0, false},
{"+42", 66, true},
{"40acd88557b", GG_INT64_C(4444444448123), true},
{"7fffffff", INT_MAX, true},
- {"-80000000", static_cast<uint64>(INT_MIN), true},
+ {"-80000000", 0, false},
{"ffffffff", 0xffffffff, true},
{"DeadBeef", 0xdeadbeef, true},
{"0x42", 66, true},
- {"-0x42", static_cast<uint64>(-66), true},
+ {"-0x42", 0, false},
{"+0x42", 66, true},
{"0x40acd88557b", GG_INT64_C(4444444448123), true},
{"0x7fffffff", INT_MAX, true},
- {"-0x80000000", static_cast<uint64>(INT_MIN), true},
+ {"-0x80000000", 0, false},
{"0xffffffff", 0xffffffff, true},
{"0XDeadBeef", 0xdeadbeef, true},
{"0x7fffffffffffffff", kint64max, true},
- {"-0x8000000000000000", GG_UINT64_C(0x8000000000000000), true},
+ {"-0x8000000000000000", 0, false},
{"0x8000000000000000", GG_UINT64_C(0x8000000000000000), true},
- {"-0x8000000000000001", GG_UINT64_C(0x7fffffffffffffff), true},
+ {"-0x8000000000000001", 0, false},
{"0xFFFFFFFFFFFFFFFF", kuint64max, true},
{"FFFFFFFFFFFFFFFF", kuint64max, true},
{"0x0000000000000000", 0, true},
« no previous file with comments | « base/strings/string_number_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698