aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-19 18:27:20 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-19 18:27:20 +0000
commitd88a3d83364d2158a6fad9cb295012fac0e07ea3 (patch)
tree5cd1000e2b47c1cf58c790eaa560a51d71f1be57 /tests
parentafe5e9e417b41c3f5a074d590ce23e3de3fd4dbd (diff)
Add SkString::appendU32() and SkString::appendU64()
as needed to re-land r9682 R=reed@google.com Review URL: https://codereview.chromium.org/17448012 git-svn-id: http://skia.googlecode.com/svn/trunk@9686 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/StringTest.cpp49
1 files changed, 41 insertions, 8 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 2c5026c682..3076719040 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -102,20 +102,53 @@ static void TestString(skiatest::Reporter* reporter) {
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;