-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathhash_test.js
89 lines (75 loc) · 2.05 KB
/
hash_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var Mt = require("./mt.js");
var Char = require("../../lib/js/char.js");
var $$Array = require("../../lib/js/array.js");
var Hashtbl = require("../../lib/js/hashtbl.js");
var Mt_global = require("./mt_global.js");
var Caml_string = require("../../lib/js/caml_string.js");
var suites = {
contents: /* [] */0
};
var test_id = {
contents: 0
};
function eq(f) {
return function (param, param$1) {
return Mt_global.collect_eq(test_id, suites, f, param, param$1);
};
}
var test_strings = $$Array.init(32, (function (i) {
return Caml_string.make(i, Char.chr(i));
}));
var test_strings_hash_results = [
0,
904391063,
889600889,
929588010,
596566298,
365199070,
448044845,
311625091,
681445541,
634941451,
82108334,
17482990,
491949228,
696194769,
711728152,
594966620,
820561748,
958901713,
102794744,
378848504,
349314368,
114167579,
71240932,
110067399,
280623927,
323523937,
310683234,
178511779,
585018975,
544388424,
1043872806,
831138595
];
function normalize(x) {
return x & 1073741823;
}
function caml_hash(x) {
return Hashtbl.hash(x) & 1073741823;
}
Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 44, characters 12-19", $$Array.map(caml_hash, test_strings), test_strings_hash_results);
Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 46, characters 12-19", Hashtbl.hash(0) & 1073741823, 129913994);
Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 48, characters 12-19", Hashtbl.hash("x") & 1073741823, 780510073);
Mt_global.collect_eq(test_id, suites, "File \"hash_test.res\", line 50, characters 12-19", Hashtbl.hash("xy") & 1073741823, 194127723);
Mt.from_pair_suites("Hash_test", suites.contents);
exports.suites = suites;
exports.test_id = test_id;
exports.eq = eq;
exports.test_strings = test_strings;
exports.test_strings_hash_results = test_strings_hash_results;
exports.normalize = normalize;
exports.caml_hash = caml_hash;
/* test_strings Not a pure module */