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

Side by Side Diff: cc/hash_pair_unittest.cc

Issue 11428117: Fix compile warnings for 64-bit constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: GG_LONGLONG -> GG_INT64_C Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "cc/hash_pair.h" 5 #include "cc/hash_pair.h"
6
7 #include "base/basictypes.h"
6 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
7 9
8 namespace { 10 namespace {
9 11
10 class HashPairTest : public testing::Test { 12 class HashPairTest : public testing::Test {
11 }; 13 };
12 14
13 #define INSERT_PAIR_TEST(Type, value1, value2) \ 15 #define INSERT_PAIR_TEST(Type, value1, value2) \
14 { \ 16 { \
15 Type pair(value1, value2); \ 17 Type pair(value1, value2); \
16 base::hash_map<Type, int> map; \ 18 base::hash_map<Type, int> map; \
17 map[pair] = 1; \ 19 map[pair] = 1; \
18 } 20 }
19 21
20 // Verify that a hash_map can be constructed for pairs of integers of various 22 // Verify that a hash_map can be constructed for pairs of integers of various
21 // sizes. 23 // sizes.
22 TEST_F(HashPairTest, IntegerPairs) { 24 TEST_F(HashPairTest, IntegerPairs) {
23 typedef std::pair<short, short> ShortShortPair; 25 typedef std::pair<short, short> ShortShortPair;
24 typedef std::pair<short, int> ShortIntPair; 26 typedef std::pair<short, int> ShortIntPair;
25 typedef std::pair<short, int32> ShortInt32Pair; 27 typedef std::pair<short, int32> ShortInt32Pair;
26 typedef std::pair<short, int64> ShortInt64Pair; 28 typedef std::pair<short, int64> ShortInt64Pair;
27 29
28 INSERT_PAIR_TEST(ShortShortPair, 4, 6); 30 INSERT_PAIR_TEST(ShortShortPair, 4, 6);
29 INSERT_PAIR_TEST(ShortIntPair, 7, (1 << 30) + 4342); 31 INSERT_PAIR_TEST(ShortIntPair, 7, (1 << 30) + 4342);
30 INSERT_PAIR_TEST(ShortInt32Pair, 9, (1 << 29) + 378128932); 32 INSERT_PAIR_TEST(ShortInt32Pair, 9, (1 << 29) + 378128932);
31 INSERT_PAIR_TEST(ShortInt64Pair, 10, (1LL << 60) + 78931732321); 33 INSERT_PAIR_TEST(ShortInt64Pair, 10,
34 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
32 35
33 typedef std::pair<int, short> IntShortPair; 36 typedef std::pair<int, short> IntShortPair;
34 typedef std::pair<int, int> IntIntPair; 37 typedef std::pair<int, int> IntIntPair;
35 typedef std::pair<int, int32> IntInt32Pair; 38 typedef std::pair<int, int32> IntInt32Pair;
36 typedef std::pair<int, int64> IntInt64Pair; 39 typedef std::pair<int, int64> IntInt64Pair;
37 40
38 INSERT_PAIR_TEST(IntShortPair, 4, 6); 41 INSERT_PAIR_TEST(IntShortPair, 4, 6);
39 INSERT_PAIR_TEST(IntIntPair, 7, (1 << 30) + 4342); 42 INSERT_PAIR_TEST(IntIntPair, 7, (1 << 30) + 4342);
40 INSERT_PAIR_TEST(IntInt32Pair, 9, (1 << 29) + 378128932); 43 INSERT_PAIR_TEST(IntInt32Pair, 9, (1 << 29) + 378128932);
41 INSERT_PAIR_TEST(IntInt64Pair, 10, (1LL << 60) + 78931732321); 44 INSERT_PAIR_TEST(IntInt64Pair, 10,
45 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
42 46
43 typedef std::pair<int32, short> Int32ShortPair; 47 typedef std::pair<int32, short> Int32ShortPair;
44 typedef std::pair<int32, int> Int32IntPair; 48 typedef std::pair<int32, int> Int32IntPair;
45 typedef std::pair<int32, int32> Int32Int32Pair; 49 typedef std::pair<int32, int32> Int32Int32Pair;
46 typedef std::pair<int32, int64> Int32Int64Pair; 50 typedef std::pair<int32, int64> Int32Int64Pair;
47 51
48 INSERT_PAIR_TEST(Int32ShortPair, 4, 6); 52 INSERT_PAIR_TEST(Int32ShortPair, 4, 6);
49 INSERT_PAIR_TEST(Int32IntPair, 7, (1 << 30) + 4342); 53 INSERT_PAIR_TEST(Int32IntPair, 7, (1 << 30) + 4342);
50 INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932); 54 INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932);
51 INSERT_PAIR_TEST(Int32Int64Pair, 10, (1LL << 60) + 78931732321); 55 INSERT_PAIR_TEST(Int32Int64Pair, 10,
56 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
52 57
53 typedef std::pair<int64, short> Int64ShortPair; 58 typedef std::pair<int64, short> Int64ShortPair;
54 typedef std::pair<int64, int> Int64IntPair; 59 typedef std::pair<int64, int> Int64IntPair;
55 typedef std::pair<int64, int32> Int64Int32Pair; 60 typedef std::pair<int64, int32> Int64Int32Pair;
56 typedef std::pair<int64, int64> Int64Int64Pair; 61 typedef std::pair<int64, int64> Int64Int64Pair;
57 62
58 INSERT_PAIR_TEST(Int64ShortPair, 4, 6); 63 INSERT_PAIR_TEST(Int64ShortPair, 4, 6);
59 INSERT_PAIR_TEST(Int64IntPair, 7, (1 << 30) + 4342); 64 INSERT_PAIR_TEST(Int64IntPair, 7, (1 << 30) + 4342);
60 INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932); 65 INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932);
61 INSERT_PAIR_TEST(Int64Int64Pair, 10, (1LL << 60) + 78931732321); 66 INSERT_PAIR_TEST(Int64Int64Pair, 10,
67 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
62 } 68 }
63 69
64 } // anonymous namespace 70 } // anonymous namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698