OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 <math.h> | 5 #include <math.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 std::wstring output; | 1448 std::wstring output; |
1449 EXPECT_EQ(cases[i].result, | 1449 EXPECT_EQ(cases[i].result, |
1450 ElideString(cases[i].input, cases[i].max_len, &output)); | 1450 ElideString(cases[i].input, cases[i].max_len, &output)); |
1451 EXPECT_TRUE(output == cases[i].output); | 1451 EXPECT_TRUE(output == cases[i].output); |
1452 } | 1452 } |
1453 } | 1453 } |
1454 | 1454 |
1455 TEST(StringUtilTest, HexEncode) { | 1455 TEST(StringUtilTest, HexEncode) { |
1456 std::string hex(HexEncode(NULL, 0)); | 1456 std::string hex(HexEncode(NULL, 0)); |
1457 EXPECT_EQ(hex.length(), 0U); | 1457 EXPECT_EQ(hex.length(), 0U); |
1458 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03}; | 1458 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03, 0x80, 0x81}; |
1459 hex = HexEncode(bytes, sizeof(bytes)); | 1459 hex = HexEncode(bytes, sizeof(bytes)); |
1460 EXPECT_EQ(hex.compare("01FF02FE03"), 0); | 1460 EXPECT_EQ(hex.compare("01FF02FE038081"), 0); |
1461 } | 1461 } |
OLD | NEW |