| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 | 10 |
| 11 #include <cmath> | 11 #include <cmath> |
| 12 #include <limits> | 12 #include <limits> |
| 13 | 13 |
| 14 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/googletest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 template <typename INT> | 23 template <typename INT> |
| 24 struct IntToStringTest { | 24 struct IntToStringTest { |
| 25 INT num; | 25 INT num; |
| 26 const char* sexpected; | 26 const char* sexpected; |
| 27 const char* uexpected; | 27 const char* uexpected; |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 | 787 |
| 788 TEST(StringNumberConversionsTest, HexEncode) { | 788 TEST(StringNumberConversionsTest, HexEncode) { |
| 789 std::string hex(HexEncode(NULL, 0)); | 789 std::string hex(HexEncode(NULL, 0)); |
| 790 EXPECT_EQ(hex.length(), 0U); | 790 EXPECT_EQ(hex.length(), 0U); |
| 791 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03, 0x80, 0x81}; | 791 unsigned char bytes[] = {0x01, 0xff, 0x02, 0xfe, 0x03, 0x80, 0x81}; |
| 792 hex = HexEncode(bytes, sizeof(bytes)); | 792 hex = HexEncode(bytes, sizeof(bytes)); |
| 793 EXPECT_EQ(hex.compare("01FF02FE038081"), 0); | 793 EXPECT_EQ(hex.compare("01FF02FE038081"), 0); |
| 794 } | 794 } |
| 795 | 795 |
| 796 } // namespace base | 796 } // namespace base |
| OLD | NEW |