| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include "SkString.h" | 10 #include "SkString.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } while (0) | 29 } while (0) |
| 30 | 30 |
| 31 static void printfAnalog(char* buffer, int size, const char format[], ...) { | 31 static void printfAnalog(char* buffer, int size, const char format[], ...) { |
| 32 ARGS_TO_BUFFER(format, buffer, size); | 32 ARGS_TO_BUFFER(format, buffer, size); |
| 33 } | 33 } |
| 34 | 34 |
| 35 DEF_TEST(String, reporter) { | 35 DEF_TEST(String, reporter) { |
| 36 SkString a; | 36 SkString a; |
| 37 SkString b((size_t)0); | 37 SkString b((size_t)0); |
| 38 SkString c(""); | 38 SkString c(""); |
| 39 SkString d(NULL, 0); | 39 SkString d(nullptr, 0); |
| 40 | 40 |
| 41 REPORTER_ASSERT(reporter, a.isEmpty()); | 41 REPORTER_ASSERT(reporter, a.isEmpty()); |
| 42 REPORTER_ASSERT(reporter, a == b && a == c && a == d); | 42 REPORTER_ASSERT(reporter, a == b && a == c && a == d); |
| 43 | 43 |
| 44 a.set("hello"); | 44 a.set("hello"); |
| 45 b.set("hellox", 5); | 45 b.set("hellox", 5); |
| 46 c.set(a); | 46 c.set(a); |
| 47 d.resize(5); | 47 d.resize(5); |
| 48 memcpy(d.writable_str(), "helloz", 5); | 48 memcpy(d.writable_str(), "helloz", 5); |
| 49 | 49 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); | 193 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); |
| 194 REPORTER_ASSERT(r, results.count() == 6); | 194 REPORTER_ASSERT(r, results.count() == 6); |
| 195 REPORTER_ASSERT(r, results[0].equals("a")); | 195 REPORTER_ASSERT(r, results[0].equals("a")); |
| 196 REPORTER_ASSERT(r, results[1].equals("b")); | 196 REPORTER_ASSERT(r, results[1].equals("b")); |
| 197 REPORTER_ASSERT(r, results[2].equals("c")); | 197 REPORTER_ASSERT(r, results[2].equals("c")); |
| 198 REPORTER_ASSERT(r, results[3].equals("dee")); | 198 REPORTER_ASSERT(r, results[3].equals("dee")); |
| 199 REPORTER_ASSERT(r, results[4].equals("f")); | 199 REPORTER_ASSERT(r, results[4].equals("f")); |
| 200 REPORTER_ASSERT(r, results[5].equals("g")); | 200 REPORTER_ASSERT(r, results[5].equals("g")); |
| 201 } | 201 } |
| OLD | NEW |