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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp

Issue 2411713002: Fix parseHTMLInteger (Closed)
Patch Set: Try to fix warning for test Created 4 years, 2 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 | « third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp
index d9b4ade75a8adf837e8e8b60ae709e945075b750..556058fd79af22a240a993f46ac4ba100ef98c19 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserIdiomsTest.cpp
@@ -10,6 +10,26 @@ namespace blink {
namespace {
+TEST(HTMLParserIdiomsTest, ParseHTMLInteger) {
+ int value = 0;
+
+ EXPECT_TRUE(parseHTMLInteger("2147483646", value));
+ EXPECT_EQ(2147483646, value);
+ EXPECT_TRUE(parseHTMLInteger("2147483647", value));
+ EXPECT_EQ(2147483647, value);
+ value = 12345;
+ EXPECT_FALSE(parseHTMLInteger("2147483648", value));
+ EXPECT_EQ(12345, value);
+
+ EXPECT_TRUE(parseHTMLInteger("-2147483647", value));
+ EXPECT_EQ(-2147483647, value);
+ EXPECT_TRUE(parseHTMLInteger("-2147483648", value));
+ EXPECT_EQ(0 - 2147483648, value);
+ value = 12345;
+ EXPECT_FALSE(parseHTMLInteger("-2147483649", value));
+ EXPECT_EQ(12345, value);
+}
+
TEST(HTMLParserIdiomsTest, ParseHTMLNonNegativeInteger) {
unsigned value = 0;
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698