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

Unified Diff: test/cctest/test-unique.cc

Issue 23475038: Fix compile error with CLANG. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-unique.cc
diff --git a/test/cctest/test-unique.cc b/test/cctest/test-unique.cc
index b72f197c453a9c09cadde3b15a9095ae324a6503..1d268580ed52dabe12856f994b73fc0f4217f088 100644
--- a/test/cctest/test-unique.cc
+++ b/test/cctest/test-unique.cc
@@ -36,6 +36,26 @@
using namespace v8::internal;
+template <class T, class U>
+void CheckHashCodeEqual(Unique<T> a, Unique<U> b) {
+ int64_t hasha = static_cast<int64_t>(a.Hashcode());
+ int64_t hashb = static_cast<int64_t>(b.Hashcode());
+ CHECK_NE(static_cast<int64_t>(0), hasha);
+ CHECK_NE(static_cast<int64_t>(0), hashb);
+ CHECK_EQ(hasha, hashb);
+}
+
+
+template <class T, class U>
+void CheckHashCodeNotEqual(Unique<T> a, Unique<U> b) {
+ int64_t hasha = static_cast<int64_t>(a.Hashcode());
+ int64_t hashb = static_cast<int64_t>(b.Hashcode());
+ CHECK_NE(static_cast<int64_t>(0), hasha);
+ CHECK_NE(static_cast<int64_t>(0), hashb);
+ CHECK_NE(hasha, hashb);
+}
+
+
TEST(UniqueCreate) {
CcTest::InitializeVM();
Isolate* isolate = Isolate::Current();
@@ -45,28 +65,25 @@ TEST(UniqueCreate) {
Handle<String> A = factory->InternalizeUtf8String("A");
Unique<String> HA(A);
- CHECK_NE(static_cast<intptr_t>(0), HA.Hashcode());
CHECK(*HA.handle() == *A);
CHECK_EQ(*A, *HA.handle());
Unique<String> HA2(A);
- CHECK_EQ(HA.Hashcode(), HA2.Hashcode());
+ CheckHashCodeEqual(HA, HA2);
CHECK(HA == HA2);
CHECK_EQ(*HA.handle(), *HA2.handle());
- CHECK_EQ(HA2.Hashcode(), HA.Hashcode());
CHECK(HA2 == HA);
CHECK_EQ(*HA2.handle(), *HA.handle());
Handle<String> B = factory->InternalizeUtf8String("B");
Unique<String> HB(B);
- CHECK_NE(HA.Hashcode(), HB.Hashcode());
+ CheckHashCodeNotEqual(HA, HB);
CHECK(HA != HB);
CHECK_NE(*HA.handle(), *HB.handle());
- CHECK_NE(HB.Hashcode(), HA.Hashcode());
CHECK(HB != HA);
CHECK_NE(*HB.handle(), *HA.handle());
@@ -83,17 +100,15 @@ TEST(UniqueSubsume) {
Handle<String> A = factory->InternalizeUtf8String("A");
Unique<String> HA(A);
- CHECK_NE(static_cast<intptr_t>(0), HA.Hashcode());
CHECK(*HA.handle() == *A);
CHECK_EQ(*A, *HA.handle());
Unique<Object> HO = HA; // Here comes the subsumption, boys.
- CHECK_EQ(HA.Hashcode(), HO.Hashcode());
+ CheckHashCodeEqual(HA, HO);
CHECK(HA == HO);
CHECK_EQ(*HA.handle(), *HO.handle());
- CHECK_EQ(HO.Hashcode(), HA.Hashcode());
CHECK(HO == HA);
CHECK_EQ(*HO.handle(), *HA.handle());
}
« 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