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

Side by Side Diff: base/numerics/safe_numerics_unittest.cc

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 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 | « base/numerics/safe_math_impl.h ('k') | base/observer_list.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) 5 #include <stddef.h>
6 #include <mmintrin.h>
7 #endif
8 #include <stdint.h> 6 #include <stdint.h>
9 7
10 #include <limits> 8 #include <limits>
11 #include <type_traits> 9 #include <type_traits>
12 10
13 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
14 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
15 #include "base/numerics/safe_math.h" 13 #include "base/numerics/safe_math.h"
16 #include "base/template_util.h" 14 #include "base/template_util.h"
15 #include "build/build_config.h"
17 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
18 17
18 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS)
19 #include <mmintrin.h>
20 #endif
21
19 using std::numeric_limits; 22 using std::numeric_limits;
20 using base::CheckedNumeric; 23 using base::CheckedNumeric;
21 using base::checked_cast; 24 using base::checked_cast;
22 using base::IsValueInRangeForNumericType; 25 using base::IsValueInRangeForNumericType;
23 using base::IsValueNegative; 26 using base::IsValueNegative;
24 using base::SizeT; 27 using base::SizeT;
25 using base::StrictNumeric; 28 using base::StrictNumeric;
26 using base::saturated_cast; 29 using base::saturated_cast;
27 using base::strict_cast; 30 using base::strict_cast;
28 using base::internal::MaxExponent; 31 using base::internal::MaxExponent;
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 777
775 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); 778 CheckedNumeric<int> too_large = std::numeric_limits<int>::max();
776 EXPECT_TRUE(too_large.IsValid()); 779 EXPECT_TRUE(too_large.IsValid());
777 too_large += d; 780 too_large += d;
778 EXPECT_FALSE(too_large.IsValid()); 781 EXPECT_FALSE(too_large.IsValid());
779 too_large -= d; 782 too_large -= d;
780 EXPECT_FALSE(too_large.IsValid()); 783 EXPECT_FALSE(too_large.IsValid());
781 too_large /= d; 784 too_large /= d;
782 EXPECT_FALSE(too_large.IsValid()); 785 EXPECT_FALSE(too_large.IsValid());
783 } 786 }
OLDNEW
« no previous file with comments | « base/numerics/safe_math_impl.h ('k') | base/observer_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698