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

Side by Side Diff: tests/StringTest.cpp

Issue 14813013: add SkString::append(const char c) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkString.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkString.h" 9 #include "SkString.h"
10 #include <stdarg.h> 10 #include <stdarg.h>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 REPORTER_ASSERT(reporter, a != b && a != c && b == c); 86 REPORTER_ASSERT(reporter, a != b && a != c && b == c);
87 87
88 a.append(" world"); 88 a.append(" world");
89 e.append("worldz", 5); 89 e.append("worldz", 5);
90 e.insert(5, " "); 90 e.insert(5, " ");
91 f.set("world"); 91 f.set("world");
92 f.prepend("hello "); 92 f.prepend("hello ");
93 REPORTER_ASSERT(reporter, a.equals("hello world") && a == e && a == f); 93 REPORTER_ASSERT(reporter, a.equals("hello world") && a == e && a == f);
94 94
95 a.reset(); 95 a.reset();
96 a.append(SkString("string"));
97 a.append("text");
98 a.append('c');
99 REPORTER_ASSERT(reporter, a.equals("stringtextc"));
100
101 a.reset();
102 a += 'c';
103 a += "text";
104 a += SkString("string");
105 REPORTER_ASSERT(reporter, a.equals("ctextstring"));
106
107 a.reset();
96 b.resize(0); 108 b.resize(0);
97 REPORTER_ASSERT(reporter, a.isEmpty() && b.isEmpty() && a == b); 109 REPORTER_ASSERT(reporter, a.isEmpty() && b.isEmpty() && a == b);
98 110
99 a.set("a"); 111 a.set("a");
100 a.set("ab"); 112 a.set("ab");
101 a.set("abc"); 113 a.set("abc");
102 a.set("abcd"); 114 a.set("abcd");
103 115
104 a.set(""); 116 a.set("");
105 a.appendS64(72036854775808LL, 0); 117 a.appendS64(72036854775808LL, 0);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 REPORTER_ASSERT(reporter, buffer[20] == 'a'); 164 REPORTER_ASSERT(reporter, buffer[20] == 'a');
153 printfAnalog(buffer, 20, "%30d", 0); 165 printfAnalog(buffer, 20, "%30d", 0);
154 REPORTER_ASSERT(reporter, buffer[18] == ' '); 166 REPORTER_ASSERT(reporter, buffer[18] == ' ');
155 REPORTER_ASSERT(reporter, buffer[19] == 0); 167 REPORTER_ASSERT(reporter, buffer[19] == 0);
156 REPORTER_ASSERT(reporter, buffer[20] == 'a'); 168 REPORTER_ASSERT(reporter, buffer[20] == 'a');
157 169
158 } 170 }
159 171
160 #include "TestClassDef.h" 172 #include "TestClassDef.h"
161 DEFINE_TESTCLASS("String", StringTestClass, TestString) 173 DEFINE_TESTCLASS("String", StringTestClass, TestString)
OLDNEW
« no previous file with comments | « include/core/SkString.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698