| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "../../../testing/fx_string_testhelpers.h" | 8 #include "../../../testing/fx_string_testhelpers.h" |
| 9 #include "../../include/fxcrt/fx_system.h" | 9 #include "../../include/fxcrt/fx_system.h" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 FXSYS_i64toa(input, buf, 2); | 66 FXSYS_i64toa(input, buf, 2); |
| 67 EXPECT_EQ(std::string(expected_output), buf); | 67 EXPECT_EQ(std::string(expected_output), buf); |
| 68 EXPECT_EQ(kSentinel, buf[kBufLen - 1]); | 68 EXPECT_EQ(kSentinel, buf[kBufLen - 1]); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 TEST(fxcrt, FXSYS_itoa_InvalidRadix) { | 73 TEST(fxcrt, FXSYS_itoa_InvalidRadix) { |
| 74 FX_CHAR buf[32]; | 74 FX_CHAR buf[32]; |
| 75 | 75 |
| 76 FXSYS_itoa(42, buf, 17); | 76 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 77 FXSYS_itoa(42, buf, 17); // Ours stops at 16. |
| 78 #else |
| 79 FXSYS_itoa(42, buf, 37); // Theirs goes up to 36. |
| 80 #endif |
| 77 EXPECT_EQ(std::string(""), buf); | 81 EXPECT_EQ(std::string(""), buf); |
| 78 | 82 |
| 79 FXSYS_itoa(42, buf, 1); | 83 FXSYS_itoa(42, buf, 1); |
| 80 EXPECT_EQ(std::string(""), buf); | 84 EXPECT_EQ(std::string(""), buf); |
| 81 | 85 |
| 82 FXSYS_itoa(42, buf, 0); | 86 FXSYS_itoa(42, buf, 0); |
| 83 EXPECT_EQ(std::string(""), buf); | 87 EXPECT_EQ(std::string(""), buf); |
| 84 | 88 |
| 85 FXSYS_itoa(42, buf, -1); | 89 FXSYS_itoa(42, buf, -1); |
| 86 EXPECT_EQ(std::string(""), buf); | 90 EXPECT_EQ(std::string(""), buf); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 107 Check32BitBase16Itoa(std::numeric_limits<int32_t>::max(), "7fffffff"); | 111 Check32BitBase16Itoa(std::numeric_limits<int32_t>::max(), "7fffffff"); |
| 108 Check32BitBase10Itoa(std::numeric_limits<int32_t>::max(), "2147483647"); | 112 Check32BitBase10Itoa(std::numeric_limits<int32_t>::max(), "2147483647"); |
| 109 Check32BitBase2Itoa(std::numeric_limits<int32_t>::max(), | 113 Check32BitBase2Itoa(std::numeric_limits<int32_t>::max(), |
| 110 "1111111111111111111111111111111"); | 114 "1111111111111111111111111111111"); |
| 111 } | 115 } |
| 112 | 116 |
| 113 | 117 |
| 114 TEST(fxcrt, FXSYS_i64toa_InvalidRadix) { | 118 TEST(fxcrt, FXSYS_i64toa_InvalidRadix) { |
| 115 FX_CHAR buf[32]; | 119 FX_CHAR buf[32]; |
| 116 | 120 |
| 117 FXSYS_i64toa(42, buf, 17); | 121 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 122 FXSYS_i64toa(42, buf, 17); // Ours stops at 16. |
| 123 #else |
| 124 FXSYS_i64toa(42, buf, 37); // Theirs goes up to 36. |
| 125 #endif |
| 118 EXPECT_EQ(std::string(""), buf); | 126 EXPECT_EQ(std::string(""), buf); |
| 119 | 127 |
| 120 FXSYS_i64toa(42, buf, 1); | 128 FXSYS_i64toa(42, buf, 1); |
| 121 EXPECT_EQ(std::string(""), buf); | 129 EXPECT_EQ(std::string(""), buf); |
| 122 | 130 |
| 123 FXSYS_i64toa(42, buf, 0); | 131 FXSYS_i64toa(42, buf, 0); |
| 124 EXPECT_EQ(std::string(""), buf); | 132 EXPECT_EQ(std::string(""), buf); |
| 125 | 133 |
| 126 FXSYS_i64toa(42, buf, -1); | 134 FXSYS_i64toa(42, buf, -1); |
| 127 EXPECT_EQ(std::string(""), buf); | 135 EXPECT_EQ(std::string(""), buf); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 Check64BitBase2Itoa(42, "101010"); | 157 Check64BitBase2Itoa(42, "101010"); |
| 150 | 158 |
| 151 Check64BitBase16Itoa( | 159 Check64BitBase16Itoa( |
| 152 std::numeric_limits<int64_t>::max(), "7fffffffffffffff"); | 160 std::numeric_limits<int64_t>::max(), "7fffffffffffffff"); |
| 153 Check64BitBase10Itoa( | 161 Check64BitBase10Itoa( |
| 154 std::numeric_limits<int64_t>::max(), "9223372036854775807"); | 162 std::numeric_limits<int64_t>::max(), "9223372036854775807"); |
| 155 Check64BitBase2Itoa( | 163 Check64BitBase2Itoa( |
| 156 std::numeric_limits<int64_t>::max(), | 164 std::numeric_limits<int64_t>::max(), |
| 157 "111111111111111111111111111111111111111111111111111111111111111"); | 165 "111111111111111111111111111111111111111111111111111111111111111"); |
| 158 } | 166 } |
| OLD | NEW |