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

Unified Diff: tests/ChecksumTest.cpp

Issue 1021033002: Some usability ideas around SkTHash. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: minor tweaks Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/svg/SkSVGDevice.cpp ('k') | tests/HashTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ChecksumTest.cpp
diff --git a/tests/ChecksumTest.cpp b/tests/ChecksumTest.cpp
index 62486780439dbd4691f46a912ef7c007ba44dba3..3658bd771ee27c666c1e59e0fdc0a1b9dc14cbc5 100644
--- a/tests/ChecksumTest.cpp
+++ b/tests/ChecksumTest.cpp
@@ -50,3 +50,16 @@ DEF_TEST(Checksum, r) {
}
}
}
+
+DEF_TEST(GoodHash, r) {
+ ASSERT(SkGoodHash(( int32_t)4) == 614249093); // 4 bytes. Hits SkChecksum::Mix fast path.
+ ASSERT(SkGoodHash((uint32_t)4) == 614249093); // (Ditto)
+
+ // None of these are 4 byte sized, so they use SkChecksum::Murmur3, not SkChecksum::Mix.
+ ASSERT(SkGoodHash((uint64_t)4) == 3491892518);
+ ASSERT(SkGoodHash((uint16_t)4) == 899251846);
+ ASSERT(SkGoodHash( (uint8_t)4) == 962700458);
+
+ // Tests SkString is correctly specialized.
+ ASSERT(SkGoodHash(SkString("Hi")) == 55667557);
+}
« no previous file with comments | « src/svg/SkSVGDevice.cpp ('k') | tests/HashTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698