getVia() and waitVia()
[folly.git] / folly / test / SpookyHashV1Test.cpp
index 6a3ecf4637d1ff1082c73e30019f406550ec6f78..d55a1b9380352788d3bae35f9941b7e13565fdc5 100644 (file)
@@ -30,6 +30,8 @@
 #include <cstdlib>
 #include <ctime>
 
+#include <gtest/gtest.h>
+
 using namespace ::folly::hash;
 
 static bool failed = false;
@@ -74,7 +76,8 @@ private:
 };
 
 // fastest conceivable hash function (for comparison)
-static void Add(const void *data, size_t length, uint64_t *hash1, uint64_t *hash2)
+static void Add(const void *data, size_t length,
+                uint64_t *hash1, uint64_t *hash2)
 {
     uint64_t *p64 = (uint64_t *)data;
     uint64_t *end = p64 + length/8;
@@ -426,8 +429,10 @@ void TestDeltas(int seed)
                     {
                         buf1[j/8] ^= (1 << (j%8));
                     }
-                    SpookyHashV1::Hash128(buf1, h, &measure[0][0], &measure[0][1]);
-                    SpookyHashV1::Hash128(buf2, h, &measure[1][0], &measure[1][1]);
+                    SpookyHashV1::Hash128(buf1, h,
+                            &measure[0][0], &measure[0][1]);
+                    SpookyHashV1::Hash128(buf2, h,
+                            &measure[1][0], &measure[1][1]);
                     for (int l=0; l<2; ++l) {
                         measure[2][l] = measure[0][l] ^ measure[1][l];
                         measure[3][l] = ~(measure[0][l] ^ measure[1][l]);
@@ -529,16 +534,15 @@ void TestPieces()
 }
 #undef BUFSIZE
 
-int main(int argc, const char **argv)
-{
+TEST(SpookyHashV1, Main) {
     TestResults();
     TestAlignment();
     TestPieces();
-    DoTimingBig(argc);
+    DoTimingBig(1);
     // tudorb@fb.com: Commented out slow tests
 #if 0
     DoTimingSmall(argc);
     TestDeltas(argc);
 #endif
-    return failed;
+    CHECK_EQ(failed, 0);
 }