Advertisement
Guest User

MurmurHash 3 test cases

a guest
Jan 7th, 2022
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.22 KB | None | 0 0
  1. {
  2.   "tests": [
  3.     {
  4.       "input": [],
  5.       "seed": 0,
  6.       "expected": 0,
  7.       "comment": "with zero data and zero seed, everything becomes zero"
  8.     },
  9.     {
  10.       "input": [],
  11.       "seed": 1,
  12.       "expected": 1364076727,
  13.       "comment": "ignores nearly all the math"
  14.     },
  15.     {
  16.       "input": [],
  17.       "seed": 4294967295,
  18.       "expected": 2180083513,
  19.       "comment": "make sure your seed uses unsigned 32-bit math"
  20.     },
  21.     {
  22.       "input": [
  23.         255,
  24.         255,
  25.         255,
  26.         255
  27.       ],
  28.       "seed": 0,
  29.       "expected": 1982413648,
  30.       "comment": "make sure 4-byte chunks use unsigned math"
  31.     },
  32.     {
  33.       "input": [
  34.         33,
  35.         67,
  36.         101,
  37.         135
  38.       ],
  39.       "seed": 0,
  40.       "expected": 4116402539,
  41.       "comment": "Endian order. UInt32 should end up as 0x87654321"
  42.     },
  43.     {
  44.       "input": [
  45.         33,
  46.         67,
  47.         101,
  48.         135
  49.       ],
  50.       "seed": 1350757870,
  51.       "expected": 593689054,
  52.       "comment": "Special seed value eliminates initial key with xor"
  53.     },
  54.     {
  55.       "input": [
  56.         33,
  57.         67,
  58.         101
  59.       ],
  60.       "seed": 0,
  61.       "expected": 2118813236,
  62.       "comment": "Only three bytes. Should end up as 0x654321"
  63.     },
  64.     {
  65.       "input": [
  66.         33,
  67.         67
  68.       ],
  69.       "seed": 0,
  70.       "expected": 2700587130,
  71.       "comment": "Only two bytes. Should end up as 0x4321"
  72.     },
  73.     {
  74.       "input": [
  75.         33
  76.       ],
  77.       "seed": 0,
  78.       "expected": 1919294708,
  79.       "comment": "Only one byte. Should end up as 0x21"
  80.     },
  81.     {
  82.       "input": [
  83.         0,
  84.         0,
  85.         0,
  86.         0
  87.       ],
  88.       "seed": 0,
  89.       "expected": 593689054,
  90.       "comment": "Make sure compiler doesn't see zero and convert to null"
  91.     },
  92.     {
  93.       "input": [
  94.         0,
  95.         0,
  96.         0
  97.       ],
  98.       "seed": 0,
  99.       "expected": 2247144487,
  100.       "comment": null
  101.     },
  102.     {
  103.       "input": [
  104.         0,
  105.         0
  106.       ],
  107.       "seed": 0,
  108.       "expected": 821347078,
  109.       "comment": null
  110.     },
  111.     {
  112.       "input": [
  113.         0
  114.       ],
  115.       "seed": 0,
  116.       "expected": 1364076727,
  117.       "comment": null
  118.     }
  119.   ]
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement