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

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

Issue 1841643002: Code change to avoid signed/unsigned mismatch warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « core/fxcodec/codec/fx_codec_jpx_unittest.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/include/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"));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 // Out of range values. 87 // Out of range values.
88 EXPECT_EQ(9223372036854775807LL, 88 EXPECT_EQ(9223372036854775807LL,
89 FXSYS_wtoi64(L"922337203685471234123475807")); 89 FXSYS_wtoi64(L"922337203685471234123475807"));
90 EXPECT_EQ(9223372036854775807LL, FXSYS_wtoi64(L"9223372036854775808")); 90 EXPECT_EQ(9223372036854775807LL, FXSYS_wtoi64(L"9223372036854775808"));
91 EXPECT_EQ(-9223372036854775807LL - 1LL, 91 EXPECT_EQ(-9223372036854775807LL - 1LL,
92 FXSYS_wtoi64(L"-9223372036854775810")); 92 FXSYS_wtoi64(L"-9223372036854775810"));
93 } 93 }
94 94
95 TEST(fxcrt, FXSYS_atoui) { 95 TEST(fxcrt, FXSYS_atoui) {
96 EXPECT_EQ(0, FXSYS_atoui("")); 96 EXPECT_EQ(0u, FXSYS_atoui(""));
97 EXPECT_EQ(0, FXSYS_atoui("0")); 97 EXPECT_EQ(0u, FXSYS_atoui("0"));
98 EXPECT_EQ(4294967295, FXSYS_atoui("-1")); 98 EXPECT_EQ(4294967295, FXSYS_atoui("-1"));
99 EXPECT_EQ(2345, FXSYS_atoui("2345")); 99 EXPECT_EQ(2345u, FXSYS_atoui("2345"));
100 // Handle the sign. 100 // Handle the sign.
101 EXPECT_EQ(4294964951, FXSYS_atoui("-2345")); 101 EXPECT_EQ(4294964951, FXSYS_atoui("-2345"));
102 EXPECT_EQ(2345, FXSYS_atoui("+2345")); 102 EXPECT_EQ(2345u, FXSYS_atoui("+2345"));
103 // The max value. 103 // The max value.
104 EXPECT_EQ(4294967295, FXSYS_atoui("4294967295")); 104 EXPECT_EQ(4294967295, FXSYS_atoui("4294967295"));
105 EXPECT_EQ(9, FXSYS_atoui("9x9")); 105 EXPECT_EQ(9u, FXSYS_atoui("9x9"));
106 106
107 // Out of range values. 107 // Out of range values.
108 EXPECT_EQ(4294967295, FXSYS_atoui("2147483623423412348")); 108 EXPECT_EQ(4294967295, FXSYS_atoui("2147483623423412348"));
109 EXPECT_EQ(4294967295, FXSYS_atoui("4294967296")); 109 EXPECT_EQ(4294967295, FXSYS_atoui("4294967296"));
110 EXPECT_EQ(4294967295, FXSYS_atoui("-4294967345")); 110 EXPECT_EQ(4294967295, FXSYS_atoui("-4294967345"));
111 } 111 }
OLDNEW
« no previous file with comments | « core/fxcodec/codec/fx_codec_jpx_unittest.cpp ('k') | core/fxcrt/include/fx_string.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698