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

Unified Diff: util/stdlib/string_number_conversion_test.cc

Issue 807463004: win: avoid warnings in string_number_conversion_test.cc (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/stdlib/string_number_conversion_test.cc
diff --git a/util/stdlib/string_number_conversion_test.cc b/util/stdlib/string_number_conversion_test.cc
index ec0d44ae301dd267381923ce819a03649279d751..97d3152bbae4d9d7efc35b12234a06299c846a02 100644
--- a/util/stdlib/string_number_conversion_test.cc
+++ b/util/stdlib/string_number_conversion_test.cc
@@ -53,7 +53,7 @@ TEST(StringNumberConversion, StringToInt) {
{"0x80000000", false, 0},
{"0xFFFFFFFF", false, 0},
{"-0x7fffffff", true, -2147483647},
- {"-0x80000000", true, -2147483648},
+ {"-0x80000000", true, std::numeric_limits<int>::min()},
{"-0x80000001", false, 0},
{"-0xffffffff", false, 0},
{"0x100000000", false, 0},
@@ -108,8 +108,10 @@ TEST(StringNumberConversion, StringToInt) {
}
}
- // Ensure that embedded NUL characters are treated as bad input.
- const char input[] = "6\0006";
+ // Ensure that embedded NUL characters are treated as bad input. The string
+ // is split to avoid MSVC warning:
+ // "decimal digit terminates octal escape sequence".
+ const char input[] = "6\000" "6";
base::StringPiece input_string(input, arraysize(input) - 1);
int output;
EXPECT_FALSE(StringToNumber(input_string, &output));
@@ -204,8 +206,10 @@ TEST(StringNumberConversion, StringToUnsignedInt) {
}
}
- // Ensure that embedded NUL characters are treated as bad input.
- const char input[] = "6\0006";
+ // Ensure that embedded NUL characters are treated as bad input. The string
+ // is split to avoid MSVC warning:
+ // "decimal digit terminates octal escape sequence".
+ const char input[] = "6\000" "6";
base::StringPiece input_string(input, arraysize(input) - 1);
unsigned int output;
EXPECT_FALSE(StringToNumber(input_string, &output));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698