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

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

Issue 2031653003: Get rid of NULLs in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_core
Patch Set: rebase Created 4 years, 6 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/fxcodec/codec/fx_codec_jpx_unittest.cpp ('k') | core/fxcrt/include/fx_memory.h » ('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 "core/fxcrt/include/fx_string.h" 5 #include "core/fxcrt/include/fx_string.h"
6 #include "testing/fx_string_testhelpers.h" 6 #include "testing/fx_string_testhelpers.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 TEST(fxcrt, ByteStringCFromChar) { 751 TEST(fxcrt, ByteStringCFromChar) {
752 CFX_ByteStringC null_string; 752 CFX_ByteStringC null_string;
753 CFX_ByteStringC lower_a_string("a"); 753 CFX_ByteStringC lower_a_string("a");
754 754
755 // Must have lvalues that outlive the corresponding ByteStringC. 755 // Must have lvalues that outlive the corresponding ByteStringC.
756 char nul = '\0'; 756 char nul = '\0';
757 char lower_a = 'a'; 757 char lower_a = 'a';
758 CFX_ByteStringC nul_string_from_char(nul); 758 CFX_ByteStringC nul_string_from_char(nul);
759 CFX_ByteStringC lower_a_string_from_char(lower_a); 759 CFX_ByteStringC lower_a_string_from_char(lower_a);
760 760
761 // Pointer to nul, not NULL ptr, hence length 1 ... 761 // Pointer to nul, not nullptr ptr, hence length 1 ...
762 EXPECT_EQ(1, nul_string_from_char.GetLength()); 762 EXPECT_EQ(1, nul_string_from_char.GetLength());
763 EXPECT_NE(null_string, nul_string_from_char); 763 EXPECT_NE(null_string, nul_string_from_char);
764 764
765 EXPECT_EQ(1, lower_a_string_from_char.GetLength()); 765 EXPECT_EQ(1, lower_a_string_from_char.GetLength());
766 EXPECT_EQ(lower_a_string, lower_a_string_from_char); 766 EXPECT_EQ(lower_a_string, lower_a_string_from_char);
767 EXPECT_NE(nul_string_from_char, lower_a_string_from_char); 767 EXPECT_NE(nul_string_from_char, lower_a_string_from_char);
768 768
769 CFX_ByteStringC longer_string("ab"); 769 CFX_ByteStringC longer_string("ab");
770 EXPECT_NE(longer_string, lower_a_string_from_char); 770 EXPECT_NE(longer_string, lower_a_string_from_char);
771 } 771 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1091 }
1092 } 1092 }
1093 1093
1094 TEST(fxcrt, EmptyByteString) { 1094 TEST(fxcrt, EmptyByteString) {
1095 CFX_ByteString empty_str; 1095 CFX_ByteString empty_str;
1096 EXPECT_TRUE(empty_str.IsEmpty()); 1096 EXPECT_TRUE(empty_str.IsEmpty());
1097 EXPECT_EQ(0, empty_str.GetLength()); 1097 EXPECT_EQ(0, empty_str.GetLength());
1098 const FX_CHAR* cstr = empty_str.c_str(); 1098 const FX_CHAR* cstr = empty_str.c_str();
1099 EXPECT_EQ(0, FXSYS_strlen(cstr)); 1099 EXPECT_EQ(0, FXSYS_strlen(cstr));
1100 } 1100 }
OLDNEW
« no previous file with comments | « core/fxcodec/codec/fx_codec_jpx_unittest.cpp ('k') | core/fxcrt/include/fx_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698