| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 REPORTER_ASSERT(reporter, buffer[18] == 'a'); | 179 REPORTER_ASSERT(reporter, buffer[18] == 'a'); |
| 180 REPORTER_ASSERT(reporter, buffer[19] == 'a'); | 180 REPORTER_ASSERT(reporter, buffer[19] == 'a'); |
| 181 REPORTER_ASSERT(reporter, buffer[20] == 'a'); | 181 REPORTER_ASSERT(reporter, buffer[20] == 'a'); |
| 182 printfAnalog(buffer, 20, "%30d", 0); | 182 printfAnalog(buffer, 20, "%30d", 0); |
| 183 REPORTER_ASSERT(reporter, buffer[18] == ' '); | 183 REPORTER_ASSERT(reporter, buffer[18] == ' '); |
| 184 REPORTER_ASSERT(reporter, buffer[19] == 0); | 184 REPORTER_ASSERT(reporter, buffer[19] == 0); |
| 185 REPORTER_ASSERT(reporter, buffer[20] == 'a'); | 185 REPORTER_ASSERT(reporter, buffer[20] == 'a'); |
| 186 | 186 |
| 187 } | 187 } |
| 188 | 188 |
| 189 DEF_TEST(String_ReplaceChar, r) { |
| 190 a.set("hello world"); |
| 191 a.replaceChar('h', 'h'); |
| 192 REPORTER_ASSERT(reporter, a.equals("hello world")); |
| 193 a.replaceChar('x', 'x'); |
| 194 REPORTER_ASSERT(reporter, a.equals("hello world")); |
| 195 a.replaceChar('o', 'e'); |
| 196 REPORTER_ASSERT(reporter, a.equals("helle werld")); |
| 197 a.replaceChar('x', 'e'); |
| 198 REPORTER_ASSERT(reporter, a.equals("helle werld")); |
| 199 a.replaceChar('x', 'z'); |
| 200 REPORTER_ASSERT(reporter, a.equals("helle werld")); |
| 201 a.set(""); |
| 202 a.replaceChar('a', 'b'); |
| 203 REPORTER_ASSERT(reporter, a.equals("")); |
| 204 } |
| 205 |
| 189 DEF_TEST(String_SkStrSplit, r) { | 206 DEF_TEST(String_SkStrSplit, r) { |
| 190 SkTArray<SkString> results; | 207 SkTArray<SkString> results; |
| 191 | 208 |
| 192 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); | 209 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); |
| 193 REPORTER_ASSERT(r, results.count() == 6); | 210 REPORTER_ASSERT(r, results.count() == 6); |
| 194 REPORTER_ASSERT(r, results[0].equals("a")); | 211 REPORTER_ASSERT(r, results[0].equals("a")); |
| 195 REPORTER_ASSERT(r, results[1].equals("b")); | 212 REPORTER_ASSERT(r, results[1].equals("b")); |
| 196 REPORTER_ASSERT(r, results[2].equals("c")); | 213 REPORTER_ASSERT(r, results[2].equals("c")); |
| 197 REPORTER_ASSERT(r, results[3].equals("dee")); | 214 REPORTER_ASSERT(r, results[3].equals("dee")); |
| 198 REPORTER_ASSERT(r, results[4].equals("f")); | 215 REPORTER_ASSERT(r, results[4].equals("f")); |
| 199 REPORTER_ASSERT(r, results[5].equals("g")); | 216 REPORTER_ASSERT(r, results[5].equals("g")); |
| 200 } | 217 } |
| OLD | NEW |