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

Unified Diff: tests/StringTest.cpp

Issue 17448012: Add SkString::appendU32() and SkString::appendU64() (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_cornercase_test_that_works_now Created 7 years, 6 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 | « src/core/SkString.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/StringTest.cpp
===================================================================
--- tests/StringTest.cpp (revision 9684)
+++ tests/StringTest.cpp (working copy)
@@ -102,20 +102,53 @@
a.set("abcd");
a.set("");
- a.appendS64(72036854775808LL, 0);
- REPORTER_ASSERT(reporter, a.equals("72036854775808"));
+ a.appendS32(0x7FFFFFFFL);
+ REPORTER_ASSERT(reporter, a.equals("2147483647"));
+ a.set("");
+ a.appendS32(0x80000001L);
+ REPORTER_ASSERT(reporter, a.equals("-2147483647"));
+ a.set("");
+ a.appendS32(0x80000000L);
+ REPORTER_ASSERT(reporter, a.equals("-2147483648"));
a.set("");
- a.appendS64(-1844674407370LL, 0);
- REPORTER_ASSERT(reporter, a.equals("-1844674407370"));
+ a.appendU32(0x7FFFFFFFUL);
+ REPORTER_ASSERT(reporter, a.equals("2147483647"));
+ a.set("");
+ a.appendU32(0x80000001UL);
+ REPORTER_ASSERT(reporter, a.equals("2147483649"));
+ a.set("");
+ a.appendU32(0xFFFFFFFFUL);
+ REPORTER_ASSERT(reporter, a.equals("4294967295"));
a.set("");
- a.appendS64(73709551616LL, 15);
- REPORTER_ASSERT(reporter, a.equals("000073709551616"));
+ a.appendS64(0x7FFFFFFFFFFFFFFFLL, 0);
+ REPORTER_ASSERT(reporter, a.equals("9223372036854775807"));
+ a.set("");
+ a.appendS64(0x8000000000000001LL, 0);
+ REPORTER_ASSERT(reporter, a.equals("-9223372036854775807"));
+ a.set("");
+ a.appendS64(0x8000000000000000LL, 0);
+ REPORTER_ASSERT(reporter, a.equals("-9223372036854775808"));
+ a.set("");
+ a.appendS64(0x0000000001000000LL, 15);
+ REPORTER_ASSERT(reporter, a.equals("000000016777216"));
+ a.set("");
+ a.appendS64(0xFFFFFFFFFF000000LL, 15);
+ REPORTER_ASSERT(reporter, a.equals("-000000016777216"));
a.set("");
- a.appendS64(-429496729612LL, 15);
- REPORTER_ASSERT(reporter, a.equals("-000429496729612"));
+ a.appendU64(0x7FFFFFFFFFFFFFFFULL, 0);
+ REPORTER_ASSERT(reporter, a.equals("9223372036854775807"));
+ a.set("");
+ a.appendU64(0x8000000000000001ULL, 0);
+ REPORTER_ASSERT(reporter, a.equals("9223372036854775809"));
+ a.set("");
+ a.appendU64(0xFFFFFFFFFFFFFFFFULL, 0);
+ REPORTER_ASSERT(reporter, a.equals("18446744073709551615"));
+ a.set("");
+ a.appendU64(0x0000000001000000ULL, 15);
+ REPORTER_ASSERT(reporter, a.equals("000000016777216"));
static const struct {
SkScalar fValue;
« no previous file with comments | « src/core/SkString.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698