Skip to content

Commit 2248733

Browse files
Add tests
1 parent 22f71ab commit 2248733

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed

test/FloatTests.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ Test.run([
237237
"clamp - min -infinity, max -infinity"
238238
], Core__Float.clamp(PervasivesU.neg_infinity, PervasivesU.neg_infinity, 4.2), eq, PervasivesU.neg_infinity);
239239

240+
Test.run([
241+
[
242+
"FloatTests.res",
243+
49,
244+
20,
245+
46
246+
],
247+
"Float.equal optimization"
248+
], false, eq, false);
249+
240250
export {
241251
eq ,
242252
}

test/FloatTests.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ Test.run(
4545
eq,
4646
neg_infinity,
4747
)
48+
49+
Test.run(__POS_OF__("Float.equal optimization"), Float.equal(1., 3.), eq, false)

test/IntTests.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@ Test.run([
548548
"clamp - > min, > max"
549549
], Core__Int.clamp(40, 40, 42), eq, 40);
550550

551+
Test.run([
552+
[
553+
"IntTests.res",
554+
170,
555+
20,
556+
44
557+
],
558+
"Int.equal optimization"
559+
], false, eq, false);
560+
551561
export {
552562
eq ,
553563
$$catch ,

test/IntTests.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,5 @@ Test.run(__POS_OF__("clamp - < min, < max"), Int.clamp(~min=50, ~max=60, 42), eq
166166
Test.run(__POS_OF__("clamp - < min, > max"), Int.clamp(~min=50, ~max=40, 42), eq, 50) // min wins
167167
Test.run(__POS_OF__("clamp - > min, < max"), Int.clamp(~min=40, ~max=60, 42), eq, 42)
168168
Test.run(__POS_OF__("clamp - > min, > max"), Int.clamp(~min=40, ~max=40, 42), eq, 40)
169+
170+
Test.run(__POS_OF__("Int.equal optimization"), Int.equal(1, 3), eq, false)

test/StringTests.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Test from "./Test.mjs";
4+
import * as Caml_obj from "rescript/lib/es6/caml_obj.js";
5+
6+
var eq = Caml_obj.equal;
7+
8+
Test.run([
9+
[
10+
"StringTests.res",
11+
5,
12+
20,
13+
47
14+
],
15+
"String.equal optimization"
16+
], false, eq, false);
17+
18+
export {
19+
eq ,
20+
}
21+
/* Not a pure module */

test/StringTests.res

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
open RescriptCore
2+
3+
let eq = (a, b) => a == b
4+
5+
Test.run(__POS_OF__("String.equal optimization"), String.equal("one", "three"), eq, false)

0 commit comments

Comments
 (0)