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

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

Issue 1411973005: Add format width and precision tests. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 const wchar_t* c_string2 = L"hellp"; 433 const wchar_t* c_string2 = L"hellp";
434 const wchar_t* c_string3 = L"hellod"; 434 const wchar_t* c_string3 = L"hellod";
435 EXPECT_TRUE(wide_string_c != c_string1); 435 EXPECT_TRUE(wide_string_c != c_string1);
436 EXPECT_TRUE(wide_string_c != c_string2); 436 EXPECT_TRUE(wide_string_c != c_string2);
437 EXPECT_TRUE(wide_string_c != c_string3); 437 EXPECT_TRUE(wide_string_c != c_string3);
438 438
439 EXPECT_TRUE(c_string1 != wide_string_c); 439 EXPECT_TRUE(c_string1 != wide_string_c);
440 EXPECT_TRUE(c_string2 != wide_string_c); 440 EXPECT_TRUE(c_string2 != wide_string_c);
441 EXPECT_TRUE(c_string3 != wide_string_c); 441 EXPECT_TRUE(c_string3 != wide_string_c);
442 } 442 }
443
444 TEST(fxcrt, WideStringFormatWidth) {
445 {
446 CFX_WideString str;
447 str.Format(L"%5d", 1);
448 EXPECT_EQ(L" 1", str);
449 }
450
451 {
452 CFX_WideString str;
453 str.Format(L"%d", 1);
454 EXPECT_EQ(L"1", str);
455 }
456 }
457
458 TEST(fxcrt, WideStringFormatPrecision) {
459 {
460 CFX_WideString str;
461 str.Format(L"%.2f", 1.12345);
462 EXPECT_EQ(L"1.12", str);
463 }
464
465 {
466 CFX_WideString str;
467 str.Format(L"%f", 1.12345);
468 EXPECT_EQ(L"1.123450", str);
469 }
470 }
OLDNEW
« core/src/fxcrt/fx_basic_bstring_unittest.cpp ('K') | « 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