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

Side by Side Diff: core/src/fxcrt/fx_basic_bstring_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 | « no previous file | core/src/fxcrt/fx_basic_wstring_unittest.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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 EXPECT_TRUE(a < abc); 370 EXPECT_TRUE(a < abc);
371 EXPECT_FALSE(abc < a); 371 EXPECT_FALSE(abc < a);
372 372
373 EXPECT_TRUE(a < def); 373 EXPECT_TRUE(a < def);
374 EXPECT_FALSE(def < a); 374 EXPECT_FALSE(def < a);
375 375
376 EXPECT_TRUE(abc < def); 376 EXPECT_TRUE(abc < def);
377 EXPECT_FALSE(def < abc); 377 EXPECT_FALSE(def < abc);
378 } 378 }
379
380 TEST(fxcrt, ByteStringCOperatorEQ) {
381 CFX_ByteStringC byte_string_c("hello");
382 ASSERT_TRUE(byte_string_c == byte_string_c);
383
384 CFX_ByteStringC byte_string_c_same1("hello");
385 ASSERT_TRUE(byte_string_c == byte_string_c_same1);
386 ASSERT_TRUE(byte_string_c_same1 == byte_string_c);
387
388 CFX_ByteStringC byte_string_c_same2(byte_string_c);
389 ASSERT_TRUE(byte_string_c == byte_string_c_same2);
390 ASSERT_TRUE(byte_string_c_same2 == byte_string_c);
391
392 CFX_ByteStringC byte_string_c1("he");
393 CFX_ByteStringC byte_string_c2("hellp");
394 CFX_ByteStringC byte_string_c3("hellod");
395 ASSERT_FALSE(byte_string_c == byte_string_c1);
396 ASSERT_FALSE(byte_string_c == byte_string_c2);
397 ASSERT_FALSE(byte_string_c == byte_string_c3);
398 ASSERT_FALSE(byte_string_c1 == byte_string_c);
399 ASSERT_FALSE(byte_string_c2 == byte_string_c);
400 ASSERT_FALSE(byte_string_c3 == byte_string_c);
401
402 CFX_ByteString byte_string_same1("hello");
403 ASSERT_TRUE(byte_string_c == byte_string_same1);
404 ASSERT_TRUE(byte_string_same1 == byte_string_c);
405
406 CFX_ByteString byte_string1("he");
407 CFX_ByteString byte_string2("hellp");
408 CFX_ByteString byte_string3("hellod");
409 ASSERT_FALSE(byte_string_c == byte_string1);
410 ASSERT_FALSE(byte_string_c == byte_string2);
411 ASSERT_FALSE(byte_string_c == byte_string3);
412 ASSERT_FALSE(byte_string1 == byte_string_c);
413 ASSERT_FALSE(byte_string2 == byte_string_c);
414 ASSERT_FALSE(byte_string3 == byte_string_c);
415
416 const char* c_string_same1 = "hello";
417 ASSERT_TRUE(byte_string_c == c_string_same1);
418 #if 0
419 // TODO(tsepez): missing operator (but no implicit cast to c_str).
420 ASSERT_TRUE(c_string_same1 == byte_string_c);
421 #endif
422
423 const char* c_string1 = "he";
424 const char* c_string2 = "hellp";
425 const char* c_string3 = "hellod";
426 ASSERT_FALSE(byte_string_c == c_string1);
427 ASSERT_FALSE(byte_string_c == c_string2);
428 ASSERT_FALSE(byte_string_c == c_string3);
429 #if 0
430 // See above TODO.
431 ASSERT_FALSE(c_string1 == byte_string_c);
432 ASSERT_FALSE(c_string2 == byte_string_c);
433 ASSERT_FALSE(c_string3 == byte_string_c);
434 #endif
435 }
436
437 TEST(fxcrt, ByteStringCOperatorNE) {
438 CFX_ByteStringC byte_string_c("hello");
439 ASSERT_FALSE(byte_string_c != byte_string_c);
440
441 CFX_ByteStringC byte_string_c_same1("hello");
442 ASSERT_FALSE(byte_string_c != byte_string_c_same1);
443 ASSERT_FALSE(byte_string_c_same1 != byte_string_c);
444
445 CFX_ByteStringC byte_string_c_same2(byte_string_c);
446 ASSERT_FALSE(byte_string_c != byte_string_c_same2);
447 ASSERT_FALSE(byte_string_c_same2 != byte_string_c);
448
449 CFX_ByteStringC byte_string_c1("he");
450 CFX_ByteStringC byte_string_c2("hellp");
451 CFX_ByteStringC byte_string_c3("hellod");
452 ASSERT_TRUE(byte_string_c != byte_string_c1);
453 ASSERT_TRUE(byte_string_c != byte_string_c2);
454 ASSERT_TRUE(byte_string_c != byte_string_c3);
455 ASSERT_TRUE(byte_string_c1 != byte_string_c);
456 ASSERT_TRUE(byte_string_c2 != byte_string_c);
457 ASSERT_TRUE(byte_string_c3 != byte_string_c);
458
459 CFX_ByteString byte_string_same1("hello");
460 ASSERT_FALSE(byte_string_c != byte_string_same1);
461 ASSERT_FALSE(byte_string_same1 != byte_string_c);
462
463 CFX_ByteString byte_string1("he");
464 CFX_ByteString byte_string2("hellp");
465 CFX_ByteString byte_string3("hellod");
466 ASSERT_TRUE(byte_string_c != byte_string1);
467 ASSERT_TRUE(byte_string_c != byte_string2);
468 ASSERT_TRUE(byte_string_c != byte_string3);
469 ASSERT_TRUE(byte_string1 != byte_string_c);
470 ASSERT_TRUE(byte_string2 != byte_string_c);
471 ASSERT_TRUE(byte_string3 != byte_string_c);
472
473 const char* c_string_same1 = "hello";
474 ASSERT_FALSE(byte_string_c != c_string_same1);
475 #if 0
476 // TODO(tsepez): missing operator (but no implicit cast to c_str).
477 ASSERT_FALSE(c_string_same1 != byte_string_c);
478 #endif
479
480 const char* c_string1 = "he";
481 const char* c_string2 = "hellp";
482 const char* c_string3 = "hellod";
483 ASSERT_TRUE(byte_string_c != c_string1);
484 ASSERT_TRUE(byte_string_c != c_string2);
485 ASSERT_TRUE(byte_string_c != c_string3);
486 #if 0
487 // See above TODO.
488 ASSERT_TRUE(c_string1 != byte_string_c);
489 ASSERT_TRUE(c_string2 != byte_string_c);
490 ASSERT_TRUE(c_string3 != byte_string_c);
491 #endif
492 }
OLDNEW
« no previous file with comments | « no previous file | core/src/fxcrt/fx_basic_wstring_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698