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

Unified Diff: tests/StringTest.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: Created 5 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 | « tests/GrContextFactoryTest.cpp ('k') | tests/TestConfigParsing.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/StringTest.cpp
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index f621dc96aff6c56f080351623b50b02bed1f08ca..9e41c48c845d689c740d1544c731a1652750f44c 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -201,9 +201,62 @@ DEF_TEST(String_SkStrSplit, r) {
results.reset();
SkStrSplit("\n", "\n", &results);
- REPORTER_ASSERT(r, results.count() == 1);
+ REPORTER_ASSERT(r, results.count() == 0);
results.reset();
SkStrSplit("", "\n", &results);
REPORTER_ASSERT(r, results.count() == 0);
+
+ results.reset();
+ SkStrSplit("a", "\n", &results);
+ REPORTER_ASSERT(r, results.count() == 1);
+ REPORTER_ASSERT(r, results[0].equals("a"));
+}
+DEF_TEST(String_SkStrSplit_All, r) {
+ SkTArray<SkString> results;
+ SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 13);
+ REPORTER_ASSERT(r, results[0].equals("a"));
+ REPORTER_ASSERT(r, results[1].equals(""));
+ REPORTER_ASSERT(r, results[2].equals("b"));
+ REPORTER_ASSERT(r, results[3].equals("c"));
+ REPORTER_ASSERT(r, results[4].equals("dee"));
+ REPORTER_ASSERT(r, results[5].equals(""));
+ REPORTER_ASSERT(r, results[6].equals("f"));
+ REPORTER_ASSERT(r, results[7].equals(""));
+ REPORTER_ASSERT(r, results[8].equals(""));
+ REPORTER_ASSERT(r, results[9].equals(""));
+ REPORTER_ASSERT(r, results[10].equals(""));
+ REPORTER_ASSERT(r, results[11].equals("g"));
+ REPORTER_ASSERT(r, results[12].equals(""));
+
+ results.reset();
+ SkStrSplit("\n", "\n", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 2);
+ REPORTER_ASSERT(r, results[0].equals(""));
+ REPORTER_ASSERT(r, results[1].equals(""));
+
+ results.reset();
+ SkStrSplit("", "\n", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 0);
+
+ results.reset();
+ SkStrSplit("a", "\n", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 1);
+ REPORTER_ASSERT(r, results[0].equals("a"));
+
+ results.reset();
+ SkStrSplit(",,", ",", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 3);
+ REPORTER_ASSERT(r, results[0].equals(""));
+ REPORTER_ASSERT(r, results[1].equals(""));
+ REPORTER_ASSERT(r, results[2].equals(""));
+
+ results.reset();
+ SkStrSplit(",a,b,", ",", kStrict_SkStrSplitMode, &results);
+ REPORTER_ASSERT(r, results.count() == 4);
+ REPORTER_ASSERT(r, results[0].equals(""));
+ REPORTER_ASSERT(r, results[1].equals("a"));
+ REPORTER_ASSERT(r, results[2].equals("b"));
+ REPORTER_ASSERT(r, results[3].equals(""));
}
« no previous file with comments | « tests/GrContextFactoryTest.cpp ('k') | tests/TestConfigParsing.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698