aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2012-03-03 07:56:49 +0000
committerFrancois Pichet <pichet2000@gmail.com>2012-03-03 07:56:49 +0000
commit2547e7faba2b0511b88cfd2a187c072612105600 (patch)
treebf729dd90514f9c42cc12c756076f8e735e1109e /unittests
parentedf24a8be491b35f77951614d242458cf2c54669 (diff)
Fixes the Hashing tests on MSVC by adding llvm:: prefix to hash_value function call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151971 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/HashingTest.cpp52
1 files changed, 24 insertions, 28 deletions
diff --git a/unittests/ADT/HashingTest.cpp b/unittests/ADT/HashingTest.cpp
index e68cffd909..0d24e0d6e3 100644
--- a/unittests/ADT/HashingTest.cpp
+++ b/unittests/ADT/HashingTest.cpp
@@ -42,7 +42,6 @@ using namespace llvm;
namespace {
-#if _MSC_VER != 1600
struct NonPOD {
uint64_t x, y;
NonPOD(uint64_t x, uint64_t y) : x(x), y(y) {}
@@ -51,7 +50,6 @@ struct NonPOD {
return hash_combine(obj.x, obj.y);
}
};
-#endif
TEST(HashingTest, HashValueBasicTest) {
@@ -62,41 +60,39 @@ TEST(HashingTest, HashValueBasicTest) {
volatile int vi = 71;
const volatile int cvi = 71;
uintptr_t addr = reinterpret_cast<uintptr_t>(&y);
- EXPECT_EQ(hash_value(42), hash_value(x));
- EXPECT_NE(hash_value(42), hash_value(y));
- EXPECT_NE(hash_value(42), hash_value(p));
- EXPECT_EQ(hash_value(71), hash_value(i));
- EXPECT_EQ(hash_value(71), hash_value(ci));
- EXPECT_EQ(hash_value(71), hash_value(vi));
- EXPECT_EQ(hash_value(71), hash_value(cvi));
- EXPECT_EQ(hash_value(c), hash_value('x'));
- EXPECT_EQ(hash_value('4'), hash_value('0' + 4));
- EXPECT_EQ(hash_value(addr), hash_value(&y));
-
- EXPECT_EQ(hash_combine(42, 43), hash_value(std::make_pair(42, 43)));
- EXPECT_NE(hash_combine(43, 42), hash_value(std::make_pair(42, 43)));
- EXPECT_NE(hash_combine(42, 43), hash_value(std::make_pair(42ull, 43ull)));
- EXPECT_NE(hash_combine(42, 43), hash_value(std::make_pair(42, 43ull)));
- EXPECT_NE(hash_combine(42, 43), hash_value(std::make_pair(42ull, 43)));
+ EXPECT_EQ(llvm::hash_value(42), llvm::hash_value(x));
+ EXPECT_NE(llvm::hash_value(42), llvm::hash_value(y));
+ EXPECT_NE(llvm::hash_value(42), llvm::hash_value(p));
+ EXPECT_EQ(llvm::hash_value(71), llvm::hash_value(i));
+ EXPECT_EQ(llvm::hash_value(71), llvm::hash_value(ci));
+ EXPECT_EQ(llvm::hash_value(71), llvm::hash_value(vi));
+ EXPECT_EQ(llvm::hash_value(71), llvm::hash_value(cvi));
+ EXPECT_EQ(llvm::hash_value(c), llvm::hash_value('x'));
+ EXPECT_EQ(llvm::hash_value('4'), llvm::hash_value('0' + 4));
+ EXPECT_EQ(llvm::hash_value(addr), llvm::hash_value(&y));
+
+ EXPECT_EQ(llvm::hash_combine(42, 43), llvm::hash_value(std::make_pair(42, 43)));
+ EXPECT_NE(llvm::hash_combine(43, 42), llvm::hash_value(std::make_pair(42, 43)));
+ EXPECT_NE(llvm::hash_combine(42, 43), llvm::hash_value(std::make_pair(42ull, 43ull)));
+ EXPECT_NE(llvm::hash_combine(42, 43), llvm::hash_value(std::make_pair(42, 43ull)));
+ EXPECT_NE(llvm::hash_combine(42, 43), llvm::hash_value(std::make_pair(42ull, 43)));
// Note that pairs are implicitly flattened to a direct sequence of data and
// hashed efficiently as a consequence.
- EXPECT_EQ(hash_combine(42, 43, 44),
- hash_value(std::make_pair(42, std::make_pair(43, 44))));
- EXPECT_EQ(hash_value(std::make_pair(42, std::make_pair(43, 44))),
- hash_value(std::make_pair(std::make_pair(42, 43), 44)));
+ EXPECT_EQ(llvm::hash_combine(42, 43, 44),
+ llvm::hash_value(std::make_pair(42, std::make_pair(43, 44))));
+ EXPECT_EQ(llvm::hash_value(std::make_pair(42, std::make_pair(43, 44))),
+ llvm::hash_value(std::make_pair(std::make_pair(42, 43), 44)));
-#if _MSC_VER != 1600
// Ensure that pairs which have padding bytes *inside* them don't get treated
// this way.
- EXPECT_EQ(hash_combine('0', hash_combine(1ull, '2')),
- hash_value(std::make_pair('0', std::make_pair(1ull, '2'))));
+ EXPECT_EQ(llvm::hash_combine('0', hash_combine(1ull, '2')),
+ llvm::hash_value(std::make_pair('0', std::make_pair(1ull, '2'))));
// Ensure that non-POD pairs don't explode the traits used.
NonPOD obj1(1, 2), obj2(3, 4), obj3(5, 6);
- EXPECT_EQ(hash_combine(obj1, hash_combine(obj2, obj3)),
- hash_value(std::make_pair(obj1, std::make_pair(obj2, obj3))));
-#endif
+ EXPECT_EQ(llvm::hash_combine(obj1, hash_combine(obj2, obj3)),
+ llvm::hash_value(std::make_pair(obj1, std::make_pair(obj2, obj3))));
}
template <typename T, size_t N> T *begin(T (&arr)[N]) { return arr; }