Add intro to any Chrome app API with no overview docs.
[chromium-blink-merge.git] / cc / hash_pair_unittest.cc
bloba3218ec9cd69a34026b349d43b713601999a7e51
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.
5 #include "cc/hash_pair.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace {
10 class HashPairTest : public testing::Test {
13 #define INSERT_PAIR_TEST(Type, value1, value2) \
14 { \
15 Type pair(value1, value2); \
16 base::hash_map<Type, int> map; \
17 map[pair] = 1; \
20 // Verify that a hash_map can be constructed for pairs of integers of various
21 // sizes.
22 TEST_F(HashPairTest, IntegerPairs) {
23 typedef std::pair<short, short> ShortShortPair;
24 typedef std::pair<short, int> ShortIntPair;
25 typedef std::pair<short, int32> ShortInt32Pair;
26 typedef std::pair<short, int64> ShortInt64Pair;
28 INSERT_PAIR_TEST(ShortShortPair, 4, 6);
29 INSERT_PAIR_TEST(ShortIntPair, 7, (1 << 30) + 4342);
30 INSERT_PAIR_TEST(ShortInt32Pair, 9, (1 << 29) + 378128932);
31 INSERT_PAIR_TEST(ShortInt64Pair, 10, (1LL << 60) + 78931732321);
33 typedef std::pair<int, short> IntShortPair;
34 typedef std::pair<int, int> IntIntPair;
35 typedef std::pair<int, int32> IntInt32Pair;
36 typedef std::pair<int, int64> IntInt64Pair;
38 INSERT_PAIR_TEST(IntShortPair, 4, 6);
39 INSERT_PAIR_TEST(IntIntPair, 7, (1 << 30) + 4342);
40 INSERT_PAIR_TEST(IntInt32Pair, 9, (1 << 29) + 378128932);
41 INSERT_PAIR_TEST(IntInt64Pair, 10, (1LL << 60) + 78931732321);
43 typedef std::pair<int32, short> Int32ShortPair;
44 typedef std::pair<int32, int> Int32IntPair;
45 typedef std::pair<int32, int32> Int32Int32Pair;
46 typedef std::pair<int32, int64> Int32Int64Pair;
48 INSERT_PAIR_TEST(Int32ShortPair, 4, 6);
49 INSERT_PAIR_TEST(Int32IntPair, 7, (1 << 30) + 4342);
50 INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932);
51 INSERT_PAIR_TEST(Int32Int64Pair, 10, (1LL << 60) + 78931732321);
53 typedef std::pair<int64, short> Int64ShortPair;
54 typedef std::pair<int64, int> Int64IntPair;
55 typedef std::pair<int64, int32> Int64Int32Pair;
56 typedef std::pair<int64, int64> Int64Int64Pair;
58 INSERT_PAIR_TEST(Int64ShortPair, 4, 6);
59 INSERT_PAIR_TEST(Int64IntPair, 7, (1 << 30) + 4342);
60 INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932);
61 INSERT_PAIR_TEST(Int64Int64Pair, 10, (1LL << 60) + 78931732321);
64 } // anonymous namespace