| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_system.h" | 5 #include "core/fxcrt/fx_system.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 TEST(fxcrt, FXSYS_atoi) { | 8 TEST(fxcrt, FXSYS_atoi) { |
| 9 EXPECT_EQ(0, FXSYS_atoi("")); | 9 EXPECT_EQ(0, FXSYS_atoi("")); |
| 10 EXPECT_EQ(0, FXSYS_atoi("0")); | 10 EXPECT_EQ(0, FXSYS_atoi("0")); |
| 11 EXPECT_EQ(-1, FXSYS_atoi("-1")); | 11 EXPECT_EQ(-1, FXSYS_atoi("-1")); |
| 12 EXPECT_EQ(2345, FXSYS_atoi("2345")); | 12 EXPECT_EQ(2345, FXSYS_atoi("2345")); |
| 13 EXPECT_EQ(-2147483647, FXSYS_atoi("-2147483647")); | 13 EXPECT_EQ(-2147483647, FXSYS_atoi("-2147483647")); |
| 14 // Handle the sign. | 14 // Handle the sign. |
| 15 EXPECT_EQ(-2345, FXSYS_atoi("-2345")); | 15 EXPECT_EQ(-2345, FXSYS_atoi("-2345")); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_EQ(2345u, FXSYS_atoui("+2345")); | 103 EXPECT_EQ(2345u, FXSYS_atoui("+2345")); |
| 104 // The max value. | 104 // The max value. |
| 105 EXPECT_EQ(4294967295, FXSYS_atoui("4294967295")); | 105 EXPECT_EQ(4294967295, FXSYS_atoui("4294967295")); |
| 106 EXPECT_EQ(9u, FXSYS_atoui("9x9")); | 106 EXPECT_EQ(9u, FXSYS_atoui("9x9")); |
| 107 | 107 |
| 108 // Out of range values. | 108 // Out of range values. |
| 109 EXPECT_EQ(4294967295, FXSYS_atoui("2147483623423412348")); | 109 EXPECT_EQ(4294967295, FXSYS_atoui("2147483623423412348")); |
| 110 EXPECT_EQ(4294967295, FXSYS_atoui("4294967296")); | 110 EXPECT_EQ(4294967295, FXSYS_atoui("4294967296")); |
| 111 EXPECT_EQ(4294967295, FXSYS_atoui("-4294967345")); | 111 EXPECT_EQ(4294967295, FXSYS_atoui("-4294967345")); |
| 112 } | 112 } |
| OLD | NEW |