OLD | NEW |
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 #if defined(COMPILER_MSVC) && defined(ARCH_CPU_32_BITS) |
6 #include <mmintrin.h> | 6 #include <mmintrin.h> |
7 #endif | 7 #endif |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
14 #include "base/numerics/safe_math.h" | 14 #include "base/numerics/safe_math.h" |
15 #include "base/template_util.h" | 15 #include "base/template_util.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/googletest/include/gtest/gtest.h" |
17 | 17 |
18 using std::numeric_limits; | 18 using std::numeric_limits; |
19 using base::CheckedNumeric; | 19 using base::CheckedNumeric; |
20 using base::checked_cast; | 20 using base::checked_cast; |
21 using base::IsValueInRangeForNumericType; | 21 using base::IsValueInRangeForNumericType; |
22 using base::IsValueNegative; | 22 using base::IsValueNegative; |
23 using base::SizeT; | 23 using base::SizeT; |
24 using base::StrictNumeric; | 24 using base::StrictNumeric; |
25 using base::saturated_cast; | 25 using base::saturated_cast; |
26 using base::strict_cast; | 26 using base::strict_cast; |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 757 |
758 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); | 758 CheckedNumeric<int> too_large = std::numeric_limits<int>::max(); |
759 EXPECT_TRUE(too_large.IsValid()); | 759 EXPECT_TRUE(too_large.IsValid()); |
760 too_large += d; | 760 too_large += d; |
761 EXPECT_FALSE(too_large.IsValid()); | 761 EXPECT_FALSE(too_large.IsValid()); |
762 too_large -= d; | 762 too_large -= d; |
763 EXPECT_FALSE(too_large.IsValid()); | 763 EXPECT_FALSE(too_large.IsValid()); |
764 too_large /= d; | 764 too_large /= d; |
765 EXPECT_FALSE(too_large.IsValid()); | 765 EXPECT_FALSE(too_large.IsValid()); |
766 } | 766 } |
OLD | NEW |