OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "wtf/text/StringToNumber.h" | 5 #include "wtf/text/StringToNumber.h" |
6 | 6 |
| 7 #include <cstring> |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 #include <cstring> | |
9 | 9 |
10 namespace WTF { | 10 namespace WTF { |
11 | 11 |
12 TEST(StringToNumberTest, TestCharactersToIntStrict) { | 12 TEST(StringToNumberTest, TestCharactersToIntStrict) { |
13 #define EXPECT_VALID(string, expectedValue, base) \ | 13 #define EXPECT_VALID(string, expectedValue, base) \ |
14 do { \ | 14 do { \ |
15 bool ok; \ | 15 bool ok; \ |
16 int value = charactersToIntStrict(reinterpret_cast<const LChar*>(string), \ | 16 int value = charactersToIntStrict(reinterpret_cast<const LChar*>(string), \ |
17 std::strlen(string), &ok, base); \ | 17 std::strlen(string), &ok, base); \ |
18 EXPECT_TRUE(ok); \ | 18 EXPECT_TRUE(ok); \ |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 EXPECT_INVALID_HEXADECIMAL("-ffffffff"); | 117 EXPECT_INVALID_HEXADECIMAL("-ffffffff"); |
118 | 118 |
119 #undef EXPECT_VALID_DECIMAL | 119 #undef EXPECT_VALID_DECIMAL |
120 #undef EXPECT_INVALID_DECIMAL | 120 #undef EXPECT_INVALID_DECIMAL |
121 #undef EXPECT_VALID_HEXADECIMAL | 121 #undef EXPECT_VALID_HEXADECIMAL |
122 #undef EXPECT_INVALID_HEXADECIMAL | 122 #undef EXPECT_INVALID_HEXADECIMAL |
123 #undef EXPECT_VALID | 123 #undef EXPECT_VALID |
124 #undef EXPECT_INVALID | 124 #undef EXPECT_INVALID |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |