proxygen
SpookyHashV2Test.cpp File Reference
#include <folly/hash/SpookyHashV2.h>
#include <cinttypes>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <glog/logging.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Time.h>

Go to the source code of this file.

Classes

class  Random
 

Macros

#define __STDC_FORMAT_MACROS   1
 
#define BUFSIZE   (512)
 
#define NUMBUF   (1<<10)
 
#define BUFSIZE   (1<<20)
 
#define BUFSIZE   (1<<14)
 
#define NUMITER   10000000
 
#define BUFSIZE   1024
 
#define BUFSIZE   256
 
#define TRIES   50
 
#define MEASURES   6
 
#define BUFSIZE   1024
 

Functions

static uint64_t GetClockTickCount ()
 
static void Add (const void *data, size_t length, uint64_t *hash1, uint64_t *hash2)
 
void TestResults ()
 
void DoTimingBig (int seed)
 
void DoTimingSmall (int seed)
 
void TestAlignment ()
 
void TestDeltas (int seed)
 
void TestPieces ()
 
 TEST (SpookyHashV2, Main)
 

Variables

static bool failed = false
 

Macro Definition Documentation

#define __STDC_FORMAT_MACROS   1

Definition at line 20 of file SpookyHashV2Test.cpp.

#define BUFSIZE   (512)
#define BUFSIZE   (1<<20)

Definition at line 472 of file SpookyHashV2Test.cpp.

#define BUFSIZE   (1<<14)

Definition at line 472 of file SpookyHashV2Test.cpp.

#define BUFSIZE   1024

Definition at line 472 of file SpookyHashV2Test.cpp.

#define BUFSIZE   256

Definition at line 472 of file SpookyHashV2Test.cpp.

#define BUFSIZE   1024

Definition at line 472 of file SpookyHashV2Test.cpp.

#define MEASURES   6

Definition at line 381 of file SpookyHashV2Test.cpp.

Referenced by TestDeltas().

#define NUMBUF   (1<<10)

Definition at line 257 of file SpookyHashV2Test.cpp.

Referenced by DoTimingBig().

#define NUMITER   10000000

Definition at line 319 of file SpookyHashV2Test.cpp.

Referenced by DoTimingSmall().

#define TRIES   50

Definition at line 380 of file SpookyHashV2Test.cpp.

Referenced by TestDeltas().

Function Documentation

static void Add ( const void *  data,
size_t  length,
uint64_t hash1,
uint64_t hash2 
)
static

Definition at line 83 of file SpookyHashV2Test.cpp.

References folly::test::end(), and uint64_t.

Referenced by DoTimingBig().

85 {
86  uint64_t *p64 = (uint64_t *)data;
87  uint64_t *end = p64 + length/8;
88  uint64_t hash = *hash1 + *hash2;
89  while (p64 < end)
90  {
91  hash += *p64;
92  ++p64;
93  }
94  *hash1 = hash;
95  *hash2 = hash;
96 }
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
void DoTimingBig ( int  seed)

Definition at line 259 of file SpookyHashV2Test.cpp.

References a, Add(), BUFSIZE, bm::free(), GetClockTickCount(), i, NUMBUF, seed, and uint64_t.

Referenced by TEST().

260 {
261  printf("\ntesting time to hash 2^^30 bytes ...\n");
262 
263  char *buf[NUMBUF];
264  for (int i=0; i<NUMBUF; ++i)
265  {
266  buf[i] = (char *)malloc(BUFSIZE);
267  memset(buf[i], (char)seed, BUFSIZE);
268  }
269 
271  uint64_t hash1 = seed;
272  uint64_t hash2 = seed;
273  for (uint64_t i=0; i<NUMBUF; ++i)
274  {
275  SpookyHashV2::Hash128(buf[i], BUFSIZE, &hash1, &hash2);
276  }
278  printf("SpookyHashV2::Hash128, uncached: time is "
279  "%4" PRId64 " milliseconds\n", z-a);
280 
281  a = GetClockTickCount();
282  for (uint64_t i=0; i<NUMBUF; ++i)
283  {
284  Add(buf[i], BUFSIZE, &hash1, &hash2);
285  }
286  z = GetClockTickCount();
287  printf("Addition , uncached: time is %4" PRId64 " milliseconds\n",
288  z-a);
289 
290  a = GetClockTickCount();
291  for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
292  {
293  SpookyHashV2::Hash128(buf[0], 1024, &hash1, &hash2);
294  }
295  z = GetClockTickCount();
296  printf("SpookyHashV2::Hash128, cached: time is "
297  "%4" PRId64 " milliseconds\n", z-a);
298 
299  a = GetClockTickCount();
300  for (uint64_t i=0; i<NUMBUF*BUFSIZE/1024; ++i)
301  {
302  Add(buf[0], 1024, &hash1, &hash2);
303  }
304  z = GetClockTickCount();
305  printf("Addition , cached: time is %4" PRId64 " milliseconds\n",
306  z-a);
307 
308  for (int i=0; i<NUMBUF; ++i)
309  {
310  free(buf[i]);
311  buf[i] = nullptr;
312  }
313 }
static const int seed
static uint64_t GetClockTickCount()
static void Add(const void *data, size_t length, uint64_t *hash1, uint64_t *hash2)
Definition: InvokeTest.cpp:72
char a
void free()
#define NUMBUF
#define BUFSIZE
void DoTimingSmall ( int  seed)

Definition at line 320 of file SpookyHashV2Test.cpp.

References a, BUFSIZE, GetClockTickCount(), i, NUMITER, seed, and uint64_t.

Referenced by TEST().

321 {
322  printf("\ntesting timing of hashing up to %d cached aligned bytes %d "
323  "times ...\n", BUFSIZE, NUMITER);
324 
325  uint64_t buf[BUFSIZE/8];
326  for (int i=0; i<BUFSIZE/8; ++i)
327  {
328  buf[i] = i+seed;
329  }
330 
331  for (int i=1; i <= BUFSIZE; i <<= 1)
332  {
334  uint64_t hash1 = seed;
335  uint64_t hash2 = seed+i;
336  for (int j=0; j<NUMITER; ++j)
337  {
338  SpookyHashV2::Hash128((char *)buf, i, &hash1, &hash2);
339  }
341  printf("%d bytes: hash is %.16" PRIx64 " %.16" PRIx64 ", "
342  "time is %" PRId64 "\n", i, hash1, hash2, z-a);
343  }
344 }
static const int seed
static uint64_t GetClockTickCount()
Definition: InvokeTest.cpp:72
char a
#define NUMITER
#define BUFSIZE
static uint64_t GetClockTickCount ( )
static

Definition at line 42 of file SpookyHashV2Test.cpp.

References folly::chrono::clock_gettime.

Referenced by DoTimingBig(), and DoTimingSmall().

42  {
43  timespec ts;
44  clock_gettime(CLOCK_REALTIME, &ts);
45  return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; // milliseconds
46 }
int(* clock_gettime)(clockid_t, timespec *ts)
TEST ( SpookyHashV2  ,
Main   
)

Definition at line 535 of file SpookyHashV2Test.cpp.

References DoTimingBig(), DoTimingSmall(), failed, TestAlignment(), TestDeltas(), TestPieces(), and TestResults().

535  {
536  TestResults();
537  TestAlignment();
538  TestPieces();
539  DoTimingBig(1);
540  // tudorb@fb.com: Commented out slow tests
541 #if 0
542  DoTimingSmall(argc);
543  TestDeltas(argc);
544 #endif
545  CHECK_EQ(failed, 0);
546 }
void TestAlignment()
void DoTimingSmall(int seed)
void DoTimingBig(int seed)
void TestPieces()
void TestDeltas(int seed)
static bool failed
void TestResults()
void TestAlignment ( )

