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

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

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 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/fxcrt/fx_basic_bstring.cpp ('k') | core/fxcrt/fx_basic_buffer.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 "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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 EXPECT_TRUE(byte_string != c_string1); 244 EXPECT_TRUE(byte_string != c_string1);
245 EXPECT_TRUE(byte_string != c_string2); 245 EXPECT_TRUE(byte_string != c_string2);
246 EXPECT_TRUE(byte_string != c_string3); 246 EXPECT_TRUE(byte_string != c_string3);
247 EXPECT_TRUE(c_string1 != byte_string); 247 EXPECT_TRUE(c_string1 != byte_string);
248 EXPECT_TRUE(c_string2 != byte_string); 248 EXPECT_TRUE(c_string2 != byte_string);
249 EXPECT_TRUE(c_string3 != byte_string); 249 EXPECT_TRUE(c_string3 != byte_string);
250 } 250 }
251 251
252 TEST(fxcrt, ByteStringCNull) { 252 TEST(fxcrt, ByteStringCNull) {
253 CFX_ByteStringC null_string; 253 CFX_ByteStringC null_string;
254 EXPECT_EQ(null_string.GetPtr(), nullptr); 254 EXPECT_EQ(null_string.raw_str(), nullptr);
255 EXPECT_EQ(null_string.GetLength(), 0); 255 EXPECT_EQ(null_string.GetLength(), 0);
256 EXPECT_TRUE(null_string.IsEmpty()); 256 EXPECT_TRUE(null_string.IsEmpty());
257 257
258 CFX_ByteStringC another_null_string; 258 CFX_ByteStringC another_null_string;
259 EXPECT_EQ(null_string, another_null_string); 259 EXPECT_EQ(null_string, another_null_string);
260 260
261 CFX_ByteStringC copied_null_string(null_string); 261 CFX_ByteStringC copied_null_string(null_string);
262 EXPECT_EQ(copied_null_string.GetPtr(), nullptr); 262 EXPECT_EQ(copied_null_string.raw_str(), nullptr);
263 EXPECT_EQ(copied_null_string.GetLength(), 0); 263 EXPECT_EQ(copied_null_string.GetLength(), 0);
264 EXPECT_TRUE(copied_null_string.IsEmpty()); 264 EXPECT_TRUE(copied_null_string.IsEmpty());
265 EXPECT_EQ(null_string, copied_null_string); 265 EXPECT_EQ(null_string, copied_null_string);
266 266
267 CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer. 267 CFX_ByteStringC empty_string(""); // Pointer to NUL, not NULL pointer.
268 EXPECT_NE(empty_string.GetPtr(), nullptr); 268 EXPECT_NE(empty_string.raw_str(), nullptr);
269 EXPECT_EQ(empty_string.GetLength(), 0); 269 EXPECT_EQ(empty_string.GetLength(), 0);
270 EXPECT_TRUE(empty_string.IsEmpty()); 270 EXPECT_TRUE(empty_string.IsEmpty());
271 EXPECT_EQ(null_string, empty_string); 271 EXPECT_EQ(null_string, empty_string);
272 272
273 CFX_ByteStringC assigned_null_string("initially not NULL"); 273 CFX_ByteStringC assigned_null_string("initially not NULL");
274 assigned_null_string = null_string; 274 assigned_null_string = null_string;
275 EXPECT_EQ(assigned_null_string.GetPtr(), nullptr); 275 EXPECT_EQ(assigned_null_string.raw_str(), nullptr);
276 EXPECT_EQ(assigned_null_string.GetLength(), 0); 276 EXPECT_EQ(assigned_null_string.GetLength(), 0);
277 EXPECT_TRUE(assigned_null_string.IsEmpty()); 277 EXPECT_TRUE(assigned_null_string.IsEmpty());
278 EXPECT_EQ(null_string, assigned_null_string); 278 EXPECT_EQ(null_string, assigned_null_string);
279 279
280 CFX_ByteStringC assigned_nullptr_string("initially not NULL"); 280 CFX_ByteStringC assigned_nullptr_string("initially not NULL");
281 assigned_nullptr_string = (const FX_CHAR*)nullptr; 281 assigned_nullptr_string = (const FX_CHAR*)nullptr;
282 EXPECT_EQ(assigned_nullptr_string.GetPtr(), nullptr); 282 EXPECT_EQ(assigned_nullptr_string.raw_str(), nullptr);
283 EXPECT_EQ(assigned_nullptr_string.GetLength(), 0); 283 EXPECT_EQ(assigned_nullptr_string.GetLength(), 0);
284 EXPECT_TRUE(assigned_nullptr_string.IsEmpty()); 284 EXPECT_TRUE(assigned_nullptr_string.IsEmpty());
285 EXPECT_EQ(null_string, assigned_nullptr_string); 285 EXPECT_EQ(null_string, assigned_nullptr_string);
286 286
287 CFX_ByteStringC non_null_string("a"); 287 CFX_ByteStringC non_null_string("a");
288 EXPECT_NE(null_string, non_null_string); 288 EXPECT_NE(null_string, non_null_string);
289 } 289 }
290 290
291 TEST(fxcrt, ByteStringConcat) { 291 TEST(fxcrt, ByteStringConcat) {
292 CFX_ByteString fred; 292 CFX_ByteString fred;
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } 898 }
899 } 899 }
900 900
901 TEST(fxcrt, EmptyByteString) { 901 TEST(fxcrt, EmptyByteString) {
902 CFX_ByteString empty_str; 902 CFX_ByteString empty_str;
903 EXPECT_TRUE(empty_str.IsEmpty()); 903 EXPECT_TRUE(empty_str.IsEmpty());
904 EXPECT_EQ(0, empty_str.GetLength()); 904 EXPECT_EQ(0, empty_str.GetLength());
905 const FX_CHAR* cstr = empty_str.c_str(); 905 const FX_CHAR* cstr = empty_str.c_str();
906 EXPECT_EQ(0, FXSYS_strlen(cstr)); 906 EXPECT_EQ(0, FXSYS_strlen(cstr));
907 } 907 }
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_bstring.cpp ('k') | core/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698