Chromium Code Reviews| Index: core/src/fxcrt/fx_basic_gcc_unittest.cpp |
| diff --git a/core/src/fxcrt/fx_basic_gcc_unittest.cpp b/core/src/fxcrt/fx_basic_gcc_unittest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d27052936c98cc9f8b9406b00b03e9a0019a6187 |
| --- /dev/null |
| +++ b/core/src/fxcrt/fx_basic_gcc_unittest.cpp |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2014 PDFium Authors. All rights reserved. |
|
Tom Sepez
2016/03/02 21:48:37
nit: 2016. Ha!
dsinclair
2016/03/02 22:09:18
Doh, caught in the copy-paste act.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "core/include/fxcrt/fx_system.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +TEST(fxcrt, FXSYS_atoi) { |
| + EXPECT_EQ(0, FXSYS_atoi("0")); |
| + EXPECT_EQ(-1, FXSYS_atoi("-1")); |
| + EXPECT_EQ(2345, FXSYS_atoi("2345")); |
| + EXPECT_EQ(2147483647, FXSYS_atoi("2147483647")); |
| + EXPECT_EQ(-2147483647, FXSYS_atoi("-2147483647")); |
| +} |
|
Tom Sepez
2016/03/02 21:46:23
Note that "-2147483648" is legit but can't be pars
dsinclair
2016/03/02 22:09:18
Done, although the results kinda suck. I don't thi
|
| + |
|
Tom Sepez
2016/03/02 21:47:38
Oh, and anything that takes a string needs to be c
dsinclair
2016/03/02 22:09:18
Done.
|
| +TEST(fxcrt, FXSYS_atoi64) { |
| + EXPECT_EQ(0, FXSYS_atoi64("0")); |
| + EXPECT_EQ(-1, FXSYS_atoi64("-1")); |
| + EXPECT_EQ(2345, FXSYS_atoi64("2345")); |
| + EXPECT_EQ(9223372036854775807LL, FXSYS_atoi64("9223372036854775807")); |
| + EXPECT_EQ(-9223372036854775807LL, FXSYS_atoi64("-9223372036854775807")); |
| +} |
| + |
| +TEST(fxcrt, FXSYS_wtoi) { |
| + EXPECT_EQ(0, FXSYS_wtoi(L"0")); |
| + EXPECT_EQ(-1, FXSYS_wtoi(L"-1")); |
| + EXPECT_EQ(2345, FXSYS_wtoi(L"2345")); |
| + EXPECT_EQ(2147483647, FXSYS_wtoi(L"2147483647")); |
| + EXPECT_EQ(-2147483647, FXSYS_wtoi(L"-2147483647")); |
| +} |
| + |
| +TEST(fxcrt, FXSYS_wtoi64) { |
| + EXPECT_EQ(0, FXSYS_wtoi64(L"0")); |
| + EXPECT_EQ(-1, FXSYS_wtoi64(L"-1")); |
| + EXPECT_EQ(2345, FXSYS_wtoi64(L"2345")); |
| + EXPECT_EQ(9223372036854775807LL, FXSYS_wtoi64(L"9223372036854775807")); |
| + EXPECT_EQ(-9223372036854775807LL, FXSYS_wtoi64(L"-9223372036854775807")); |
| +} |
| + |
| +TEST(fxcrt, FXSYS_atoui) { |
| + EXPECT_EQ(0, FXSYS_atoui("0")); |
| + EXPECT_EQ(0, FXSYS_atoui("-1")); |
| + EXPECT_EQ(2345, FXSYS_atoui("2345")); |
| + EXPECT_EQ(4294967295, FXSYS_atoui("4294967295")); |
| +} |