Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: core/src/fxcrt/fx_basic_gcc_unittest.cpp

Issue 1755273002: Fix parsing of object numbers > 16,777,216. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/include/fxcrt/fx_system.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 TEST(fxcrt, FXSYS_atoi) {
9 EXPECT_EQ(0, FXSYS_atoi("0"));
10 EXPECT_EQ(-1, FXSYS_atoi("-1"));
11 EXPECT_EQ(2345, FXSYS_atoi("2345"));
12 EXPECT_EQ(2147483647, FXSYS_atoi("2147483647"));
13 EXPECT_EQ(-2147483647, FXSYS_atoi("-2147483647"));
14 }
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
15
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.
16 TEST(fxcrt, FXSYS_atoi64) {
17 EXPECT_EQ(0, FXSYS_atoi64("0"));
18 EXPECT_EQ(-1, FXSYS_atoi64("-1"));
19 EXPECT_EQ(2345, FXSYS_atoi64("2345"));
20 EXPECT_EQ(9223372036854775807LL, FXSYS_atoi64("9223372036854775807"));
21 EXPECT_EQ(-9223372036854775807LL, FXSYS_atoi64("-9223372036854775807"));
22 }
23
24 TEST(fxcrt, FXSYS_wtoi) {
25 EXPECT_EQ(0, FXSYS_wtoi(L"0"));
26 EXPECT_EQ(-1, FXSYS_wtoi(L"-1"));
27 EXPECT_EQ(2345, FXSYS_wtoi(L"2345"));
28 EXPECT_EQ(2147483647, FXSYS_wtoi(L"2147483647"));
29 EXPECT_EQ(-2147483647, FXSYS_wtoi(L"-2147483647"));
30 }
31
32 TEST(fxcrt, FXSYS_wtoi64) {
33 EXPECT_EQ(0, FXSYS_wtoi64(L"0"));
34 EXPECT_EQ(-1, FXSYS_wtoi64(L"-1"));
35 EXPECT_EQ(2345, FXSYS_wtoi64(L"2345"));
36 EXPECT_EQ(9223372036854775807LL, FXSYS_wtoi64(L"9223372036854775807"));
37 EXPECT_EQ(-9223372036854775807LL, FXSYS_wtoi64(L"-9223372036854775807"));
38 }
39
40 TEST(fxcrt, FXSYS_atoui) {
41 EXPECT_EQ(0, FXSYS_atoui("0"));
42 EXPECT_EQ(0, FXSYS_atoui("-1"));
43 EXPECT_EQ(2345, FXSYS_atoui("2345"));
44 EXPECT_EQ(4294967295, FXSYS_atoui("4294967295"));
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698