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

Side by Side Diff: core/src/fxcrt/fx_basic_bstring_unittest.cpp

Issue 1141763002: Fix comparison of CFX_ByteString and CFX_WideString against empty literals. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Cover a few more cases. Created 5 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
« no previous file with comments | « core/src/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "../../../testing/fx_string_testhelpers.h" 6 #include "../../../testing/fx_string_testhelpers.h"
7 #include "../../include/fxcrt/fx_basic.h" 7 #include "../../include/fxcrt/fx_basic.h"
8 8
9 TEST(fxcrt, ByteStringOperatorSubscript) { 9 TEST(fxcrt, ByteStringOperatorSubscript) {
10 // CFX_ByteString includes the NUL terminator for non-empty strings. 10 // CFX_ByteString includes the NUL terminator for non-empty strings.
(...skipping 28 matching lines...) Expand all
39 EXPECT_FALSE(abc < a); 39 EXPECT_FALSE(abc < a);
40 40
41 EXPECT_TRUE(a < def); 41 EXPECT_TRUE(a < def);
42 EXPECT_FALSE(def < a); 42 EXPECT_FALSE(def < a);
43 43
44 EXPECT_TRUE(abc < def); 44 EXPECT_TRUE(abc < def);
45 EXPECT_FALSE(def < abc); 45 EXPECT_FALSE(def < abc);
46 } 46 }
47 47
48 TEST(fxcrt, ByteStringOperatorEQ) { 48 TEST(fxcrt, ByteStringOperatorEQ) {
49 CFX_ByteString null_string;
50 EXPECT_TRUE(null_string == null_string);
51
52 CFX_ByteString empty_string("");
53 EXPECT_TRUE(empty_string == empty_string);
54 EXPECT_TRUE(empty_string == null_string);
55 EXPECT_TRUE(null_string == empty_string);
56
57 CFX_ByteString deleted_string("hello");
58 deleted_string.Delete(0, 5);
59 EXPECT_TRUE(deleted_string == deleted_string);
60 EXPECT_TRUE(deleted_string == null_string);
61 EXPECT_TRUE(deleted_string == empty_string);
62 EXPECT_TRUE(null_string == deleted_string);
63 EXPECT_TRUE(empty_string == deleted_string);
64
49 CFX_ByteString byte_string("hello"); 65 CFX_ByteString byte_string("hello");
50 ASSERT_TRUE(byte_string == byte_string); 66 EXPECT_TRUE(byte_string == byte_string);
67 EXPECT_FALSE(byte_string == null_string);
68 EXPECT_FALSE(byte_string == empty_string);
69 EXPECT_FALSE(byte_string == deleted_string);
70 EXPECT_FALSE(null_string == byte_string);
71 EXPECT_FALSE(empty_string == byte_string);
72 EXPECT_FALSE(deleted_string == byte_string);
51 73
52 CFX_ByteString byte_string_same1("hello"); 74 CFX_ByteString byte_string_same1("hello");
53 ASSERT_TRUE(byte_string == byte_string_same1); 75 EXPECT_TRUE(byte_string == byte_string_same1);
54 ASSERT_TRUE(byte_string_same1 == byte_string); 76 EXPECT_TRUE(byte_string_same1 == byte_string);
55 77
56 CFX_ByteString byte_string_same2(byte_string); 78 CFX_ByteString byte_string_same2(byte_string);
57 ASSERT_TRUE(byte_string == byte_string_same2); 79 EXPECT_TRUE(byte_string == byte_string_same2);
58 ASSERT_TRUE(byte_string_same2 == byte_string); 80 EXPECT_TRUE(byte_string_same2 == byte_string);
59 81
60 CFX_ByteString byte_string1("he"); 82 CFX_ByteString byte_string1("he");
61 CFX_ByteString byte_string2("hellp"); 83 CFX_ByteString byte_string2("hellp");
62 CFX_ByteString byte_string3("hellod"); 84 CFX_ByteString byte_string3("hellod");
63 ASSERT_FALSE(byte_string == byte_string1); 85 EXPECT_FALSE(byte_string == byte_string1);
64 ASSERT_FALSE(byte_string == byte_string2); 86 EXPECT_FALSE(byte_string == byte_string2);
65 ASSERT_FALSE(byte_string == byte_string3); 87 EXPECT_FALSE(byte_string == byte_string3);
66 ASSERT_FALSE(byte_string1 == byte_string); 88 EXPECT_FALSE(byte_string1 == byte_string);
67 ASSERT_FALSE(byte_string2 == byte_string); 89 EXPECT_FALSE(byte_string2 == byte_string);
68 ASSERT_FALSE(byte_string3 == byte_string); 90 EXPECT_FALSE(byte_string3 == byte_string);
91
92 CFX_ByteStringC null_string_c;
93 CFX_ByteStringC empty_string_c("");
94 EXPECT_TRUE(null_string == null_string_c);
95 EXPECT_TRUE(null_string == empty_string_c);
96 EXPECT_TRUE(empty_string == null_string_c);
97 EXPECT_TRUE(empty_string == empty_string_c);
98 EXPECT_TRUE(deleted_string == null_string_c);
99 EXPECT_TRUE(deleted_string == empty_string_c);
100 EXPECT_TRUE(null_string_c == null_string);
101 EXPECT_TRUE(empty_string_c == null_string);
102 EXPECT_TRUE(null_string_c == empty_string);
103 EXPECT_TRUE(empty_string_c == empty_string);
104 EXPECT_TRUE(null_string_c == deleted_string);
105 EXPECT_TRUE(empty_string_c == deleted_string);
69 106
70 CFX_ByteStringC byte_string_c_same1("hello"); 107 CFX_ByteStringC byte_string_c_same1("hello");
71 ASSERT_TRUE(byte_string == byte_string_c_same1); 108 EXPECT_TRUE(byte_string == byte_string_c_same1);
72 ASSERT_TRUE(byte_string_c_same1 == byte_string); 109 EXPECT_TRUE(byte_string_c_same1 == byte_string);
73 110
74 CFX_ByteStringC byte_string_c1("he"); 111 CFX_ByteStringC byte_string_c1("he");
75 CFX_ByteStringC byte_string_c2("hellp"); 112 CFX_ByteStringC byte_string_c2("hellp");
76 CFX_ByteStringC byte_string_c3("hellod"); 113 CFX_ByteStringC byte_string_c3("hellod");
77 ASSERT_FALSE(byte_string == byte_string_c1); 114 EXPECT_FALSE(byte_string == byte_string_c1);
78 ASSERT_FALSE(byte_string == byte_string_c2); 115 EXPECT_FALSE(byte_string == byte_string_c2);
79 ASSERT_FALSE(byte_string == byte_string_c3); 116 EXPECT_FALSE(byte_string == byte_string_c3);
80 ASSERT_FALSE(byte_string_c1 == byte_string); 117 EXPECT_FALSE(byte_string_c1 == byte_string);
81 ASSERT_FALSE(byte_string_c2 == byte_string); 118 EXPECT_FALSE(byte_string_c2 == byte_string);
82 ASSERT_FALSE(byte_string_c3 == byte_string); 119 EXPECT_FALSE(byte_string_c3 == byte_string);
120
121 const char* c_null_string = nullptr;
122 const char* c_empty_string = "";
123 EXPECT_TRUE(null_string == c_null_string);
124 EXPECT_TRUE(null_string == c_empty_string);
125 EXPECT_TRUE(empty_string == c_null_string);
126 EXPECT_TRUE(empty_string == c_empty_string);
127 EXPECT_TRUE(deleted_string == c_null_string);
128 EXPECT_TRUE(deleted_string == c_empty_string);
129 EXPECT_TRUE(c_null_string == null_string);
130 EXPECT_TRUE(c_empty_string == null_string);
131 EXPECT_TRUE(c_null_string == empty_string);
132 EXPECT_TRUE(c_empty_string == empty_string);
133 EXPECT_TRUE(c_null_string == deleted_string);
134 EXPECT_TRUE(c_empty_string == deleted_string);
83 135
84 const char* c_string_same1 = "hello"; 136 const char* c_string_same1 = "hello";
85 ASSERT_TRUE(byte_string == c_string_same1); 137 EXPECT_TRUE(byte_string == c_string_same1);
86 ASSERT_TRUE(c_string_same1 == byte_string); 138 EXPECT_TRUE(c_string_same1 == byte_string);
87 139
88 const char* c_string1 = "he"; 140 const char* c_string1 = "he";
89 const char* c_string2 = "hellp"; 141 const char* c_string2 = "hellp";
90 const char* c_string3 = "hellod"; 142 const char* c_string3 = "hellod";
91 ASSERT_FALSE(byte_string == c_string1); 143 EXPECT_FALSE(byte_string == c_string1);
92 ASSERT_FALSE(byte_string == c_string2); 144 EXPECT_FALSE(byte_string == c_string2);
93 ASSERT_FALSE(byte_string == c_string3); 145 EXPECT_FALSE(byte_string == c_string3);
94 ASSERT_FALSE(c_string1 == byte_string); 146 EXPECT_FALSE(c_string1 == byte_string);
95 ASSERT_FALSE(c_string2 == byte_string); 147 EXPECT_FALSE(c_string2 == byte_string);
96 ASSERT_FALSE(c_string3 == byte_string); 148 EXPECT_FALSE(c_string3 == byte_string);
97 } 149 }
98 150
99 TEST(fxcrt, ByteStringOperatorNE) { 151 TEST(fxcrt, ByteStringOperatorNE) {
152 CFX_ByteString null_string;
153 EXPECT_FALSE(null_string != null_string);
154
155 CFX_ByteString empty_string("");
156 EXPECT_FALSE(empty_string != empty_string);
157 EXPECT_FALSE(empty_string != null_string);
158 EXPECT_FALSE(null_string != empty_string);
159
160 CFX_ByteString deleted_string("hello");
161 deleted_string.Delete(0, 5);
162 EXPECT_FALSE(deleted_string != deleted_string);
163 EXPECT_FALSE(deleted_string != null_string);
164 EXPECT_FALSE(deleted_string != empty_string);
165 EXPECT_FALSE(deleted_string != deleted_string);
166 EXPECT_FALSE(null_string != deleted_string);
167 EXPECT_FALSE(empty_string != deleted_string);
168 EXPECT_FALSE(deleted_string != deleted_string);
169
100 CFX_ByteString byte_string("hello"); 170 CFX_ByteString byte_string("hello");
101 ASSERT_FALSE(byte_string != byte_string); 171 EXPECT_FALSE(byte_string != byte_string);
172 EXPECT_TRUE(byte_string != null_string);
173 EXPECT_TRUE(byte_string != empty_string);
174 EXPECT_TRUE(byte_string != deleted_string);
175 EXPECT_TRUE(null_string != byte_string);
176 EXPECT_TRUE(empty_string != byte_string);
177 EXPECT_TRUE(deleted_string != byte_string);
102 178
103 CFX_ByteString byte_string_same1("hello"); 179 CFX_ByteString byte_string_same1("hello");
104 ASSERT_FALSE(byte_string != byte_string_same1); 180 EXPECT_FALSE(byte_string != byte_string_same1);
105 ASSERT_FALSE(byte_string_same1 != byte_string); 181 EXPECT_FALSE(byte_string_same1 != byte_string);
106 182
107 CFX_ByteString byte_string_same2(byte_string); 183 CFX_ByteString byte_string_same2(byte_string);
108 ASSERT_FALSE(byte_string != byte_string_same2); 184 EXPECT_FALSE(byte_string != byte_string_same2);
109 ASSERT_FALSE(byte_string_same2 != byte_string); 185 EXPECT_FALSE(byte_string_same2 != byte_string);
110 186
111 CFX_ByteString byte_string1("he"); 187 CFX_ByteString byte_string1("he");
112 CFX_ByteString byte_string2("hellp"); 188 CFX_ByteString byte_string2("hellp");
113 CFX_ByteString byte_string3("hellod"); 189 CFX_ByteString byte_string3("hellod");
114 ASSERT_TRUE(byte_string != byte_string1); 190 EXPECT_TRUE(byte_string != byte_string1);
115 ASSERT_TRUE(byte_string != byte_string2); 191 EXPECT_TRUE(byte_string != byte_string2);
116 ASSERT_TRUE(byte_string != byte_string3); 192 EXPECT_TRUE(byte_string != byte_string3);
117 ASSERT_TRUE(byte_string1 != byte_string); 193 EXPECT_TRUE(byte_string1 != byte_string);
118 ASSERT_TRUE(byte_string2 != byte_string); 194 EXPECT_TRUE(byte_string2 != byte_string);
119 ASSERT_TRUE(byte_string3 != byte_string); 195 EXPECT_TRUE(byte_string3 != byte_string);
196
197 CFX_ByteStringC null_string_c;
198 CFX_ByteStringC empty_string_c("");
199 EXPECT_FALSE(null_string != null_string_c);
200 EXPECT_FALSE(null_string != empty_string_c);
201 EXPECT_FALSE(empty_string != null_string_c);
202 EXPECT_FALSE(empty_string != empty_string_c);
203 EXPECT_FALSE(null_string_c != null_string);
204 EXPECT_FALSE(empty_string_c != null_string);
205 EXPECT_FALSE(null_string_c != empty_string);
206 EXPECT_FALSE(empty_string_c != empty_string);
120 207
121 CFX_ByteStringC byte_string_c_same1("hello"); 208 CFX_ByteStringC byte_string_c_same1("hello");
122 ASSERT_FALSE(byte_string != byte_string_c_same1); 209 EXPECT_FALSE(byte_string != byte_string_c_same1);
123 ASSERT_FALSE(byte_string_c_same1 != byte_string); 210 EXPECT_FALSE(byte_string_c_same1 != byte_string);
124 211
125 CFX_ByteStringC byte_string_c1("he"); 212 CFX_ByteStringC byte_string_c1("he");
126 CFX_ByteStringC byte_string_c2("hellp"); 213 CFX_ByteStringC byte_string_c2("hellp");
127 CFX_ByteStringC byte_string_c3("hellod"); 214 CFX_ByteStringC byte_string_c3("hellod");
128 ASSERT_TRUE(byte_string != byte_string_c1); 215 EXPECT_TRUE(byte_string != byte_string_c1);
129 ASSERT_TRUE(byte_string != byte_string_c2); 216 EXPECT_TRUE(byte_string != byte_string_c2);
130 ASSERT_TRUE(byte_string != byte_string_c3); 217 EXPECT_TRUE(byte_string != byte_string_c3);
131 ASSERT_TRUE(byte_string_c1 != byte_string); 218 EXPECT_TRUE(byte_string_c1 != byte_string);
132 ASSERT_TRUE(byte_string_c2 != byte_string); 219 EXPECT_TRUE(byte_string_c2 != byte_string);
133 ASSERT_TRUE(byte_string_c3 != byte_string); 220 EXPECT_TRUE(byte_string_c3 != byte_string);
221
222 const char* c_null_string = nullptr;
223 const char* c_empty_string = "";
224 EXPECT_FALSE(null_string != c_null_string);
225 EXPECT_FALSE(null_string != c_empty_string);
226 EXPECT_FALSE(empty_string != c_null_string);
227 EXPECT_FALSE(empty_string != c_empty_string);
228 EXPECT_FALSE(deleted_string != c_null_string);
229 EXPECT_FALSE(deleted_string != c_empty_string);
230 EXPECT_FALSE(c_null_string != null_string);
231 EXPECT_FALSE(c_empty_string != null_string);
232 EXPECT_FALSE(c_null_string != empty_string);
233 EXPECT_FALSE(c_empty_string != empty_string);
234 EXPECT_FALSE(c_null_string != deleted_string);
235 EXPECT_FALSE(c_empty_string != deleted_string);
134 236
135 const char* c_string_same1 = "hello"; 237 const char* c_string_same1 = "hello";
136 ASSERT_FALSE(byte_string != c_string_same1); 238 EXPECT_FALSE(byte_string != c_string_same1);
137 ASSERT_FALSE(c_string_same1 != byte_string); 239 EXPECT_FALSE(c_string_same1 != byte_string);
138 240
139 const char* c_string1 = "he"; 241 const char* c_string1 = "he";
140 const char* c_string2 = "hellp"; 242 const char* c_string2 = "hellp";
141 const char* c_string3 = "hellod"; 243 const char* c_string3 = "hellod";
142 ASSERT_TRUE(byte_string != c_string1); 244 EXPECT_TRUE(byte_string != c_string1);
143 ASSERT_TRUE(byte_string != c_string2); 245 EXPECT_TRUE(byte_string != c_string2);
144 ASSERT_TRUE(byte_string != c_string3); 246 EXPECT_TRUE(byte_string != c_string3);
145 ASSERT_TRUE(c_string1 != byte_string); 247 EXPECT_TRUE(c_string1 != byte_string);
146 ASSERT_TRUE(c_string2 != byte_string); 248 EXPECT_TRUE(c_string2 != byte_string);
147 ASSERT_TRUE(c_string3 != byte_string); 249 EXPECT_TRUE(c_string3 != byte_string);
148 } 250 }
149 251
150 TEST(fxcrt, ByteStringCNull) { 252 TEST(fxcrt, ByteStringCNull) {
151 CFX_ByteStringC null_string; 253 CFX_ByteStringC null_string;
152 EXPECT_EQ(null_string.GetPtr(), nullptr); 254 EXPECT_EQ(null_string.GetPtr(), nullptr);
153 EXPECT_EQ(null_string.GetLength(), 0); 255 EXPECT_EQ(null_string.GetLength(), 0);
154 EXPECT_TRUE(null_string.IsEmpty()); 256 EXPECT_TRUE(null_string.IsEmpty());
155 257
156 CFX_ByteStringC another_null_string; 258 CFX_ByteStringC another_null_string;
157 EXPECT_EQ(null_string, another_null_string); 259 EXPECT_EQ(null_string, another_null_string);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 468
367 EXPECT_TRUE(a < def); 469 EXPECT_TRUE(a < def);
368 EXPECT_FALSE(def < a); 470 EXPECT_FALSE(def < a);
369 471
370 EXPECT_TRUE(abc < def); 472 EXPECT_TRUE(abc < def);
371 EXPECT_FALSE(def < abc); 473 EXPECT_FALSE(def < abc);
372 } 474 }
373 475
374 TEST(fxcrt, ByteStringCOperatorEQ) { 476 TEST(fxcrt, ByteStringCOperatorEQ) {
375 CFX_ByteStringC byte_string_c("hello"); 477 CFX_ByteStringC byte_string_c("hello");
376 ASSERT_TRUE(byte_string_c == byte_string_c); 478 EXPECT_TRUE(byte_string_c == byte_string_c);
377 479
378 CFX_ByteStringC byte_string_c_same1("hello"); 480 CFX_ByteStringC byte_string_c_same1("hello");
379 ASSERT_TRUE(byte_string_c == byte_string_c_same1); 481 EXPECT_TRUE(byte_string_c == byte_string_c_same1);
380 ASSERT_TRUE(byte_string_c_same1 == byte_string_c); 482 EXPECT_TRUE(byte_string_c_same1 == byte_string_c);
381 483
382 CFX_ByteStringC byte_string_c_same2(byte_string_c); 484 CFX_ByteStringC byte_string_c_same2(byte_string_c);
383 ASSERT_TRUE(byte_string_c == byte_string_c_same2); 485 EXPECT_TRUE(byte_string_c == byte_string_c_same2);
384 ASSERT_TRUE(byte_string_c_same2 == byte_string_c); 486 EXPECT_TRUE(byte_string_c_same2 == byte_string_c);
385 487
386 CFX_ByteStringC byte_string_c1("he"); 488 CFX_ByteStringC byte_string_c1("he");
387 CFX_ByteStringC byte_string_c2("hellp"); 489 CFX_ByteStringC byte_string_c2("hellp");
388 CFX_ByteStringC byte_string_c3("hellod"); 490 CFX_ByteStringC byte_string_c3("hellod");
389 ASSERT_FALSE(byte_string_c == byte_string_c1); 491 EXPECT_FALSE(byte_string_c == byte_string_c1);
390 ASSERT_FALSE(byte_string_c == byte_string_c2); 492 EXPECT_FALSE(byte_string_c == byte_string_c2);
391 ASSERT_FALSE(byte_string_c == byte_string_c3); 493 EXPECT_FALSE(byte_string_c == byte_string_c3);
392 ASSERT_FALSE(byte_string_c1 == byte_string_c); 494 EXPECT_FALSE(byte_string_c1 == byte_string_c);
393 ASSERT_FALSE(byte_string_c2 == byte_string_c); 495 EXPECT_FALSE(byte_string_c2 == byte_string_c);
394 ASSERT_FALSE(byte_string_c3 == byte_string_c); 496 EXPECT_FALSE(byte_string_c3 == byte_string_c);
395 497
396 CFX_ByteString byte_string_same1("hello"); 498 CFX_ByteString byte_string_same1("hello");
397 ASSERT_TRUE(byte_string_c == byte_string_same1); 499 EXPECT_TRUE(byte_string_c == byte_string_same1);
398 ASSERT_TRUE(byte_string_same1 == byte_string_c); 500 EXPECT_TRUE(byte_string_same1 == byte_string_c);
399 501
400 CFX_ByteString byte_string1("he"); 502 CFX_ByteString byte_string1("he");
401 CFX_ByteString byte_string2("hellp"); 503 CFX_ByteString byte_string2("hellp");
402 CFX_ByteString byte_string3("hellod"); 504 CFX_ByteString byte_string3("hellod");
403 ASSERT_FALSE(byte_string_c == byte_string1); 505 EXPECT_FALSE(byte_string_c == byte_string1);
404 ASSERT_FALSE(byte_string_c == byte_string2); 506 EXPECT_FALSE(byte_string_c == byte_string2);
405 ASSERT_FALSE(byte_string_c == byte_string3); 507 EXPECT_FALSE(byte_string_c == byte_string3);
406 ASSERT_FALSE(byte_string1 == byte_string_c); 508 EXPECT_FALSE(byte_string1 == byte_string_c);
407 ASSERT_FALSE(byte_string2 == byte_string_c); 509 EXPECT_FALSE(byte_string2 == byte_string_c);
408 ASSERT_FALSE(byte_string3 == byte_string_c); 510 EXPECT_FALSE(byte_string3 == byte_string_c);
409 511
410 const char* c_string_same1 = "hello"; 512 const char* c_string_same1 = "hello";
411 ASSERT_TRUE(byte_string_c == c_string_same1); 513 EXPECT_TRUE(byte_string_c == c_string_same1);
412 ASSERT_TRUE(c_string_same1 == byte_string_c); 514 EXPECT_TRUE(c_string_same1 == byte_string_c);
413 515
414 const char* c_string1 = "he"; 516 const char* c_string1 = "he";
415 const char* c_string2 = "hellp"; 517 const char* c_string2 = "hellp";
416 const char* c_string3 = "hellod"; 518 const char* c_string3 = "hellod";
417 ASSERT_FALSE(byte_string_c == c_string1); 519 EXPECT_FALSE(byte_string_c == c_string1);
418 ASSERT_FALSE(byte_string_c == c_string2); 520 EXPECT_FALSE(byte_string_c == c_string2);
419 ASSERT_FALSE(byte_string_c == c_string3); 521 EXPECT_FALSE(byte_string_c == c_string3);
420 522
421 ASSERT_FALSE(c_string1 == byte_string_c); 523 EXPECT_FALSE(c_string1 == byte_string_c);
422 ASSERT_FALSE(c_string2 == byte_string_c); 524 EXPECT_FALSE(c_string2 == byte_string_c);
423 ASSERT_FALSE(c_string3 == byte_string_c); 525 EXPECT_FALSE(c_string3 == byte_string_c);
424 } 526 }
425 527
426 TEST(fxcrt, ByteStringCOperatorNE) { 528 TEST(fxcrt, ByteStringCOperatorNE) {
427 CFX_ByteStringC byte_string_c("hello"); 529 CFX_ByteStringC byte_string_c("hello");
428 ASSERT_FALSE(byte_string_c != byte_string_c); 530 EXPECT_FALSE(byte_string_c != byte_string_c);
429 531
430 CFX_ByteStringC byte_string_c_same1("hello"); 532 CFX_ByteStringC byte_string_c_same1("hello");
431 ASSERT_FALSE(byte_string_c != byte_string_c_same1); 533 EXPECT_FALSE(byte_string_c != byte_string_c_same1);
432 ASSERT_FALSE(byte_string_c_same1 != byte_string_c); 534 EXPECT_FALSE(byte_string_c_same1 != byte_string_c);
433 535
434 CFX_ByteStringC byte_string_c_same2(byte_string_c); 536 CFX_ByteStringC byte_string_c_same2(byte_string_c);
435 ASSERT_FALSE(byte_string_c != byte_string_c_same2); 537 EXPECT_FALSE(byte_string_c != byte_string_c_same2);
436 ASSERT_FALSE(byte_string_c_same2 != byte_string_c); 538 EXPECT_FALSE(byte_string_c_same2 != byte_string_c);
437 539
438 CFX_ByteStringC byte_string_c1("he"); 540 CFX_ByteStringC byte_string_c1("he");
439 CFX_ByteStringC byte_string_c2("hellp"); 541 CFX_ByteStringC byte_string_c2("hellp");
440 CFX_ByteStringC byte_string_c3("hellod"); 542 CFX_ByteStringC byte_string_c3("hellod");
441 ASSERT_TRUE(byte_string_c != byte_string_c1); 543 EXPECT_TRUE(byte_string_c != byte_string_c1);
442 ASSERT_TRUE(byte_string_c != byte_string_c2); 544 EXPECT_TRUE(byte_string_c != byte_string_c2);
443 ASSERT_TRUE(byte_string_c != byte_string_c3); 545 EXPECT_TRUE(byte_string_c != byte_string_c3);
444 ASSERT_TRUE(byte_string_c1 != byte_string_c); 546 EXPECT_TRUE(byte_string_c1 != byte_string_c);
445 ASSERT_TRUE(byte_string_c2 != byte_string_c); 547 EXPECT_TRUE(byte_string_c2 != byte_string_c);
446 ASSERT_TRUE(byte_string_c3 != byte_string_c); 548 EXPECT_TRUE(byte_string_c3 != byte_string_c);
447 549
448 CFX_ByteString byte_string_same1("hello"); 550 CFX_ByteString byte_string_same1("hello");
449 ASSERT_FALSE(byte_string_c != byte_string_same1); 551 EXPECT_FALSE(byte_string_c != byte_string_same1);
450 ASSERT_FALSE(byte_string_same1 != byte_string_c); 552 EXPECT_FALSE(byte_string_same1 != byte_string_c);
451 553
452 CFX_ByteString byte_string1("he"); 554 CFX_ByteString byte_string1("he");
453 CFX_ByteString byte_string2("hellp"); 555 CFX_ByteString byte_string2("hellp");
454 CFX_ByteString byte_string3("hellod"); 556 CFX_ByteString byte_string3("hellod");
455 ASSERT_TRUE(byte_string_c != byte_string1); 557 EXPECT_TRUE(byte_string_c != byte_string1);
456 ASSERT_TRUE(byte_string_c != byte_string2); 558 EXPECT_TRUE(byte_string_c != byte_string2);
457 ASSERT_TRUE(byte_string_c != byte_string3); 559 EXPECT_TRUE(byte_string_c != byte_string3);
458 ASSERT_TRUE(byte_string1 != byte_string_c); 560 EXPECT_TRUE(byte_string1 != byte_string_c);
459 ASSERT_TRUE(byte_string2 != byte_string_c); 561 EXPECT_TRUE(byte_string2 != byte_string_c);
460 ASSERT_TRUE(byte_string3 != byte_string_c); 562 EXPECT_TRUE(byte_string3 != byte_string_c);
461 563
462 const char* c_string_same1 = "hello"; 564 const char* c_string_same1 = "hello";
463 ASSERT_FALSE(byte_string_c != c_string_same1); 565 EXPECT_FALSE(byte_string_c != c_string_same1);
464 ASSERT_FALSE(c_string_same1 != byte_string_c); 566 EXPECT_FALSE(c_string_same1 != byte_string_c);
465 567
466 const char* c_string1 = "he"; 568 const char* c_string1 = "he";
467 const char* c_string2 = "hellp"; 569 const char* c_string2 = "hellp";
468 const char* c_string3 = "hellod"; 570 const char* c_string3 = "hellod";
469 ASSERT_TRUE(byte_string_c != c_string1); 571 EXPECT_TRUE(byte_string_c != c_string1);
470 ASSERT_TRUE(byte_string_c != c_string2); 572 EXPECT_TRUE(byte_string_c != c_string2);
471 ASSERT_TRUE(byte_string_c != c_string3); 573 EXPECT_TRUE(byte_string_c != c_string3);
472 574
473 ASSERT_TRUE(c_string1 != byte_string_c); 575 EXPECT_TRUE(c_string1 != byte_string_c);
474 ASSERT_TRUE(c_string2 != byte_string_c); 576 EXPECT_TRUE(c_string2 != byte_string_c);
475 ASSERT_TRUE(c_string3 != byte_string_c); 577 EXPECT_TRUE(c_string3 != byte_string_c);
476 } 578 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698