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

Side by Side Diff: core/src/fxcrt/fx_basic_bstring_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
« 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/fx_string_testhelpers.h" 5 #include "../../../testing/fx_string_testhelpers.h"
6 #include "../../include/fxcrt/fx_string.h" 6 #include "../../include/fxcrt/fx_string.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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 const char* c_string2 = "hellp"; 596 const char* c_string2 = "hellp";
597 const char* c_string3 = "hellod"; 597 const char* c_string3 = "hellod";
598 EXPECT_TRUE(byte_string_c != c_string1); 598 EXPECT_TRUE(byte_string_c != c_string1);
599 EXPECT_TRUE(byte_string_c != c_string2); 599 EXPECT_TRUE(byte_string_c != c_string2);
600 EXPECT_TRUE(byte_string_c != c_string3); 600 EXPECT_TRUE(byte_string_c != c_string3);
601 601
602 EXPECT_TRUE(c_string1 != byte_string_c); 602 EXPECT_TRUE(c_string1 != byte_string_c);
603 EXPECT_TRUE(c_string2 != byte_string_c); 603 EXPECT_TRUE(c_string2 != byte_string_c);
604 EXPECT_TRUE(c_string3 != byte_string_c); 604 EXPECT_TRUE(c_string3 != byte_string_c);
605 } 605 }
606
607 TEST(fxcrt, ByteStringFormatWidth) {
608 {
609 CFX_ByteString str;
Tom Sepez 2015/11/03 17:19:49 Do these support the %*d syntax as well? If so, c
dsinclair 2015/11/03 18:50:08 Done.
610 str.Format("%5d", 1);
611 EXPECT_EQ(" 1", str);
612 }
613
614 {
615 CFX_ByteString str;
616 str.Format("%d", 1);
617 EXPECT_EQ("1", str);
618 }
619 }
620
621 TEST(fxcrt, ByteStringFormatPrecision) {
622 {
623 CFX_ByteString str;
624 str.Format("%.2f", 1.12345);
625 EXPECT_EQ("1.12", str);
626 }
627
628 {
629 CFX_ByteString str;
630 str.Format("%f", 1.12345);
631 EXPECT_EQ("1.123450", str);
632 }
633 }
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