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

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

Issue 1528743002: Fix failures after removing FX_BSTRC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years 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_wstring.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 "core/include/fxcrt/fx_basic.h" 5 #include "core/include/fxcrt/fx_basic.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, 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 CFX_WideString not_aliased(L"xxxxxx"); 274 CFX_WideString not_aliased(L"xxxxxx");
275 EXPECT_EQ(L"FREDDY", fred); 275 EXPECT_EQ(L"FREDDY", fred);
276 EXPECT_EQ(L"xxxxxx", not_aliased); 276 EXPECT_EQ(L"xxxxxx", not_aliased);
277 } 277 }
278 278
279 TEST(fxcrt, WideStringUTF16LE_Encode) { 279 TEST(fxcrt, WideStringUTF16LE_Encode) {
280 struct UTF16LEEncodeCase { 280 struct UTF16LEEncodeCase {
281 CFX_WideString ws; 281 CFX_WideString ws;
282 CFX_ByteString bs; 282 CFX_ByteString bs;
283 } utf16le_encode_cases[] = { 283 } utf16le_encode_cases[] = {
284 {L"", CFX_ByteString("\0\0")}, 284 {L"", CFX_ByteString("\0\0", 2)},
285 {L"abc", CFX_ByteString("a\0b\0c\0\0\0")}, 285 {L"abc", CFX_ByteString("a\0b\0c\0\0\0", 8)},
286 {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0")}, 286 {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0", 14)},
287 {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0")}, 287 {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0", 8)},
288 {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0")}, 288 {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0", 6)},
289 {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0")}, 289 {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0", 6)},
290 }; 290 };
291 291
292 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) { 292 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
293 EXPECT_EQ(utf16le_encode_cases[i].bs, 293 EXPECT_EQ(utf16le_encode_cases[i].bs,
294 utf16le_encode_cases[i].ws.UTF16LE_Encode()) 294 utf16le_encode_cases[i].ws.UTF16LE_Encode())
295 << " for case number " << i; 295 << " for case number " << i;
296 } 296 }
297 } 297 }
298 298
299 TEST(fxcrt, WideStringCOperatorSubscript) { 299 TEST(fxcrt, WideStringCOperatorSubscript) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 515 }
516 } 516 }
517 517
518 TEST(fxcrt, EmptyWideString) { 518 TEST(fxcrt, EmptyWideString) {
519 CFX_WideString empty_str; 519 CFX_WideString empty_str;
520 EXPECT_TRUE(empty_str.IsEmpty()); 520 EXPECT_TRUE(empty_str.IsEmpty());
521 EXPECT_EQ(0, empty_str.GetLength()); 521 EXPECT_EQ(0, empty_str.GetLength());
522 const FX_WCHAR* cstr = empty_str.c_str(); 522 const FX_WCHAR* cstr = empty_str.c_str();
523 EXPECT_EQ(0, FXSYS_wcslen(cstr)); 523 EXPECT_EQ(0, FXSYS_wcslen(cstr));
524 } 524 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698