forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbs_array_test.js
158 lines (137 loc) · 3.28 KB
/
bs_array_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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
'use strict';
var Mt = require("./mt.js");
var Block = require("../../lib/js/block.js");
var Js_vector = require("../../lib/js/js_vector.js");
var Caml_array = require("../../lib/js/caml_array.js");
var suites = [/* [] */0];
var test_id = [0];
function eq(loc, x, y) {
test_id[0] = test_id[0] + 1 | 0;
suites[0] = /* :: */[
/* tuple */[
loc + (" id " + test_id[0]),
(function () {
return /* Eq */Block.__(0, [
x,
y
]);
})
],
suites[0]
];
return /* () */0;
}
console.log(/* int array */[
1,
2,
3,
4
].filter((function (x) {
return +(x > 2);
})).map((function (x, i) {
return x + i | 0;
})).reduce((function (x, y) {
return x + y | 0;
}), 0));
function id(x) {
return eq("File \"bs_array_test.ml\", line 21, characters 5-12", Js_vector.toList(Js_vector.ofList(x)), x);
}
eq("File \"bs_array_test.ml\", line 25, characters 5-12", Js_vector.ofList(/* :: */[
1,
/* :: */[
2,
/* :: */[
3,
/* [] */0
]
]
]), /* int array */[
1,
2,
3
]);
eq("File \"bs_array_test.ml\", line 26, characters 6-13", Js_vector.map((function (x) {
return x + 1 | 0;
}), /* int array */[
1,
2,
3
]), /* int array */[
2,
3,
4
]);
eq("File \"bs_array_test.ml\", line 29, characters 5-12", Caml_array.caml_make_vect(5, 3), /* array */[
3,
3,
3,
3,
3
]);
var a = Js_vector.init(5, (function (i) {
return i + 1 | 0;
}));
eq("File \"bs_array_test.ml\", line 31, characters 5-12", (Js_vector.filterInPlace((function (j) {
return +(j % 2 === 0);
}), a), a), /* int array */[
2,
4
]);
var a$1 = Js_vector.init(5, (function (i) {
return i + 1 | 0;
}));
eq("File \"bs_array_test.ml\", line 38, characters 5-12", (Js_vector.filterInPlace((function (j) {
return +(j % 2 !== 0);
}), a$1), a$1), /* int array */[
1,
3,
5
]);
eq("File \"bs_array_test.ml\", line 45, characters 5-12", Js_vector.ofList(/* :: */[
1,
/* :: */[
2,
/* :: */[
3,
/* [] */0
]
]
]), /* int array */[
1,
2,
3
]);
eq("File \"bs_array_test.ml\", line 47, characters 5-12", Js_vector.ofList(/* :: */[
1,
/* [] */0
]), /* int array */[1]);
id(/* [] */0);
id(/* :: */[
1,
/* [] */0
]);
id(/* :: */[
1,
/* :: */[
2,
/* :: */[
3,
/* :: */[
4,
/* :: */[
5,
/* [] */0
]
]
]
]
]);
id(Js_vector.toList(Js_vector.init(100, (function (i) {
return i;
}))));
Mt.from_pair_suites("File \"bs_array_test.ml\", line 55, characters 23-30", suites[0]);
exports.suites = suites;
exports.test_id = test_id;
exports.eq = eq;
exports.id = id;
/* Not a pure module */