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

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

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest Created 5 years, 3 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/memory/scoped_ptr.h ('k') | chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc » ('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 #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>
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffff)); 666 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffff));
667 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffffu)); 667 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(0x7fffffffu));
668 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0x80000000u)); 668 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0x80000000u));
669 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0xffffffffu)); 669 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(0xffffffffu));
670 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x80000000))); 670 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x80000000)));
671 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0xffffffff))); 671 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0xffffffff)));
672 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x100000000))); 672 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(INT64_C(0x100000000)));
673 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>( 673 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(
674 std::numeric_limits<int32_t>::min())); 674 std::numeric_limits<int32_t>::min()));
675 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>( 675 EXPECT_TRUE(IsValueInRangeForNumericType<int32_t>(
676 implicit_cast<int64_t>(std::numeric_limits<int32_t>::min()))); 676 static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
677 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>( 677 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(
678 implicit_cast<int64_t>(std::numeric_limits<int32_t>::min()) - 1)); 678 static_cast<int64_t>(std::numeric_limits<int32_t>::min()) - 1));
679 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>( 679 EXPECT_FALSE(IsValueInRangeForNumericType<int32_t>(
680 std::numeric_limits<int64_t>::min())); 680 std::numeric_limits<int64_t>::min()));
681 681
682 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0)); 682 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0));
683 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(1)); 683 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(1));
684 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(2)); 684 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(2));
685 EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(-1)); 685 EXPECT_FALSE(IsValueInRangeForNumericType<uint64_t>(-1));
686 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0xffffffffu)); 686 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(0xffffffffu));
687 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0xffffffff))); 687 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0xffffffff)));
688 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000000))); 688 EXPECT_TRUE(IsValueInRangeForNumericType<uint64_t>(UINT64_C(0x100000000)));
(...skipping 19 matching lines...) Expand all
708 IsValueInRangeForNumericType<int64_t>(INT64_C(0x7fffffffffffffff))); 708 IsValueInRangeForNumericType<int64_t>(INT64_C(0x7fffffffffffffff)));
709 EXPECT_TRUE( 709 EXPECT_TRUE(
710 IsValueInRangeForNumericType<int64_t>(UINT64_C(0x7fffffffffffffff))); 710 IsValueInRangeForNumericType<int64_t>(UINT64_C(0x7fffffffffffffff)));
711 EXPECT_FALSE( 711 EXPECT_FALSE(
712 IsValueInRangeForNumericType<int64_t>(UINT64_C(0x8000000000000000))); 712 IsValueInRangeForNumericType<int64_t>(UINT64_C(0x8000000000000000)));
713 EXPECT_FALSE( 713 EXPECT_FALSE(
714 IsValueInRangeForNumericType<int64_t>(UINT64_C(0xffffffffffffffff))); 714 IsValueInRangeForNumericType<int64_t>(UINT64_C(0xffffffffffffffff)));
715 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>( 715 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(
716 std::numeric_limits<int32_t>::min())); 716 std::numeric_limits<int32_t>::min()));
717 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>( 717 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(
718 implicit_cast<int64_t>(std::numeric_limits<int32_t>::min()))); 718 static_cast<int64_t>(std::numeric_limits<int32_t>::min())));
719 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>( 719 EXPECT_TRUE(IsValueInRangeForNumericType<int64_t>(
720 std::numeric_limits<int64_t>::min())); 720 std::numeric_limits<int64_t>::min()));
721 } 721 }
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr.h ('k') | chrome/browser/apps/app_shim/app_shim_host_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698