| 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 "core/fxcrt/include/fx_string.h" | 5 #include "core/fxcrt/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. |
| 11 CFX_ByteString abc("abc"); | 11 CFX_ByteString abc("abc"); |
| 12 EXPECT_EQ('a', abc[0]); | 12 EXPECT_EQ('a', abc[0]); |
| 13 EXPECT_EQ('b', abc[1]); | 13 EXPECT_EQ('b', abc[1]); |
| 14 EXPECT_EQ('c', abc[2]); | 14 EXPECT_EQ('c', abc[2]); |
| 15 EXPECT_EQ(0, abc[3]); | 15 EXPECT_EQ(0, abc[3]); |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 } | 1091 } |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 TEST(fxcrt, EmptyByteString) { | 1094 TEST(fxcrt, EmptyByteString) { |
| 1095 CFX_ByteString empty_str; | 1095 CFX_ByteString empty_str; |
| 1096 EXPECT_TRUE(empty_str.IsEmpty()); | 1096 EXPECT_TRUE(empty_str.IsEmpty()); |
| 1097 EXPECT_EQ(0, empty_str.GetLength()); | 1097 EXPECT_EQ(0, empty_str.GetLength()); |
| 1098 const FX_CHAR* cstr = empty_str.c_str(); | 1098 const FX_CHAR* cstr = empty_str.c_str(); |
| 1099 EXPECT_EQ(0, FXSYS_strlen(cstr)); | 1099 EXPECT_EQ(0, FXSYS_strlen(cstr)); |
| 1100 } | 1100 } |
| OLD | NEW |