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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 char buffer [40]; | 177 char buffer [40]; |
178 memset(buffer, 'a', 40); | 178 memset(buffer, 'a', 40); |
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 SkString skia_2d("skia_2d"); | |
188 SkString skia2d("skia-2d"); | |
189 skia_2d.replace('_', '-'); | |
190 REPORTER_ASSERT(reporter, skia_2d == skia2d); | |
191 | |
192 SkString meat("meat"); | |
193 SkString meet("meet"); | |
194 meat.replace('a', 'e'); | |
195 REPORTER_ASSERT(reporter, meat == meet); | |
196 | |
197 SkString hangul("\xed\x95\x9c\xea\xb5\xad\xec\x96\xb4"); | |
tfarina
2014/10/18 03:42:27
Mike, could you take another look? Let me know if
| |
198 SkString hangul2("\xb4\x95\x9c\xea\xb5\xad\xec\x96\xb4"); | |
199 hangul.replace('\xed', '\xb4'); | |
200 REPORTER_ASSERT(reporter, hangul == hangul2); | |
187 } | 201 } |
188 | 202 |
189 DEF_TEST(String_SkStrSplit, r) { | 203 DEF_TEST(String_SkStrSplit, r) { |
190 SkTArray<SkString> results; | 204 SkTArray<SkString> results; |
191 | 205 |
192 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); | 206 SkStrSplit("a-_b_c-dee--f-_-_-g-", "-_", &results); |
193 REPORTER_ASSERT(r, results.count() == 6); | 207 REPORTER_ASSERT(r, results.count() == 6); |
194 REPORTER_ASSERT(r, results[0].equals("a")); | 208 REPORTER_ASSERT(r, results[0].equals("a")); |
195 REPORTER_ASSERT(r, results[1].equals("b")); | 209 REPORTER_ASSERT(r, results[1].equals("b")); |
196 REPORTER_ASSERT(r, results[2].equals("c")); | 210 REPORTER_ASSERT(r, results[2].equals("c")); |
197 REPORTER_ASSERT(r, results[3].equals("dee")); | 211 REPORTER_ASSERT(r, results[3].equals("dee")); |
198 REPORTER_ASSERT(r, results[4].equals("f")); | 212 REPORTER_ASSERT(r, results[4].equals("f")); |
199 REPORTER_ASSERT(r, results[5].equals("g")); | 213 REPORTER_ASSERT(r, results[5].equals("g")); |
200 } | 214 } |
OLD | NEW |