Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } | |
| OLD | NEW |