Definition at line 348 of file SpookyHashV2Test.cpp.

References BUFSIZE, failed, i, k, and uint64_t.

Referenced by TEST().

349 {
350  printf("\ntesting alignment ...\n");
351 
352  char buf[BUFSIZE];
353  uint64_t hash[8];
354  for (int i=0; i<BUFSIZE-16; ++i)
355  {
356  for (int j=0; j<8; ++j)
357  {
358  buf[j] = (char)i+j;
359  for (int k=1; k<=i; ++k)
360  {
361  buf[j+k] = k;
362  }
363  buf[j+i+1] = (char)i+j;
364  hash[j] = SpookyHashV2::Hash64((const void *)(buf+j+1), i, 0);
365  }
366  for (int j=1; j<8; ++j)
367  {
368  if (hash[0] != hash[j])
369  {
370  printf("alignment problems: %d %d\n", i, j);
371  failed = true;
372  }
373  }
374  }
375 }
static bool failed
KeyT k
#define BUFSIZE
void TestDeltas ( int  seed)

Definition at line 382 of file SpookyHashV2Test.cpp.

References BUFSIZE, counter, failed, h, i, Random::Init(), k, m, measure(), MEASURES, random(), TRIES, uint64_t, uint8_t, and Random::Value().

Referenced by TEST().

