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

Side by Side Diff: cc/hash_pair_unittest.cc

Issue 12472028: Part 1 of cc/ directory shuffles: base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/hash_pair.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace {
11
12 class HashPairTest : public testing::Test {
13 };
14
15 #define INSERT_PAIR_TEST(Type, value1, value2) \
16 { \
17 Type pair(value1, value2); \
18 base::hash_map<Type, int> map; \
19 map[pair] = 1; \
20 }
21
22 // Verify that a hash_map can be constructed for pairs of integers of various
23 // sizes.
24 TEST_F(HashPairTest, IntegerPairs) {
25 typedef std::pair<short, short> ShortShortPair;
26 typedef std::pair<short, int> ShortIntPair;
27 typedef std::pair<short, int32> ShortInt32Pair;
28 typedef std::pair<short, int64> ShortInt64Pair;
29
30 INSERT_PAIR_TEST(ShortShortPair, 4, 6);
31 INSERT_PAIR_TEST(ShortIntPair, 7, (1 << 30) + 4342);
32 INSERT_PAIR_TEST(ShortInt32Pair, 9, (1 << 29) + 378128932);
33 INSERT_PAIR_TEST(ShortInt64Pair, 10,
34 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
35
36 typedef std::pair<int, short> IntShortPair;
37 typedef std::pair<int, int> IntIntPair;
38 typedef std::pair<int, int32> IntInt32Pair;
39 typedef std::pair<int, int64> IntInt64Pair;
40
41 INSERT_PAIR_TEST(IntShortPair, 4, 6);
42 INSERT_PAIR_TEST(IntIntPair, 7, (1 << 30) + 4342);
43 INSERT_PAIR_TEST(IntInt32Pair, 9, (1 << 29) + 378128932);
44 INSERT_PAIR_TEST(IntInt64Pair, 10,
45 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
46
47 typedef std::pair<int32, short> Int32ShortPair;
48 typedef std::pair<int32, int> Int32IntPair;
49 typedef std::pair<int32, int32> Int32Int32Pair;
50 typedef std::pair<int32, int64> Int32Int64Pair;
51
52 INSERT_PAIR_TEST(Int32ShortPair, 4, 6);
53 INSERT_PAIR_TEST(Int32IntPair, 7, (1 << 30) + 4342);
54 INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932);
55 INSERT_PAIR_TEST(Int32Int64Pair, 10,
56 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
57
58 typedef std::pair<int64, short> Int64ShortPair;
59 typedef std::pair<int64, int> Int64IntPair;
60 typedef std::pair<int64, int32> Int64Int32Pair;
61 typedef std::pair<int64, int64> Int64Int64Pair;
62
63 INSERT_PAIR_TEST(Int64ShortPair, 4, 6);
64 INSERT_PAIR_TEST(Int64IntPair, 7, (1 << 30) + 4342);
65 INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932);
66 INSERT_PAIR_TEST(Int64Int64Pair, 10,
67 (GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
68 }
69
70 } // namespace
OLDNEW
« cc/cc.gyp ('K') | « cc/hash_pair.h ('k') | cc/heads_up_display_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698