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

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

Issue 1118973005: Backfill some FX StringC unit tests for == and !=. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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_unittest.cpp ('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 // 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, WideStringOperatorSubscript) { 9 TEST(fxcrt, WideStringOperatorSubscript) {
10 // CFX_WideString includes the NUL terminator for non-empty strings. 10 // CFX_WideString includes the NUL terminator for non-empty strings.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EXPECT_TRUE(a < abc); 213 EXPECT_TRUE(a < abc);
214 EXPECT_FALSE(abc < a); 214 EXPECT_FALSE(abc < a);
215 215
216 EXPECT_TRUE(a < def); 216 EXPECT_TRUE(a < def);
217 EXPECT_FALSE(def < a); 217 EXPECT_FALSE(def < a);
218 218
219 EXPECT_TRUE(abc < def); 219 EXPECT_TRUE(abc < def);
220 EXPECT_FALSE(def < abc); 220 EXPECT_FALSE(def < abc);
221 } 221 }
222 222
223 TEST(fxcrt, WideStringCOperatorEQ) {
224 CFX_WideStringC wide_string_c(L"hello");
225 ASSERT_TRUE(wide_string_c == wide_string_c);
226
227 CFX_WideStringC wide_string_c_same1(L"hello");
228 ASSERT_TRUE(wide_string_c == wide_string_c_same1);
229 ASSERT_TRUE(wide_string_c_same1 == wide_string_c);
230
231 CFX_WideStringC wide_string_c_same2(wide_string_c);
232 ASSERT_TRUE(wide_string_c == wide_string_c_same2);
233 ASSERT_TRUE(wide_string_c_same2 == wide_string_c);
234
235 CFX_WideStringC wide_string_c1(L"he");
236 CFX_WideStringC wide_string_c2(L"hellp");
237 CFX_WideStringC wide_string_c3(L"hellod");
238 ASSERT_FALSE(wide_string_c == wide_string_c1);
239 ASSERT_FALSE(wide_string_c == wide_string_c2);
240 ASSERT_FALSE(wide_string_c == wide_string_c3);
241 ASSERT_FALSE(wide_string_c1 == wide_string_c);
242 ASSERT_FALSE(wide_string_c2 == wide_string_c);
243 ASSERT_FALSE(wide_string_c3 == wide_string_c);
244
245 CFX_WideString wide_string_same1(L"hello");
246 ASSERT_TRUE(wide_string_c == wide_string_same1);
247 ASSERT_TRUE(wide_string_same1 == wide_string_c);
248
249 CFX_WideString wide_string1(L"he");
250 CFX_WideString wide_string2(L"hellp");
251 CFX_WideString wide_string3(L"hellod");
252 ASSERT_FALSE(wide_string_c == wide_string1);
253 ASSERT_FALSE(wide_string_c == wide_string2);
254 ASSERT_FALSE(wide_string_c == wide_string3);
255 ASSERT_FALSE(wide_string1 == wide_string_c);
256 ASSERT_FALSE(wide_string2 == wide_string_c);
257 ASSERT_FALSE(wide_string3 == wide_string_c);
258
259 #if 0
260 // TODO(tsepez): ambiguos overload prevents compilation
261 const wchar_t* c_string_same1 = L"hello";
262 ASSERT_TRUE(wide_string_c == c_string_same1);
263 ASSERT_TRUE(c_string_same1 == wide_string_c);
264
265 const wchar_t* c_string1 = L"he";
266 const wchar_t* c_string2 = L"hellp";
267 const wchar_t* c_string3 = L"hellod";
268 ASSERT_FALSE(wide_string_c == c_string1);
269 ASSERT_FALSE(wide_string_c == c_string2);
270 ASSERT_FALSE(wide_string_c == c_string3);
271
272 ASSERT_FALSE(c_string1 == wide_string_c);
273 ASSERT_FALSE(c_string2 == wide_string_c);
274 ASSERT_FALSE(c_string3 == wide_string_c);
275 #endif
276 }
277
278 TEST(fxcrt, WideStringCOperatorNE) {
279 CFX_WideStringC wide_string_c(L"hello");
280 ASSERT_FALSE(wide_string_c != wide_string_c);
281
282 CFX_WideStringC wide_string_c_same1(L"hello");
283 ASSERT_FALSE(wide_string_c != wide_string_c_same1);
284 ASSERT_FALSE(wide_string_c_same1 != wide_string_c);
285
286 CFX_WideStringC wide_string_c_same2(wide_string_c);
287 ASSERT_FALSE(wide_string_c != wide_string_c_same2);
288 ASSERT_FALSE(wide_string_c_same2 != wide_string_c);
289
290 CFX_WideStringC wide_string_c1(L"he");
291 CFX_WideStringC wide_string_c2(L"hellp");
292 CFX_WideStringC wide_string_c3(L"hellod");
293 ASSERT_TRUE(wide_string_c != wide_string_c1);
294 ASSERT_TRUE(wide_string_c != wide_string_c2);
295 ASSERT_TRUE(wide_string_c != wide_string_c3);
296 ASSERT_TRUE(wide_string_c1 != wide_string_c);
297 ASSERT_TRUE(wide_string_c2 != wide_string_c);
298 ASSERT_TRUE(wide_string_c3 != wide_string_c);
299
300 CFX_WideString wide_string_same1(L"hello");
301 ASSERT_FALSE(wide_string_c != wide_string_same1);
302 ASSERT_FALSE(wide_string_same1 != wide_string_c);
303
304 CFX_WideString wide_string1(L"he");
305 CFX_WideString wide_string2(L"hellp");
306 CFX_WideString wide_string3(L"hellod");
307 ASSERT_TRUE(wide_string_c != wide_string1);
308 ASSERT_TRUE(wide_string_c != wide_string2);
309 ASSERT_TRUE(wide_string_c != wide_string3);
310 ASSERT_TRUE(wide_string1 != wide_string_c);
311 ASSERT_TRUE(wide_string2 != wide_string_c);
312 ASSERT_TRUE(wide_string3 != wide_string_c);
313
314 #if 0
315 // See above TODO.
316 const wchar_t* c_string_same1 = L"hello";
317 ASSERT_FALSE(wide_string_c != c_string_same1);
318 ASSERT_FALSE(c_string_same1 != wide_string_c);
319
320 const wchar_t* c_string1 = L"he";
321 const wchar_t* c_string2 = L"hellp";
322 const wchar_t* c_string3 = L"hellod";
323 ASSERT_TRUE(wide_string_c != c_string1);
324 ASSERT_TRUE(wide_string_c != c_string2);
325 ASSERT_TRUE(wide_string_c != c_string3);
326
327 ASSERT_TRUE(c_string1 != wide_string_c);
328 ASSERT_TRUE(c_string2 != wide_string_c);
329 ASSERT_TRUE(c_string3 != wide_string_c);
330 #endif
331 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_bstring_unittest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698