383 {
384  printf("\nall 1 or 2 bit input deltas get %d tries to flip every output "
385  "bit ...\n", TRIES);
386 
387  Random random;
388  random.Init((uint64_t)seed);
389 
390  // for messages 0..BUFSIZE-1 bytes
391  for (int h=0; h<BUFSIZE; ++h)
392  {
393  int maxk = 0;
394  // first bit to set
395  for (int i=0; i<h*8; ++i)
396  {
397  // second bit to set, or don't have a second bit
398  for (int j=0; j<=i; ++j)
399  {
402  for (int l=0; l<2; ++l)
403  {
404  for (int m=0; m<MEASURES; ++m)
405  {
406  counter[m][l] = 0;
407  }
408  }
409 
410  // try to hit every output bit TRIES times
411  int k;
412  for (k=0; k<TRIES; ++k)
413  {
414  uint8_t buf1[BUFSIZE];
415  uint8_t buf2[BUFSIZE];
416  int done = 1;
417  for (int l=0; l<h; ++l)
418  {
419  buf1[l] = buf2[l] = random.Value();
420  }
421  buf1[i/8] ^= (1 << (i%8));
422  if (j != i)
423  {
424  buf1[j/8] ^= (1 << (j%8));
425  }
426  SpookyHashV2::Hash128(buf1, h,
427  &measure[0][0], &measure[0][1]);
428  SpookyHashV2::Hash128(buf2, h,
429  &measure[1][0], &measure[1][1]);
430  for (int l=0; l<2; ++l) {
431  measure[2][l] = measure[0][l] ^ measure[1][l];
432  measure[3][l] = ~(measure[0][l] ^ measure[1][l]);
433  measure[4][l] = measure[0][l] - measure[1][l];
434  measure[4][l] ^= (measure[4][l]>>1);
435  measure[5][l] = measure[0][l] + measure[1][l];
436  measure[5][l] ^= (measure[4][l]>>1);
437  }
438  for (int l=0; l<2; ++l)
439  {
440  for (int m=0; m<MEASURES; ++m)
441  {
442  counter[m][l] |= measure[m][l];
443  if (~counter[m][l]) {
444  done = 0;
445  }
446  }
447  }
448  if (done) {
449  break;
450  }
451  }
452  if (k == TRIES)
453  {
454  printf("failed %d %d %d\n", h, i, j);
455  failed = true;
456  }
457  else if (k > maxk)
458  {
459  maxk = k;
460  }
461  }
462  }
463  printf("passed for buffer size %d max %d\n", h, maxk);
464  }
465 }
Integral2 random(Integral1 low, Integral2 up)
*than *hazptr_holder h
Definition: Hazptr.h:116
static const int seed
void Init(uint64_t seed)
meter measure([&]{counter=1'000;while(--counter >=0){auto fortyTwo=mi::make_single_sender([](auto out){mi::set_value(out, 42);mi::set_done(out);})|op::get< int >;}return counter;})
#define TRIES
static map< string, int > m
std::atomic< int > counter
static bool failed
#define MEASURES
KeyT k
#define BUFSIZE
uint64_t Value()
void TestPieces ( )

Definition at line 473 of file SpookyHashV2Test.cpp.

References a, b, BUFSIZE, c, failed, i, and uint64_t.

Referenced by TEST().

474 {
475  printf("\ntesting pieces ...\n");
476  char buf[BUFSIZE];
477  for (int i=0; i<BUFSIZE; ++i)
478  {
479  buf[i] = i;
480  }
481  for (int i=0; i<BUFSIZE; ++i)
482  {
483  uint64_t a,b,c,d,seed1=1,seed2=2;
484  SpookyHashV2 state;
485 
486  // all as one call
487  a = seed1;
488  b = seed2;
489  SpookyHashV2::Hash128(buf, i, &a, &b);
490 
491  // all as one piece
492  c = 0xdeadbeefdeadbeef;
493  d = 0xbaceba11baceba11;
494  state.Init(seed1, seed2);
495  state.Update(buf, i);
496  state.Final(&c, &d);
497 
498  if (a != c)
499  {
500  printf("wrong a %d: %.16" PRIx64 " %.16" PRIx64 "\n", i, a,c);
501  failed = true;
502  }
503  if (b != d)
504  {
505  printf("wrong b %d: %.16" PRIx64 " %.16" PRIx64 "\n", i, b,d);
506  failed = true;
507  }
508 
509  // all possible two consecutive pieces
510  for (int j=0; j<i; ++j)
511  {
512  c = seed1;
513  d = seed2;
514  state.Init(c, d);
515  state.Update(&buf[0], j);
516  state.Update(&buf[j], i-j);
517  state.Final(&c, &d);
518  if (a != c)
519  {
520  printf("wrong a %d %d: %.16" PRIx64 " %.16" PRIx64 "\n",
521  j, i, a,c);
522  failed = true;
523  }
524  if (b != d)
525  {
526  printf("wrong b %d %d: %.16" PRIx64 " %.16" PRIx64 "\n",
527  j, i, b,d);
528  failed = true;
529  }
530  }
531  }
532 }
char b
char a
static bool failed
char c
state
Definition: http_parser.c:272
#define BUFSIZE
void TestResults ( )

Definition at line 99 of file SpookyHashV2Test.cpp.

References BUFSIZE, failed, i, uint32_t, uint64_t, and uint8_t.

Referenced by TEST().

100 {
101  printf("\ntesting results ...\n");
102  static const uint64_t expected[BUFSIZE] = {
103  0x6bf50919,0x70de1d26,0xa2b37298,0x35bc5fbf,
104  0x8223b279,0x5bcb315e,0x53fe88a1,0xf9f1a233,
105  0xee193982,0x54f86f29,0xc8772d36,0x9ed60886,
106  0x5f23d1da,0x1ed9f474,0xf2ef0c89,0x83ec01f9,
107  0xf274736c,0x7e9ac0df,0xc7aed250,0xb1015811,
108  0xe23470f5,0x48ac20c4,0xe2ab3cd5,0x608f8363,
109  0xd0639e68,0xc4e8e7ab,0x863c7c5b,0x4ea63579,
110  0x99ae8622,0x170c658b,0x149ba493,0x027bca7c,
111  0xe5cfc8b6,0xce01d9d7,0x11103330,0x5d1f5ed4,
112  0xca720ecb,0xef408aec,0x733b90ec,0x855737a6,
113  0x9856c65f,0x647411f7,0x50777c74,0xf0f1a8b7,
114  0x9d7e55a5,0xc68dd371,0xfc1af2cc,0x75728d0a,
115  0x390e5fdc,0xf389b84c,0xfb0ccf23,0xc95bad0e,
116  0x5b1cb85a,0x6bdae14f,0x6deb4626,0x93047034,
117  0x6f3266c6,0xf529c3bd,0x396322e7,0x3777d042,
118  0x1cd6a5a2,0x197b402e,0xc28d0d2b,0x09c1afb4,
119 
120  0x069c8bb7,0x6f9d4e1e,0xd2621b5c,0xea68108d,
121  0x8660cb8f,0xd61e6de6,0x7fba15c7,0xaacfaa97,
122  0xdb381902,0x4ea22649,0x5d414a1e,0xc3fc5984,
123  0xa0fc9e10,0x347dc51c,0x37545fb6,0x8c84b26b,
124  0xf57efa5d,0x56afaf16,0xb6e1eb94,0x9218536a,
125  0xe3cc4967,0xd3275ef4,0xea63536e,0x6086e499,
126  0xaccadce7,0xb0290d82,0x4ebfd0d6,0x46ccc185,
127  0x2eeb10d3,0x474e3c8c,0x23c84aee,0x3abae1cb,
128  0x1499b81a,0xa2993951,0xeed176ad,0xdfcfe84c,
129  0xde4a961f,0x4af13fe6,0xe0069c42,0xc14de8f5,
130  0x6e02ce8f,0x90d19f7f,0xbca4a484,0xd4efdd63,
131  0x780fd504,0xe80310e3,0x03abbc12,0x90023849,
132  0xd6f6fb84,0xd6b354c5,0x5b8575f0,0x758f14e4,
133  0x450de862,0x90704afb,0x47209a33,0xf226b726,
134  0xf858dab8,0x7c0d6de9,0xb05ce777,0xee5ff2d4,
135  0x7acb6d5c,0x2d663f85,0x41c72a91,0x82356bf2,
136 
137  0x94e948ec,0xd358d448,0xeca7814d,0x78cd7950,
138  0xd6097277,0x97782a5d,0xf43fc6f4,0x105f0a38,
139  0x9e170082,0x4bfe566b,0x4371d25f,0xef25a364,
140  0x698eb672,0x74f850e4,0x4678ff99,0x4a290dc6,
141  0x3918f07c,0x32c7d9cd,0x9f28e0af,0x0d3c5a86,
142  0x7bfc8a45,0xddf0c7e1,0xdeacb86b,0x970b3c5c,
143  0x5e29e199,0xea28346d,0x6b59e71b,0xf8a8a46a,
144  0x862f6ce4,0x3ccb740b,0x08761e9e,0xbfa01e5f,
145  0xf17cfa14,0x2dbf99fb,0x7a0be420,0x06137517,
146  0xe020b266,0xd25bfc61,0xff10ed00,0x42e6be8b,
147  0x029ef587,0x683b26e0,0xb08afc70,0x7c1fd59e,
148  0xbaae9a70,0x98c8c801,0xb6e35a26,0x57083971,
149  0x90a6a680,0x1b44169e,0x1dce237c,0x518e0a59,
150  0xccb11358,0x7b8175fb,0xb8fe701a,0x10d259bb,
151  0xe806ce10,0x9212be79,0x4604ae7b,0x7fa22a84,
152  0xe715b13a,0x0394c3b2,0x11efbbae,0xe13d9e19,
153 
154  0x77e012bd,0x2d05114c,0xaecf2ddd,0xb2a2b4aa,
155  0xb9429546,0x55dce815,0xc89138f8,0x46dcae20,
156  0x1f6f7162,0x0c557ebc,0x5b996932,0xafbbe7e2,
157  0xd2bd5f62,0xff475b9f,0x9cec7108,0xeaddcffb,
158  0x5d751aef,0xf68f7bdf,0xf3f4e246,0x00983fcd,
159  0x00bc82bb,0xbf5fd3e7,0xe80c7e2c,0x187d8b1f,
160  0xefafb9a7,0x8f27a148,0x5c9606a9,0xf2d2be3e,
161  0xe992d13a,0xe4bcd152,0xce40b436,0x63d6a1fc,
162  0xdc1455c4,0x64641e39,0xd83010c9,0x2d535ae0,
163  0x5b748f3e,0xf9a9146b,0x80f10294,0x2859acd4,
164  0x5fc846da,0x56d190e9,0x82167225,0x98e4daba,
165  0xbf7865f3,0x00da7ae4,0x9b7cd126,0x644172f8,
166  0xde40c78f,0xe8803efc,0xdd331a2b,0x48485c3c,
167  0x4ed01ddc,0x9c0b2d9e,0xb1c6e9d7,0xd797d43c,
168  0x274101ff,0x3bf7e127,0x91ebbc56,0x7ffeb321,
169  0x4d42096f,0xd6e9456a,0x0bade318,0x2f40ee0b,
170 
171  0x38cebf03,0x0cbc2e72,0xbf03e704,0x7b3e7a9a,
172  0x8e985acd,0x90917617,0x413895f8,0xf11dde04,
173  0xc66f8244,0xe5648174,0x6c420271,0x2469d463,
174  0x2540b033,0xdc788e7b,0xe4140ded,0x0990630a,
175  0xa54abed4,0x6e124829,0xd940155a,0x1c8836f6,
176  0x38fda06c,0x5207ab69,0xf8be9342,0x774882a8,
177  0x56fc0d7e,0x53a99d6e,0x8241f634,0x9490954d,
178  0x447130aa,0x8cc4a81f,0x0868ec83,0xc22c642d,
179  0x47880140,0xfbff3bec,0x0f531f41,0xf845a667,
180  0x08c15fb7,0x1996cd81,0x86579103,0xe21dd863,
181  0x513d7f97,0x3984a1f1,0xdfcdc5f4,0x97766a5e,
182  0x37e2b1da,0x41441f3f,0xabd9ddba,0x23b755a9,
183  0xda937945,0x103e650e,0x3eef7c8f,0x2760ff8d,
184  0x2493a4cd,0x1d671225,0x3bf4bd4c,0xed6e1728,
185  0xc70e9e30,0x4e05e529,0x928d5aa6,0x164d0220,
186  0xb5184306,0x4bd7efb3,0x63830f11,0xf3a1526c,
187 
188  0xf1545450,0xd41d5df5,0x25a5060d,0x77b368da,
189  0x4fe33c7e,0xeae09021,0xfdb053c4,0x2930f18d,
190  0xd37109ff,0x8511a781,0xc7e7cdd7,0x6aeabc45,
191  0xebbeaeaa,0x9a0c4f11,0xda252cbb,0x5b248f41,
192  0x5223b5eb,0xe32ab782,0x8e6a1c97,0x11d3f454,
193  0x3e05bd16,0x0059001d,0xce13ac97,0xf83b2b4c,
194  0x71db5c9a,0xdc8655a6,0x9e98597b,0x3fcae0a2,
195  0x75e63ccd,0x076c72df,0x4754c6ad,0x26b5627b,
196  0xd818c697,0x998d5f3d,0xe94fc7b2,0x1f49ad1a,
197  0xca7ff4ea,0x9fe72c05,0xfbd0cbbf,0xb0388ceb,
198  0xb76031e3,0xd0f53973,0xfb17907c,0xa4c4c10f,
199  0x9f2d8af9,0xca0e56b0,0xb0d9b689,0xfcbf37a3,
200  0xfede8f7d,0xf836511c,0x744003fc,0x89eba576,
201  0xcfdcf6a6,0xc2007f52,0xaaaf683f,0x62d2f9ca,
202  0xc996f77f,0x77a7b5b3,0x8ba7d0a4,0xef6a0819,
203  0xa0d903c0,0x01b27431,0x58fffd4c,0x4827f45c,
204 
205  0x44eb5634,0xae70edfc,0x591c740b,0x478bf338,
206  0x2f3b513b,0x67bf518e,0x6fef4a0c,0x1e0b6917,
207  0x5ac0edc5,0x2e328498,0x077de7d5,0x5726020b,
208  0x2aeda888,0x45b637ca,0xcf60858d,0x3dc91ae2,
209  0x3e6d5294,0xe6900d39,0x0f634c71,0x827a5fa4,
210  0xc713994b,0x1c363494,0x3d43b615,0xe5fe7d15,
211  0xf6ada4f2,0x472099d5,0x04360d39,0x7f2a71d0,
212  0x88a4f5ff,0x2c28fac5,0x4cd64801,0xfd78dd33,
213  0xc9bdd233,0x21e266cc,0x9bbf419d,0xcbf7d81d,
214  0x80f15f96,0x04242657,0x53fb0f66,0xded11e46,
215  0xf2fdba97,0x8d45c9f1,0x4eeae802,0x17003659,
216  0xb9db81a7,0xe734b1b2,0x9503c54e,0xb7c77c3e,
217  0x271dd0ab,0xd8b906b5,0x0d540ec6,0xf03b86e0,
218  0x0fdb7d18,0x95e261af,0xad9ec04e,0x381f4a64,
219  0xfec798d7,0x09ea20be,0x0ef4ca57,0x1e6195bb,
220  0xfd0da78b,0xcea1653b,0x157d9777,0xf04af50f,
221 
222  0xad7baa23,0xd181714a,0x9bbdab78,0x6c7d1577,
223  0x645eb1e7,0xa0648264,0x35839ca6,0x2287ef45,
224  0x32a64ca3,0x26111f6f,0x64814946,0xb0cddaf1,
225  0x4351c59e,0x1b30471c,0xb970788a,0x30e9f597,
226  0xd7e58df1,0xc6d2b953,0xf5f37cf4,0x3d7c419e,
227  0xf91ecb2d,0x9c87fd5d,0xb22384ce,0x8c7ac51c,
228  0x62c96801,0x57e54091,0x964536fe,0x13d3b189,
229  0x4afd1580,0xeba62239,0xb82ea667,0xae18d43a,
230  0xbef04402,0x1942534f,0xc54bf260,0x3c8267f5,
231  0xa1020ddd,0x112fcc8a,0xde596266,0xe91d0856,
232  0xf300c914,0xed84478e,0x5b65009e,0x4764da16,
233  0xaf8e07a2,0x4088dc2c,0x9a0cad41,0x2c3f179b,
234  0xa67b83f7,0xf27eab09,0xdbe10e28,0xf04c911f,
235  0xd1169f87,0x8e1e4976,0x17f57744,0xe4f5a33f,
236  0x27c2e04b,0x0b7523bd,0x07305776,0xc6be7503,
237  0x918fa7c9,0xaf2e2cd9,0x82046f8e,0xcc1c8250
238  };
239 
240  uint8_t buf[BUFSIZE];
241  uint32_t saw[BUFSIZE];
242  for (int i=0; i<BUFSIZE; ++i)
243  {
244  buf[i] = i+128;
245  saw[i] = SpookyHashV2::Hash32(buf, i, 0);
246  if (saw[i] != expected[i])
247  {
248  printf("%3d: saw 0x%.8x, expected 0x%.8" PRIx64 "\n", i, saw[i],
249  expected[i]);
250  failed = true;
251  }
252  }
253 }
static bool failed
#define BUFSIZE

Variable Documentation

bool failed = false
static

Definition at line 40 of file SpookyHashV2Test.cpp.

Referenced by TEST(), TestAlignment(), TestDeltas(), TestPieces(), and TestResults().