diff --git a/CHANGELOG.md b/CHANGELOG.md index 796a10a892..72db04bdbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ #### :house: Internal - Add dev container. https://github.com/rescript-lang/rescript-compiler/pull/6962 +- Convert more tests to the node test runner. https://github.com/rescript-lang/rescript-compiler/pull/6956 # 12.0.0-alpha.1 @@ -95,7 +96,7 @@ - Remove the transformation of `foo(1,2)` into `Js.Internal.opaqueFullApply(Internal.opaque(f), 1, 2)`, and change the back-end to treat all applications as uncurried. https://github.com/rescript-lang/rescript-compiler/pull/6893 - Remove `@uncurry` from ReScript sources (others, tests). https://github.com/rescript-lang/rescript-compiler/pull/6938 - Remove leftover uncurried handling. https://github.com/rescript-lang/rescript-compiler/pull/6939 https://github.com/rescript-lang/rescript-compiler/pull/6940 -- Use node test runner instead of mocha. https://github.com/rescript-lang/rescript-compiler/pull/6956 +- Start converting tests from mocha to the node test runner. https://github.com/rescript-lang/rescript-compiler/pull/6956 #### :nail_care: Polish diff --git a/jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js b/jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js index 575038f3f6..29777b2f91 100644 --- a/jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js +++ b/jscomp/build_tests/react_ppx/src/gpr_3987_test.bs.js @@ -33,9 +33,7 @@ let Gpr3987ReproOk = { make: make }; -React.createElement(make, makeProps("test", ((param, param$1) => { - -}), undefined)); +React.createElement(make, makeProps("test", (param, param$1) => {}, undefined)); function Gpr_3987_test$Gpr3987ReproOk2(Props) { return null; @@ -47,9 +45,7 @@ let Gpr3987ReproOk2 = { React.createElement(Gpr_3987_test$Gpr3987ReproOk2, { value: "test", - onChange: ((param, param$1) => { - - }) + onChange: (param, param$1) => {} }); function Gpr_3987_test$Gpr3987ReproError(Props) { @@ -62,9 +58,7 @@ let Gpr3987ReproError = { React.createElement(Gpr_3987_test$Gpr3987ReproError, { value: "test", - onChange: ((param, param$1) => { - - }) + onChange: (param, param$1) => {} }); exports.makeContainer = makeContainer; diff --git a/jscomp/test/belt_float_ntest.js b/jscomp/test/belt_float_ntest.js index 701b894b4c..56b319fa82 100644 --- a/jscomp/test/belt_float_ntest.js +++ b/jscomp/test/belt_float_ntest.js @@ -3,49 +3,44 @@ let Nodetest = require("node:test"); let Belt_Float = require("../../lib/js/belt_Float.js"); -let Nodeassert = require("node:assert"); - -function eq(loc, a, b) { - Nodeassert.strictEqual(a, b, loc); -} +let Node_test_util = require("./node_test_util.js"); Nodetest.describe("Belt.Float", () => { Nodetest.test("fromInt", () => { - eq("File \"belt_float_ntest.res\", line 9, characters 7-14", 1, 1.0); - eq("File \"belt_float_ntest.res\", line 10, characters 7-14", -1, -1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 8, characters 7-14", 1, 1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 9, characters 7-14", -1, -1.0); }); Nodetest.test("toInt", () => { - eq("File \"belt_float_ntest.res\", line 14, characters 7-14", 1, 1); - eq("File \"belt_float_ntest.res\", line 15, characters 7-14", 1, 1); - eq("File \"belt_float_ntest.res\", line 16, characters 7-14", 1, 1); - eq("File \"belt_float_ntest.res\", line 17, characters 7-14", -1, -1); - eq("File \"belt_float_ntest.res\", line 18, characters 7-14", -1, -1); - eq("File \"belt_float_ntest.res\", line 19, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 13, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 14, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 15, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 16, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 17, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_float_ntest.res\", line 18, characters 7-14", -1, -1); }); Nodetest.test("fromString", () => { - eq("File \"belt_float_ntest.res\", line 23, characters 7-14", Belt_Float.fromString("1"), 1.0); - eq("File \"belt_float_ntest.res\", line 24, characters 7-14", Belt_Float.fromString("-1"), -1.0); - eq("File \"belt_float_ntest.res\", line 25, characters 7-14", Belt_Float.fromString("1.7"), 1.7); - eq("File \"belt_float_ntest.res\", line 26, characters 7-14", Belt_Float.fromString("-1.0"), -1.0); - eq("File \"belt_float_ntest.res\", line 27, characters 7-14", Belt_Float.fromString("-1.5"), -1.5); - eq("File \"belt_float_ntest.res\", line 28, characters 7-14", Belt_Float.fromString("-1.7"), -1.7); - eq("File \"belt_float_ntest.res\", line 29, characters 7-14", Belt_Float.fromString("not a float"), undefined); + Node_test_util.eq("File \"belt_float_ntest.res\", line 22, characters 7-14", Belt_Float.fromString("1"), 1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 23, characters 7-14", Belt_Float.fromString("-1"), -1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 24, characters 7-14", Belt_Float.fromString("1.7"), 1.7); + Node_test_util.eq("File \"belt_float_ntest.res\", line 25, characters 7-14", Belt_Float.fromString("-1.0"), -1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 26, characters 7-14", Belt_Float.fromString("-1.5"), -1.5); + Node_test_util.eq("File \"belt_float_ntest.res\", line 27, characters 7-14", Belt_Float.fromString("-1.7"), -1.7); + Node_test_util.eq("File \"belt_float_ntest.res\", line 28, characters 7-14", Belt_Float.fromString("not a float"), undefined); }); Nodetest.test("toString", () => { - eq("File \"belt_float_ntest.res\", line 33, characters 7-14", String(1.0), "1"); - eq("File \"belt_float_ntest.res\", line 34, characters 7-14", String(-1.0), "-1"); - eq("File \"belt_float_ntest.res\", line 35, characters 7-14", String(-1.5), "-1.5"); + Node_test_util.eq("File \"belt_float_ntest.res\", line 32, characters 7-14", String(1.0), "1"); + Node_test_util.eq("File \"belt_float_ntest.res\", line 33, characters 7-14", String(-1.0), "-1"); + Node_test_util.eq("File \"belt_float_ntest.res\", line 34, characters 7-14", String(-1.5), "-1.5"); }); Nodetest.test("operators", () => { - eq("File \"belt_float_ntest.res\", line 40, characters 7-14", 2.0 + 3.0, 5.0); - eq("File \"belt_float_ntest.res\", line 41, characters 7-14", 2.0 - 3.0, -1.0); - eq("File \"belt_float_ntest.res\", line 42, characters 7-14", 2.0 * 3.0, 6.0); - eq("File \"belt_float_ntest.res\", line 43, characters 7-14", 3.0 / 2.0, 1.5); + Node_test_util.eq("File \"belt_float_ntest.res\", line 39, characters 7-14", 2.0 + 3.0, 5.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 40, characters 7-14", 2.0 - 3.0, -1.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 41, characters 7-14", 2.0 * 3.0, 6.0); + Node_test_util.eq("File \"belt_float_ntest.res\", line 42, characters 7-14", 3.0 / 2.0, 1.5); }); }); let F; exports.F = F; -exports.eq = eq; /* Not a pure module */ diff --git a/jscomp/test/belt_float_ntest.res b/jscomp/test/belt_float_ntest.res index 1361dfd228..95960a21f5 100644 --- a/jscomp/test/belt_float_ntest.res +++ b/jscomp/test/belt_float_ntest.res @@ -1,9 +1,8 @@ open Node_test +open Node_test_util module F = Belt.Float -let eq = (loc, a, b) => Node_assert.equal(a, b, ~message=loc) - describe("Belt.Float", () => { test("fromInt", () => { eq(__LOC__, F.fromInt(1), 1.0) diff --git a/jscomp/test/belt_hashmap_ntest.js b/jscomp/test/belt_hashmap_ntest.js new file mode 100644 index 0000000000..e4cb0fc1a1 --- /dev/null +++ b/jscomp/test/belt_hashmap_ntest.js @@ -0,0 +1,96 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +let Caml = require("../../lib/js/caml.js"); +let Hashtbl = require("../../lib/js/hashtbl.js"); +let Nodetest = require("node:test"); +let Belt_Array = require("../../lib/js/belt_Array.js"); +let Belt_HashMap = require("../../lib/js/belt_HashMap.js"); +let Belt_SortArray = require("../../lib/js/belt_SortArray.js"); +let Node_test_util = require("./node_test_util.js"); +let Array_data_util = require("./array_data_util.js"); +let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); + +function intEq(x, y) { + return x === y; +} + +let intHash = Hashtbl.hash; + +let cmp = Caml.int_compare; + +let Y = { + hash: intHash, + eq: intEq +}; + +let empty = Belt_internalBucketsType.make(intHash, intEq, 30); + +Nodetest.describe("Belt.HashMap", () => { + Nodetest.test("fromArray", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); + let v = Belt_Array.zip(u, u); + let xx = Belt_HashMap.fromArray(v, Y); + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 21, characters 7-14", xx.size, 91); + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 22, characters 7-14", Belt_SortArray.stableSortBy(Belt_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); + }); + Nodetest.test("mergeMany", () => { + Belt_HashMap.mergeMany(empty, [ + [ + 1, + 1 + ], + [ + 2, + 3 + ], + [ + 3, + 3 + ], + [ + 2, + 2 + ] + ]); + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 27, characters 7-14", Belt_HashMap.get(empty, 2), 2); + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 28, characters 7-14", empty.size, 3); + }); + Nodetest.test("remove", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); + let v = Belt_internalBucketsType.make(intHash, intEq, 40); + Belt_HashMap.mergeMany(v, Belt_Array.zip(u, u)); + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 35, characters 7-14", v.size, 100001); + for (let i = 0; i <= 1000; ++i) { + Belt_HashMap.remove(v, i); + } + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 39, characters 7-14", v.size, 99000); + for (let i$1 = 0; i$1 <= 2000; ++i$1) { + Belt_HashMap.remove(v, i$1); + } + Node_test_util.eq("File \"belt_hashmap_ntest.res\", line 43, characters 7-14", v.size, 98000); + Node_test_util.ok("File \"belt_hashmap_ntest.res\", line 44, characters 7-14", Belt_Array.every(Array_data_util.range(2001, 100000), x => Belt_HashMap.has(v, x))); + }); +}); + +let N; + +let S; + +let I; + +let A; + +let So; + +exports.N = N; +exports.S = S; +exports.I = I; +exports.A = A; +exports.So = So; +exports.intEq = intEq; +exports.intHash = intHash; +exports.cmp = cmp; +exports.Y = Y; +exports.empty = empty; +/* empty Not a pure module */ diff --git a/jscomp/test/belt_hashmap_ntest.res b/jscomp/test/belt_hashmap_ntest.res new file mode 100644 index 0000000000..c240a089ef --- /dev/null +++ b/jscomp/test/belt_hashmap_ntest.res @@ -0,0 +1,46 @@ +open Node_test +open Node_test_util + +module N = Belt.HashMap +module S = Belt.Map.Int +module I = Array_data_util +module A = Belt.Array +module So = Belt.SortArray + +let intEq = (x: int, y) => x == y +let intHash = (x: int) => Hashtbl.hash(x) +let cmp = (x: int, y) => compare(x, y) +module Y = unpack(Belt.Id.hashable(~eq=intEq, ~hash=intHash)) +let empty: N.t = N.make(~id=module(Y), ~hintSize=30) + +describe("Belt.HashMap", () => { + test("fromArray", () => { + let u = A.concat(I.randomRange(30, 100), I.randomRange(40, 120)) + let v = A.zip(u, u) + let xx = N.fromArray(~id=module(Y), v) + eq(__LOC__, N.size(xx), 91) + eq(__LOC__, So.stableSortBy(N.keysToArray(xx), cmp), I.range(30, 120)) + }) + + test("mergeMany", () => { + N.mergeMany(empty, [(1, 1), (2, 3), (3, 3), (2, 2)]) + eq(__LOC__, N.get(empty, 2), Some(2)) + eq(__LOC__, N.size(empty), 3) + }) + + test("remove", () => { + let u = A.concat(I.randomRange(0, 100_000), I.randomRange(0, 100)) + let v = N.make(~id=module(Y), ~hintSize=40) + N.mergeMany(v, A.zip(u, u)) + eq(__LOC__, N.size(v), 100_001) + for i in 0 to 1_000 { + N.remove(v, i) + } + eq(__LOC__, N.size(v), 99_000) + for i in 0 to 2_000 { + N.remove(v, i) + } + eq(__LOC__, N.size(v), 98_000) + ok(__LOC__, A.every(I.range(2_001, 100_000), x => N.has(v, x))) + }) +}) \ No newline at end of file diff --git a/jscomp/test/belt_hashset_int_ntest.js b/jscomp/test/belt_hashset_int_ntest.js new file mode 100644 index 0000000000..39840aab67 --- /dev/null +++ b/jscomp/test/belt_hashset_int_ntest.js @@ -0,0 +1,91 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +let Nodetest = require("node:test"); +let Belt_Array = require("../../lib/js/belt_Array.js"); +let Belt_SetInt = require("../../lib/js/belt_SetInt.js"); +let Node_test_util = require("./node_test_util.js"); +let Array_data_util = require("./array_data_util.js"); +let Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); +let Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); +let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); + +function add(x, y) { + return x + y | 0; +} + +function sum2(h) { + let v = { + contents: 0 + }; + Belt_HashSetInt.forEach(h, x => { + v.contents = v.contents + x | 0; + }); + return v.contents; +} + +Nodetest.describe("Belt.HashSet.Int", () => { + Nodetest.test("fromArray", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); + let v = Belt_HashSetInt.fromArray(u); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 22, characters 7-14", v.size, 91); + let xs = Belt_SetInt.toArray(Belt_SetInt.fromArray(Belt_HashSetInt.toArray(v))); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 24, characters 7-14", xs, Array_data_util.range(30, 120)); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 26, characters 7-14", Belt_HashSetInt.reduce(v, 0, add), 6825); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 27, characters 7-14", sum2(v), 6825); + }); + Nodetest.test("mergeMany", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); + let v = Belt_internalBucketsType.make(undefined, undefined, 40); + Belt_HashSetInt.mergeMany(v, u); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 34, characters 7-14", v.size, 100001); + for (let i = 0; i <= 1000; ++i) { + Belt_HashSetInt.remove(v, i); + } + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 38, characters 7-14", v.size, 99000); + for (let i$1 = 0; i$1 <= 2000; ++i$1) { + Belt_HashSetInt.remove(v, i$1); + } + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 42, characters 7-14", v.size, 98000); + }); + Nodetest.test("stableSortInPlace", () => { + let u0 = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 100000)); + let u1 = Belt_HashSetInt.copy(u0); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 48, characters 7-14", Belt_HashSetInt.toArray(u0), Belt_HashSetInt.toArray(u1)); + for (let i = 0; i <= 2000; ++i) { + Belt_HashSetInt.remove(u1, i); + } + for (let i$1 = 0; i$1 <= 1000; ++i$1) { + Belt_HashSetInt.remove(u0, i$1); + } + let v0 = Belt_Array.concat(Array_data_util.range(0, 1000), Belt_HashSetInt.toArray(u0)); + let v1 = Belt_Array.concat(Array_data_util.range(0, 2000), Belt_HashSetInt.toArray(u1)); + Belt_SortArrayInt.stableSortInPlace(v0); + Belt_SortArrayInt.stableSortInPlace(v1); + Node_test_util.eq("File \"belt_hashset_int_ntest.res\", line 59, characters 7-14", v0, v1); + }); + Nodetest.test("getBucketHistogram", () => { + let h = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 1000000)); + let histo = Belt_HashSetInt.getBucketHistogram(h); + Node_test_util.ok("File \"belt_hashset_int_ntest.res\", line 65, characters 7-14", histo.length <= 10); + }); +}); + +let N; + +let S; + +let I; + +let A; + +let SI; + +exports.N = N; +exports.S = S; +exports.I = I; +exports.A = A; +exports.SI = SI; +exports.add = add; +exports.sum2 = sum2; +/* Not a pure module */ diff --git a/jscomp/test/belt_hashset_int_ntest.res b/jscomp/test/belt_hashset_int_ntest.res new file mode 100644 index 0000000000..53b0385776 --- /dev/null +++ b/jscomp/test/belt_hashset_int_ntest.res @@ -0,0 +1,67 @@ +open Node_test +open Node_test_util + +module N = Belt.HashSet.Int +module S = Belt.Set.Int +module I = Array_data_util +module A = Belt.Array +module SI = Belt.SortArray.Int + +let add = (x, y) => x + y + +let sum2 = h => { + let v = ref(0) + N.forEach(h, x => v := v.contents + x) + v.contents +} + +describe("Belt.HashSet.Int", () => { + test("fromArray", () => { + let u = A.concat(I.randomRange(30, 100), I.randomRange(40, 120)) + let v = N.fromArray(u) + eq(__LOC__, N.size(v), 91) + let xs = S.toArray(S.fromArray(N.toArray(v))) + eq(__LOC__, xs, I.range(30, 120)) + let x = (30 + 120) / 2 * 91 + eq(__LOC__, N.reduce(v, 0, add), x) + eq(__LOC__, sum2(v), x) + }) + + test("mergeMany", () => { + let u = A.concat(I.randomRange(0, 100_000), I.randomRange(0, 100)) + let v = N.make(~hintSize=40) + N.mergeMany(v, u) + eq(__LOC__, N.size(v), 100_001) + for i in 0 to 1_000 { + N.remove(v, i) + } + eq(__LOC__, N.size(v), 99_000) + for i in 0 to 2_000 { + N.remove(v, i) + } + eq(__LOC__, N.size(v), 98_000) + }) + + test("stableSortInPlace", () => { + let u0 = N.fromArray(I.randomRange(0, 100_000)) + let u1 = N.copy(u0) + eq(__LOC__, N.toArray(u0), N.toArray(u1)) + for i in 0 to 2000 { + N.remove(u1, i) + } + for i in 0 to 1000 { + N.remove(u0, i) + } + let v0 = A.concat(I.range(0, 1000), N.toArray(u0)) + let v1 = A.concat(I.range(0, 2000), N.toArray(u1)) + SI.stableSortInPlace(v0) + SI.stableSortInPlace(v1) + eq(__LOC__, v0, v1) + }) + + test("getBucketHistogram", () => { + let h = N.fromArray(I.randomRange(0, 1_000_000)) + let histo = N.getBucketHistogram(h) + ok(__LOC__, A.length(histo) <= 10) + }) +}) diff --git a/jscomp/test/belt_int_ntest.js b/jscomp/test/belt_int_ntest.js index 823f399f5a..76f5247b36 100644 --- a/jscomp/test/belt_int_ntest.js +++ b/jscomp/test/belt_int_ntest.js @@ -3,48 +3,43 @@ let Belt_Int = require("../../lib/js/belt_Int.js"); let Nodetest = require("node:test"); -let Nodeassert = require("node:assert"); - -function eq(loc, a, b) { - Nodeassert.strictEqual(a, b, loc); -} +let Node_test_util = require("./node_test_util.js"); Nodetest.describe("Belt.Int", () => { Nodetest.test("toFloat", () => { - eq("File \"belt_int_ntest.res\", line 9, characters 7-14", 1, 1.0); - eq("File \"belt_int_ntest.res\", line 10, characters 7-14", -1, -1.0); + Node_test_util.eq("File \"belt_int_ntest.res\", line 8, characters 7-14", 1, 1.0); + Node_test_util.eq("File \"belt_int_ntest.res\", line 9, characters 7-14", -1, -1.0); }); Nodetest.test("fromFloat", () => { - eq("File \"belt_int_ntest.res\", line 14, characters 7-14", 1, 1); - eq("File \"belt_int_ntest.res\", line 15, characters 7-14", 1, 1); - eq("File \"belt_int_ntest.res\", line 16, characters 7-14", 1, 1); - eq("File \"belt_int_ntest.res\", line 17, characters 7-14", -1, -1); - eq("File \"belt_int_ntest.res\", line 18, characters 7-14", -1, -1); - eq("File \"belt_int_ntest.res\", line 19, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 13, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 14, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 15, characters 7-14", 1, 1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 16, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 17, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 18, characters 7-14", -1, -1); }); Nodetest.test("fromString", () => { - eq("File \"belt_int_ntest.res\", line 23, characters 7-14", Belt_Int.fromString("1"), 1); - eq("File \"belt_int_ntest.res\", line 24, characters 7-14", Belt_Int.fromString("-1"), -1); - eq("File \"belt_int_ntest.res\", line 25, characters 7-14", Belt_Int.fromString("1.7"), 1); - eq("File \"belt_int_ntest.res\", line 26, characters 7-14", Belt_Int.fromString("-1.0"), -1); - eq("File \"belt_int_ntest.res\", line 27, characters 7-14", Belt_Int.fromString("-1.5"), -1); - eq("File \"belt_int_ntest.res\", line 28, characters 7-14", Belt_Int.fromString("-1.7"), -1); - eq("File \"belt_int_ntest.res\", line 29, characters 7-14", Belt_Int.fromString("not an int"), undefined); + Node_test_util.eq("File \"belt_int_ntest.res\", line 22, characters 7-14", Belt_Int.fromString("1"), 1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 23, characters 7-14", Belt_Int.fromString("-1"), -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 24, characters 7-14", Belt_Int.fromString("1.7"), 1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 25, characters 7-14", Belt_Int.fromString("-1.0"), -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 26, characters 7-14", Belt_Int.fromString("-1.5"), -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 27, characters 7-14", Belt_Int.fromString("-1.7"), -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 28, characters 7-14", Belt_Int.fromString("not an int"), undefined); }); Nodetest.test("toString", () => { - eq("File \"belt_int_ntest.res\", line 33, characters 7-14", String(1), "1"); - eq("File \"belt_int_ntest.res\", line 34, characters 7-14", String(-1), "-1"); + Node_test_util.eq("File \"belt_int_ntest.res\", line 32, characters 7-14", String(1), "1"); + Node_test_util.eq("File \"belt_int_ntest.res\", line 33, characters 7-14", String(-1), "-1"); }); Nodetest.test("operators", () => { - eq("File \"belt_int_ntest.res\", line 40, characters 7-14", 5, 5); - eq("File \"belt_int_ntest.res\", line 41, characters 7-14", -1, -1); - eq("File \"belt_int_ntest.res\", line 42, characters 7-14", 6, 6); - eq("File \"belt_int_ntest.res\", line 43, characters 7-14", 0, 0); + Node_test_util.eq("File \"belt_int_ntest.res\", line 39, characters 7-14", 5, 5); + Node_test_util.eq("File \"belt_int_ntest.res\", line 40, characters 7-14", -1, -1); + Node_test_util.eq("File \"belt_int_ntest.res\", line 41, characters 7-14", 6, 6); + Node_test_util.eq("File \"belt_int_ntest.res\", line 42, characters 7-14", 0, 0); }); }); let I; exports.I = I; -exports.eq = eq; /* Not a pure module */ diff --git a/jscomp/test/belt_int_ntest.res b/jscomp/test/belt_int_ntest.res index ea575d7b71..88a225ea6a 100644 --- a/jscomp/test/belt_int_ntest.res +++ b/jscomp/test/belt_int_ntest.res @@ -1,9 +1,8 @@ open Node_test +open Node_test_util module I = Belt.Int -let eq = (loc, a, b) => Node_assert.equal(a, b, ~message=loc) - describe("Belt.Int", () => { test("toFloat", () => { eq(__LOC__, I.toFloat(1), 1.0) diff --git a/jscomp/test/belt_list_ntest.js b/jscomp/test/belt_list_ntest.js new file mode 100644 index 0000000000..ecdabdd65f --- /dev/null +++ b/jscomp/test/belt_list_ntest.js @@ -0,0 +1,2191 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +let Caml = require("../../lib/js/caml.js"); +let Caml_obj = require("../../lib/js/caml_obj.js"); +let Belt_List = require("../../lib/js/belt_List.js"); +let Nodetest = require("node:test"); +let Belt_Array = require("../../lib/js/belt_Array.js"); +let Node_test_util = require("./node_test_util.js"); + +function sum(xs) { + let v = { + contents: 0 + }; + Belt_List.forEach(xs, x => { + v.contents = v.contents + x | 0; + }); + return v.contents; +} + +function sum2(xs, ys) { + let v = { + contents: 0 + }; + Belt_List.forEach2(xs, ys, (x, y) => { + v.contents = (v.contents + x | 0) + y | 0; + }); + return v.contents; +} + +Nodetest.describe("Belt.List", () => { + Nodetest.test("makeBy", () => { + let u = Belt_List.makeBy(5, i => Math.imul(i, i)); + let f = i => Node_test_util.eq("File \"belt_list_ntest.res\", line 23, characters 20-27", Belt_List.getExn(u, i), Math.imul(i, i)); + for (let i = 0; i <= 4; ++i) { + f(i); + } + Node_test_util.eq("File \"belt_list_ntest.res\", line 27, characters 7-14", Belt_List.map(u, i => i + 1 | 0), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 5, + tl: { + hd: 10, + tl: { + hd: 17, + tl: /* [] */0 + } + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 28, characters 7-14", Belt_List.getBy({ + hd: 1, + tl: { + hd: 4, + tl: { + hd: 3, + tl: { + hd: 2, + tl: /* [] */0 + } + } + } + }, x => x % 2 === 0), 4); + Node_test_util.eq("File \"belt_list_ntest.res\", line 29, characters 7-14", Belt_List.getBy({ + hd: 1, + tl: { + hd: 4, + tl: { + hd: 3, + tl: { + hd: 2, + tl: /* [] */0 + } + } + } + }, x => x % 5 === 0), undefined); + }); + Nodetest.test("flatten", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 34, characters 6-13", Belt_List.flatten({ + hd: { + hd: 1, + tl: /* [] */0 + }, + tl: { + hd: { + hd: 2, + tl: /* [] */0 + }, + tl: { + hd: { + hd: 3, + tl: /* [] */0 + }, + tl: { + hd: /* [] */0, + tl: { + hd: Belt_List.makeBy(4, i => i), + tl: /* [] */0 + } + } + } + } + }), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + } + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 38, characters 7-14", Belt_List.flatten(/* [] */0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 39, characters 7-14", Belt_List.flatten({ + hd: /* [] */0, + tl: { + hd: /* [] */0, + tl: { + hd: { + hd: 2, + tl: /* [] */0 + }, + tl: { + hd: { + hd: 1, + tl: /* [] */0 + }, + tl: { + hd: { + hd: 2, + tl: /* [] */0 + }, + tl: { + hd: /* [] */0, + tl: /* [] */0 + } + } + } + } + } + }), { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } + }); + }); + Nodetest.test("concatMany", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 44, characters 6-13", Belt_List.concatMany([ + { + hd: 1, + tl: /* [] */0 + }, + { + hd: 2, + tl: /* [] */0 + }, + { + hd: 3, + tl: /* [] */0 + }, + /* [] */0, + Belt_List.makeBy(4, i => i) + ]), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + } + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 48, characters 7-14", Belt_List.concatMany([]), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 49, characters 7-14", Belt_List.concatMany([ + /* [] */0, + /* [] */0, + { + hd: 2, + tl: /* [] */0 + }, + { + hd: 1, + tl: /* [] */0 + }, + { + hd: 2, + tl: /* [] */0 + }, + /* [] */0 + ]), { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 50, characters 7-14", Belt_List.concatMany([ + /* [] */0, + /* [] */0, + { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, + { + hd: 1, + tl: /* [] */0 + }, + { + hd: 2, + tl: /* [] */0 + }, + /* [] */0 + ]), { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 51, characters 7-14", Belt_List.concatMany([{ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }]), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }); + }); + Nodetest.test("concat", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 56, characters 6-13", Belt_List.toArray(Belt_List.concat(Belt_List.makeBy(100, i => i), Belt_List.makeBy(100, i => i))), Belt_Array.concat(Belt_Array.makeBy(100, i => i), Belt_Array.makeBy(100, i => i))); + Node_test_util.eq("File \"belt_list_ntest.res\", line 61, characters 7-14", Belt_List.concat({ + hd: 1, + tl: /* [] */0 + }, /* [] */0), { + hd: 1, + tl: /* [] */0 + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 62, characters 7-14", Belt_List.concat(/* [] */0, { + hd: 1, + tl: /* [] */0 + }), { + hd: 1, + tl: /* [] */0 + }); + }); + Nodetest.test("zip", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 66, characters 7-14", Belt_List.zip({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + }), { + hd: [ + 1, + 3 + ], + tl: { + hd: [ + 2, + 4 + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 67, characters 7-14", Belt_List.zip(/* [] */0, { + hd: 1, + tl: /* [] */0 + }), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 68, characters 7-14", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 69, characters 7-14", Belt_List.zip({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, /* [] */0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 70, characters 7-14", Belt_List.zip({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + }), { + hd: [ + 1, + 2 + ], + tl: { + hd: [ + 2, + 3 + ], + tl: { + hd: [ + 3, + 4 + ], + tl: /* [] */0 + } + } + }); + }); + let mod2 = x => x % 2 === 0; + let evenIndex = (_x, i) => i % 2 === 0; + Nodetest.test("partition", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 77, characters 7-14", Belt_List.partition({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + } + } + }, mod2), [ + { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + }, + { + hd: 1, + tl: { + hd: 3, + tl: { + hd: 3, + tl: /* [] */0 + } + } + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 78, characters 7-14", Belt_List.partition({ + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, mod2), [ + { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, + /* [] */0 + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 79, characters 7-14", Belt_List.partition({ + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, x => !mod2(x)), [ + /* [] */0, + { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 80, characters 7-14", Belt_List.partition(/* [] */0, mod2), [ + /* [] */0, + /* [] */0 + ]); + }); + Nodetest.test("unzip", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 84, characters 7-14", Belt_List.unzip(/* [] */0), [ + /* [] */0, + /* [] */0 + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 85, characters 7-14", Belt_List.unzip({ + hd: [ + 1, + 2 + ], + tl: /* [] */0 + }), [ + { + hd: 1, + tl: /* [] */0 + }, + { + hd: 2, + tl: /* [] */0 + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 86, characters 7-14", Belt_List.unzip({ + hd: [ + 1, + 2 + ], + tl: { + hd: [ + 3, + 4 + ], + tl: /* [] */0 + } + }), [ + { + hd: 1, + tl: { + hd: 3, + tl: /* [] */0 + } + }, + { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + ]); + }); + Nodetest.test("filter", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 90, characters 7-14", Belt_List.keep({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, mod2), { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 91, characters 7-14", Belt_List.keep({ + hd: 1, + tl: { + hd: 3, + tl: { + hd: 41, + tl: /* [] */0 + } + } + }, mod2), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 92, characters 7-14", Belt_List.keep(/* [] */0, mod2), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 93, characters 7-14", Belt_List.keep({ + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + } + } + }, mod2), { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + } + } + }); + }); + Nodetest.test("keepWithIndex", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 97, characters 7-14", Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 98, characters 7-14", Belt_List.keepWithIndex({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, evenIndex), { + hd: 1, + tl: { + hd: 3, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 99, characters 7-14", Belt_List.keepWithIndex({ + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: { + hd: 5, + tl: { + hd: 6, + tl: { + hd: 7, + tl: /* [] */0 + } + } + } + } + } + } + } + }, evenIndex), { + hd: 0, + tl: { + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + } + }); + }); + let id = x => x; + Nodetest.test("map", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 105, characters 7-14", Belt_List.map(Belt_List.makeBy(5, id), x => (x << 1)), { + hd: 0, + tl: { + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: { + hd: 8, + tl: /* [] */0 + } + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 106, characters 7-14", Belt_List.map(/* [] */0, id), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 107, characters 7-14", Belt_List.map({ + hd: 1, + tl: /* [] */0 + }, x => -x | 0), { + hd: -1, + tl: /* [] */0 + }); + }); + let add = (a, b) => a + b | 0; + let length_10_id = Belt_List.makeBy(10, id); + let length_8_id = Belt_List.makeBy(8, id); + Nodetest.test("mapWithIndex etc.", () => { + let d = Belt_List.makeBy(10, x => (x << 1)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 120, characters 7-14", Belt_List.zipBy(length_10_id, length_10_id, add), d); + Node_test_util.eq("File \"belt_list_ntest.res\", line 121, characters 7-14", Belt_List.zipBy(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, add), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 122, characters 7-14", Belt_List.zipBy({ + hd: 1, + tl: /* [] */0 + }, /* [] */0, add), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 123, characters 7-14", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 125, characters 6-13", Belt_List.zipBy(length_10_id, length_10_id, add), Belt_List.concat(Belt_List.map(length_8_id, x => (x << 1)), { + hd: 16, + tl: { + hd: 18, + tl: /* [] */0 + } + })); + Node_test_util.eq("File \"belt_list_ntest.res\", line 129, characters 7-14", Belt_List.zipBy(length_10_id, length_8_id, add), Belt_List.mapWithIndex(length_8_id, (i, x) => i + x | 0)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 133, characters 7-14", Belt_List.reverse(Belt_List.mapReverse2(length_10_id, length_10_id, add)), Belt_List.map(length_10_id, x => (x << 1))); + let xs = Belt_List.reverse(Belt_List.mapReverse2(length_8_id, length_10_id, add)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 135, characters 7-14", Belt_List.length(xs), 8); + Node_test_util.eq("File \"belt_list_ntest.res\", line 136, characters 7-14", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 137, characters 7-14", Belt_List.mapReverse2({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, (x, y) => x + y | 0), { + hd: 4, + tl: { + hd: 2, + tl: /* [] */0 + } + }); + }); + Nodetest.test("take", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 141, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, 2), { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 142, characters 7-14", Belt_List.take(/* [] */0, 1), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 143, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 3), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 144, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 2), { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 145, characters 7-14", Belt_List.take(length_10_id, 8), length_8_id); + Node_test_util.eq("File \"belt_list_ntest.res\", line 146, characters 7-14", Belt_List.take(length_10_id, 0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 147, characters 7-14", Belt_List.take(length_8_id, -2), undefined); + }); + Nodetest.test("droo", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 151, characters 7-14", Belt_List.drop(length_10_id, 10), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 152, characters 7-14", Belt_List.drop(length_10_id, 8), { + hd: 8, + tl: { + hd: 9, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 153, characters 7-14", Belt_List.drop(length_10_id, 0), length_10_id); + Node_test_util.eq("File \"belt_list_ntest.res\", line 154, characters 7-14", Belt_List.drop(length_8_id, -1), undefined); + }); + Nodetest.test("splitAt", () => { + let a = Belt_List.makeBy(5, id); + Node_test_util.eq("File \"belt_list_ntest.res\", line 159, characters 7-14", Belt_List.splitAt(/* [] */0, 1), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 160, characters 7-14", Belt_List.splitAt(a, 6), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 161, characters 7-14", Belt_List.splitAt(a, 5), [ + a, + /* [] */0 + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 162, characters 7-14", Belt_List.splitAt(a, 4), [ + { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + } + }, + { + hd: 4, + tl: /* [] */0 + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 163, characters 7-14", Belt_List.splitAt(a, 3), [ + { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } + }, + { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 164, characters 7-14", Belt_List.splitAt(a, 2), [ + { + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, + { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 165, characters 7-14", Belt_List.splitAt(a, 1), [ + { + hd: 0, + tl: /* [] */0 + }, + { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + } + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 166, characters 7-14", Belt_List.splitAt(a, 0), [ + /* [] */0, + a + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 167, characters 7-14", Belt_List.splitAt(a, -1), undefined); + }); + Nodetest.test("removeAssoc", () => { + let eqx = (x, y) => x === y; + Node_test_util.ok("File \"belt_list_ntest.res\", line 173, characters 7-14", Belt_List.hasAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 2, (prim0, prim1) => prim0 === prim1)); + Node_test_util.ok("File \"belt_list_ntest.res\", line 174, characters 7-14", !Belt_List.hasAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 4, (prim0, prim1) => prim0 === prim1)); + Node_test_util.ok("File \"belt_list_ntest.res\", line 175, characters 7-14", Belt_List.hasAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 4, (x, y) => (x + 1 | 0) === y)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 176, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 3, (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 177, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 1, (prim0, prim1) => prim0 === prim1), { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 178, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 2, (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 180, characters 6-13", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 0, (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 185, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 3, eqx), { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 186, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 1, eqx), { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 187, characters 7-14", Belt_List.removeAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 2, eqx), { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 188, characters 7-14", Belt_List.removeAssoc(/* [] */0, 2, eqx), /* [] */0); + let ll = { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }; + let ll0 = Belt_List.removeAssoc(ll, 0, eqx); + Node_test_util.ok("File \"belt_list_ntest.res\", line 191, characters 7-14", ll === ll0); + let ll1 = Belt_List.setAssoc(ll, 2, "22", (prim0, prim1) => prim0 === prim1); + Node_test_util.eq("File \"belt_list_ntest.res\", line 193, characters 7-14", ll1, { + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "22" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }); + let ll2 = Belt_List.setAssoc(ll1, 22, "2", (prim0, prim1) => prim0 === prim1); + Node_test_util.ok("File \"belt_list_ntest.res\", line 195, characters 7-14", Caml_obj.equal(ll2, { + hd: [ + 22, + "2" + ], + tl: ll1 + })); + Node_test_util.ok("File \"belt_list_ntest.res\", line 196, characters 7-14", Belt_List.tailExn(ll2) === ll1); + Node_test_util.ok("File \"belt_list_ntest.res\", line 198, characters 6-13", Caml_obj.equal(Belt_List.setAssoc({ + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 2, + "b" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + }, 2, "x", (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 2, + "x" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + })); + Node_test_util.ok("File \"belt_list_ntest.res\", line 203, characters 6-13", Caml_obj.equal(Belt_List.setAssoc({ + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + }, 2, "2", (prim0, prim1) => prim0 === prim1), { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + })); + Node_test_util.eq("File \"belt_list_ntest.res\", line 206, characters 7-14", Belt_List.setAssoc(/* [] */0, 1, "1", (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: /* [] */0 + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 207, characters 7-14", Belt_List.setAssoc({ + hd: [ + 1, + "2" + ], + tl: /* [] */0 + }, 1, "1", (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: /* [] */0 + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 209, characters 7-14", Belt_List.setAssoc({ + hd: [ + 0, + "0" + ], + tl: { + hd: [ + 1, + "2" + ], + tl: /* [] */0 + } + }, 1, "1", (prim0, prim1) => prim0 === prim1), { + hd: [ + 0, + "0" + ], + tl: { + hd: [ + 1, + "1" + ], + tl: /* [] */0 + } + }); + Node_test_util.ok("File \"belt_list_ntest.res\", line 210, characters 7-14", Caml_obj.equal(Belt_List.getAssoc({ + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 2, + "b" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + }, 2, (prim0, prim1) => prim0 === prim1), "b")); + Node_test_util.ok("File \"belt_list_ntest.res\", line 211, characters 7-14", Belt_List.getAssoc({ + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 2, + "b" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + }, 4, (prim0, prim1) => prim0 === prim1) === undefined); + }); + Nodetest.test("head/tail etc.", () => { + let succx = x => x + 1 | 0; + Node_test_util.eq("File \"belt_list_ntest.res\", line 219, characters 6-13", [ + Belt_List.head(length_10_id), + Belt_List.tail(length_10_id) + ], [ + 0, + Belt_List.drop(length_10_id, 1) + ]); + Node_test_util.eq("File \"belt_list_ntest.res\", line 223, characters 7-14", Belt_List.head(/* [] */0), undefined); + Node_test_util.$$throw("File \"belt_list_ntest.res\", line 224, characters 10-17", () => Belt_List.headExn(/* [] */0)); + Node_test_util.$$throw("File \"belt_list_ntest.res\", line 225, characters 10-17", () => { + Belt_List.tailExn(/* [] */0); + }); + Node_test_util.$$throw("File \"belt_list_ntest.res\", line 226, characters 10-17", () => { + Belt_List.getExn({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, -1); + }); + Node_test_util.$$throw("File \"belt_list_ntest.res\", line 227, characters 10-17", () => { + Belt_List.getExn({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, 2); + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 228, characters 7-14", Belt_List.map({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, i => Belt_List.getExn({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, i)), { + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 229, characters 7-14", Belt_List.headExn({ + hd: 1, + tl: /* [] */0 + }), 1); + Node_test_util.eq("File \"belt_list_ntest.res\", line 230, characters 7-14", Belt_List.tailExn({ + hd: 1, + tl: /* [] */0 + }), /* [] */0); + Belt_List.forEachWithIndex(length_10_id, (i, x) => Node_test_util.eq("File \"belt_list_ntest.res\", line 231, characters 50-57", Belt_List.get(length_10_id, i), x)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 232, characters 7-14", Belt_List.tail(/* [] */0), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 233, characters 7-14", Belt_List.drop(/* [] */0, 3), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 234, characters 7-14", Belt_List.mapWithIndex(/* [] */0, (i, x) => i + x | 0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 235, characters 7-14", Belt_List.get(length_10_id, -1), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 236, characters 7-14", Belt_List.get(length_10_id, 12), undefined); + Node_test_util.eq("File \"belt_list_ntest.res\", line 237, characters 7-14", sum(/* [] */0), 0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 238, characters 7-14", sum(length_10_id), 45); + Node_test_util.eq("File \"belt_list_ntest.res\", line 239, characters 7-14", Belt_List.makeBy(0, id), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 241, characters 6-13", Belt_List.reverse(Belt_List.reverse(length_10_id)), length_10_id); + Node_test_util.eq("File \"belt_list_ntest.res\", line 246, characters 6-13", Belt_List.reverse(Belt_List.reverse(length_8_id)), length_8_id); + Node_test_util.eq("File \"belt_list_ntest.res\", line 250, characters 7-14", Belt_List.reverse(/* [] */0), /* [] */0); + Node_test_util.eq("File \"belt_list_ntest.res\", line 251, characters 7-14", Belt_List.reverse(Belt_List.mapReverse(length_10_id, succx)), Belt_List.map(length_10_id, succx)); + Node_test_util.eq("File \"belt_list_ntest.res\", line 252, characters 7-14", Belt_List.reduce(length_10_id, 0, add), 45); + Node_test_util.eq("File \"belt_list_ntest.res\", line 253, characters 7-14", Belt_List.reduceReverse(length_10_id, 0, add), 45); + Node_test_util.eq("File \"belt_list_ntest.res\", line 254, characters 7-14", Belt_List.reduceReverse(Belt_List.makeBy(10000, i => i), 0, (prim0, prim1) => prim0 + prim1 | 0), 49995000); + Node_test_util.eq("File \"belt_list_ntest.res\", line 257, characters 7-14", sum2(length_10_id, length_10_id), 90); + Node_test_util.eq("File \"belt_list_ntest.res\", line 258, characters 7-14", sum2(length_8_id, length_10_id), 56); + Node_test_util.eq("File \"belt_list_ntest.res\", line 259, characters 7-14", sum2(length_10_id, length_8_id), 56); + Node_test_util.eq("File \"belt_list_ntest.res\", line 260, characters 7-14", Belt_List.reduce2(length_10_id, length_8_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 56); + Node_test_util.eq("File \"belt_list_ntest.res\", line 261, characters 7-14", Belt_List.reduce2({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + }, 0, (a, b, c) => (a + b | 0) + c | 0), 18); + Node_test_util.eq("File \"belt_list_ntest.res\", line 262, characters 7-14", Belt_List.reduceReverse2(length_10_id, length_8_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 56); + Node_test_util.eq("File \"belt_list_ntest.res\", line 263, characters 7-14", Belt_List.reduceReverse2(length_10_id, length_10_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 90); + Node_test_util.eq("File \"belt_list_ntest.res\", line 264, characters 7-14", Belt_List.reduceReverse2({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 0, (acc, x, y) => (acc + x | 0) + y | 0), 6); + Node_test_util.eq("File \"belt_list_ntest.res\", line 265, characters 7-14", Belt_List.every({ + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + }, mod2), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 266, characters 7-14", Belt_List.every({ + hd: 1, + tl: /* [] */0 + }, mod2), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 267, characters 7-14", Belt_List.every(/* [] */0, mod2), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 268, characters 7-14", Belt_List.some({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 5, + tl: /* [] */0 + } + } + }, mod2), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 269, characters 7-14", Belt_List.some({ + hd: 1, + tl: { + hd: 3, + tl: { + hd: 5, + tl: /* [] */0 + } + } + }, mod2), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 270, characters 7-14", Belt_List.some(/* [] */0, mod2), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 271, characters 7-14", Belt_List.has({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, "2", (x, s) => String(x) === s), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 272, characters 7-14", Belt_List.has({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, "0", (x, s) => String(x) === s), false); + Node_test_util.ok("File \"belt_list_ntest.res\", line 274, characters 7-14", Belt_List.reduceReverse({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, 0, (prim0, prim1) => prim0 + prim1 | 0) === 10); + Node_test_util.ok("File \"belt_list_ntest.res\", line 275, characters 7-14", Belt_List.reduceReverse({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, 10, (prim0, prim1) => prim0 - prim1 | 0) === 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 276, characters 7-14", Caml_obj.equal(Belt_List.reduceReverse({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, /* [] */0, Belt_List.add), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + })); + Node_test_util.ok("File \"belt_list_ntest.res\", line 277, characters 7-14", Belt_List.reduce({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, 0, (prim0, prim1) => prim0 + prim1 | 0) === 10); + Node_test_util.ok("File \"belt_list_ntest.res\", line 278, characters 7-14", Belt_List.reduce({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, 10, (prim0, prim1) => prim0 - prim1 | 0) === 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 279, characters 7-14", Caml_obj.equal(Belt_List.reduce({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, /* [] */0, Belt_List.add), { + hd: 4, + tl: { + hd: 3, + tl: { + hd: 2, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + })); + Node_test_util.ok("File \"belt_list_ntest.res\", line 280, characters 7-14", Belt_List.reduceWithIndex({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, 0, (acc, x, i) => (acc + x | 0) + i | 0) === 16); + Node_test_util.ok("File \"belt_list_ntest.res\", line 281, characters 7-14", Belt_List.reduceReverse2({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 6); + let a = Belt_List.makeBy(10000, i => i); + Node_test_util.ok("File \"belt_list_ntest.res\", line 284, characters 6-13", Belt_List.reduceReverse2(a, { + hd: 0, + tl: a + }, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 99980001); + }); + Nodetest.test("every2", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 290, characters 7-14", Belt_List.every2(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 291, characters 7-14", Belt_List.every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 292, characters 7-14", Belt_List.every2({ + hd: 2, + tl: /* [] */0 + }, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 293, characters 7-14", Belt_List.every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } + }, (x, y) => x > y), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 294, characters 7-14", Belt_List.every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 0, + tl: /* [] */0 + } + }, (x, y) => x > y), true); + }); + Nodetest.test("some2", () => { + Node_test_util.eq("File \"belt_list_ntest.res\", line 298, characters 7-14", Belt_List.some2(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 299, characters 7-14", Belt_List.some2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 300, characters 7-14", Belt_List.some2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 301, characters 7-14", Belt_List.some2({ + hd: 0, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } + }, (x, y) => x > y), false); + Node_test_util.eq("File \"belt_list_ntest.res\", line 302, characters 7-14", Belt_List.some2({ + hd: 0, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 3, + tl: { + hd: 2, + tl: /* [] */0 + } + }, (x, y) => x > y), true); + Node_test_util.eq("File \"belt_list_ntest.res\", line 303, characters 7-14", Belt_List.some2({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: -1, + tl: { + hd: -2, + tl: /* [] */0 + } + }, (x, y) => x === y), false); + }); + Nodetest.test("add", () => Node_test_util.eq("File \"belt_list_ntest.res\", line 308, characters 7-14", { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + })); + Nodetest.test("cmp", () => { + Node_test_util.ok("File \"belt_list_ntest.res\", line 312, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + } + }, Caml.int_compare) > 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 313, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, Caml.int_compare) > 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 314, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, Caml.int_compare) < 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 315, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 0, + tl: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } + }, Caml.int_compare) > 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 316, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, Caml.int_compare) === 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 317, characters 7-14", Belt_List.cmp({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, Caml.int_compare) > 0); + }); + Nodetest.test("cmpByLength", () => { + Node_test_util.ok("File \"belt_list_ntest.res\", line 321, characters 7-14", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 322, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: /* [] */0 + }, /* [] */0) > 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 323, characters 7-14", Belt_List.cmpByLength(/* [] */0, { + hd: 1, + tl: /* [] */0 + }) < 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 324, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, { + hd: 1, + tl: /* [] */0 + }) > 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 325, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: /* [] */0 + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }) < 0); + Node_test_util.ok("File \"belt_list_ntest.res\", line 326, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }) === 0); + }); + Nodetest.test("makeBy", () => { + let makeTest = n => Node_test_util.eq("File \"belt_list_ntest.res\", line 330, characters 27-34", Belt_List.make(n, 3), Belt_List.makeBy(n, param => 3)); + makeTest(0); + makeTest(1); + makeTest(2); + makeTest(3); + }); + Nodetest.test("sort", () => { + let cmp = (a, b) => a - b | 0; + Node_test_util.eq("File \"belt_list_ntest.res\", line 340, characters 7-14", Belt_List.sort({ + hd: 5, + tl: { + hd: 4, + tl: { + hd: 3, + tl: { + hd: 2, + tl: /* [] */0 + } + } + } + }, cmp), { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: { + hd: 5, + tl: /* [] */0 + } + } + } + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 341, characters 7-14", Belt_List.sort({ + hd: 3, + tl: { + hd: 9, + tl: { + hd: 37, + tl: { + hd: 3, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + } + }, cmp), { + hd: 1, + tl: { + hd: 3, + tl: { + hd: 3, + tl: { + hd: 9, + tl: { + hd: 37, + tl: /* [] */0 + } + } + } + } + }); + }); + Nodetest.test("eq", () => { + Node_test_util.ok("File \"belt_list_ntest.res\", line 345, characters 7-14", !Belt_List.eq({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, (x, y) => x === y)); + Node_test_util.ok("File \"belt_list_ntest.res\", line 346, characters 7-14", Belt_List.eq({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, (x, y) => x === y)); + Node_test_util.ok("File \"belt_list_ntest.res\", line 347, characters 7-14", !Belt_List.eq({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 4, + tl: /* [] */0 + } + } + }, (x, y) => x === y)); + Node_test_util.ok("File \"belt_list_ntest.res\", line 348, characters 7-14", !Belt_List.eq({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, (prim0, prim1) => prim0 === prim1)); + }); + Nodetest.test("keepMap", () => { + let u0 = Belt_List.makeBy(20, x => x); + let u1 = Belt_List.keepMap(u0, x => { + if (x % 7 === 0) { + return x + 1 | 0; + } + + }); + Node_test_util.eq("File \"belt_list_ntest.res\", line 360, characters 7-14", u1, { + hd: 1, + tl: { + hd: 8, + tl: { + hd: 15, + tl: /* [] */0 + } + } + }); + Node_test_util.ok("File \"belt_list_ntest.res\", line 362, characters 6-13", Caml_obj.equal(Belt_List.keepMap({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, x => { + if (x % 2 === 0) { + return -x | 0; + } + + }), { + hd: -2, + tl: { + hd: -4, + tl: /* [] */0 + } + })); + Node_test_util.ok("File \"belt_list_ntest.res\", line 376, characters 6-13", Belt_List.keepMap({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, x => { + if (x % 5 === 0) { + return x; + } + + }) === /* [] */0); + }); +}); + +let N; + +let A; + +exports.N = N; +exports.A = A; +exports.sum = sum; +exports.sum2 = sum2; +/* Not a pure module */ diff --git a/jscomp/test/belt_list_ntest.res b/jscomp/test/belt_list_ntest.res new file mode 100644 index 0000000000..94dd4cc5d0 --- /dev/null +++ b/jscomp/test/belt_list_ntest.res @@ -0,0 +1,386 @@ +open Node_test +open Node_test_util + +module N = Belt.List +module A = Belt.Array + +let sum = xs => { + let v = ref(0) + N.forEach(xs, x => v := v.contents + x) + v.contents +} + +let sum2 = (xs, ys) => { + let v = ref(0) + N.forEach2(xs, ys, (x, y) => v := v.contents + x + y) + v.contents +} + +describe("Belt.List", () => { + test("makeBy", () => { + let u = N.makeBy(5, i => i * i) + + let f = i => eq(__LOC__, N.getExn(u, i), i * i) + for i in 0 to 4 { + f(i) + } + eq(__LOC__, N.map(u, i => i + 1), list{1, 2, 5, 10, 17}) + eq(__LOC__, N.getBy(list{1, 4, 3, 2}, x => mod(x, 2) == 0), Some(4)) + eq(__LOC__, N.getBy(list{1, 4, 3, 2}, x => mod(x, 5) == 0), None) + }) + + test("flatten", () => { + eq( + __LOC__, + N.flatten(list{list{1}, list{2}, list{3}, list{}, N.makeBy(4, i => i)}) , + list{1, 2, 3, 0, 1, 2, 3}, + ) + eq(__LOC__, N.flatten(list{}), list{}) + eq(__LOC__, N.flatten(list{list{}, list{}, list{2}, list{1}, list{2}, list{}}), list{2, 1, 2}) + }) + + test("concatMany", () => { + eq( + __LOC__, + N.concatMany([list{1}, list{2}, list{3}, list{}, N.makeBy(4, i => i)]), + list{1, 2, 3, 0, 1, 2, 3}, + ) + eq(__LOC__, N.concatMany([]), list{}) + eq(__LOC__, N.concatMany([list{}, list{}, list{2}, list{1}, list{2}, list{}]), list{2, 1, 2}) + eq(__LOC__, N.concatMany([list{}, list{}, list{2, 3}, list{1}, list{2}, list{}]), list{2, 3, 1, 2}) + eq(__LOC__, N.concatMany([list{1, 2, 3}]), list{1, 2, 3}) + }) + + test("concat", () => { + eq( + __LOC__, + N.concat(N.makeBy(100, i => i), N.makeBy(100, i => i))->N.toArray, + A.concat(A.makeBy(100, i => i), A.makeBy(100, i => i)) + ) + + eq(__LOC__, N.concat(list{1}, list{}), list{1}) + eq(__LOC__, N.concat(list{}, list{1}), list{1}) + }) + + test("zip", () => { + eq(__LOC__, N.zip(list{1, 2, 3}, list{3, 4}), list{(1, 3), (2, 4)}) + eq(__LOC__, N.zip(list{}, list{1}), list{}) + eq(__LOC__, N.zip(list{}, list{}), list{}) + eq(__LOC__, N.zip(list{1, 2, 3}, list{}), list{}) + eq(__LOC__, N.zip(list{1, 2, 3}, list{2, 3, 4}), list{(1, 2), (2, 3), (3, 4)}) + }) + + let mod2 = x => mod(x, 2) == 0 + let evenIndex = (_x, i) => mod(i, 2) == 0 + + test("partition", () => { + eq(__LOC__, N.partition(list{1, 2, 3, 2, 3, 4}, mod2), (list{2, 2, 4}, list{1, 3, 3})) + eq(__LOC__, N.partition(list{2, 2, 2, 4}, mod2), (list{2, 2, 2, 4}, list{})) + eq(__LOC__, N.partition(list{2, 2, 2, 4}, x => !mod2(x)), (list{}, list{2, 2, 2, 4})) + eq(__LOC__, N.partition(list{}, mod2), (list{}, list{})) + }) + + test("unzip", () => { + eq(__LOC__, N.unzip(list{}), (list{}, list{})) + eq(__LOC__, N.unzip(list{(1, 2)}), (list{1}, list{2})) + eq(__LOC__, N.unzip(list{(1, 2), (3, 4)}), (list{1, 3}, list{2, 4})) + }) + + test("filter", () => { + eq(__LOC__, N.keep(list{1, 2, 3, 4}, mod2), list{2, 4}) + eq(__LOC__, N.keep(list{1, 3, 41}, mod2), list{}) + eq(__LOC__, N.keep(list{}, mod2), list{}) + eq(__LOC__, N.keep(list{2, 2, 2, 4, 6}, mod2), list{2, 2, 2, 4, 6}) + }) + + test("keepWithIndex", () => { + eq(__LOC__, N.keepWithIndex(list{}, evenIndex), list{}) + eq(__LOC__, N.keepWithIndex(list{1, 2, 3, 4}, evenIndex), list{1, 3}) + eq(__LOC__, N.keepWithIndex(list{0, 1, 2, 3, 4, 5, 6, 7}, evenIndex), list{0, 2, 4, 6}) + }) + + let id: int => int = x => x + + test("map", () => { + eq(__LOC__, N.map(N.makeBy(5, id), x => x * 2), list{0, 2, 4, 6, 8}) + eq(__LOC__, N.map(list{}, id), list{}) + eq(__LOC__, N.map(list{1}, x => -x), list{-1}) + }) + + let add = (a, b) => a + b + let length_10_id = N.makeBy(10, id) + let length_8_id = N.makeBy(8, id) + + test("mapWithIndex etc.", () => { + let b = length_10_id + let c = length_8_id + let d = N.makeBy(10, x => 2 * x) + let map2_add = (x, y) => N.zipBy(x, y, add) + + eq(__LOC__, map2_add(length_10_id, b), d) + eq(__LOC__, map2_add(list{}, list{1}), list{}) + eq(__LOC__, map2_add(list{1}, list{}), list{}) + eq(__LOC__, map2_add(list{}, list{}), list{}) + eq( + __LOC__, + map2_add(length_10_id, b), + N.concat(N.map(c, x => x * 2), list{16, 18}) + ) + eq(__LOC__, + map2_add(length_10_id, length_8_id), + N.mapWithIndex(length_8_id, (i, x) => i + x) + ) + eq(__LOC__, N.reverse(N.mapReverse2(length_10_id, length_10_id, add)), N.map(length_10_id, x => x * 2)) + let xs = N.reverse(N.mapReverse2(length_8_id, length_10_id, add)) + eq(__LOC__, N.length(xs), 8) + eq(__LOC__, xs, N.zipBy(length_10_id, length_8_id, add)) + eq(__LOC__, N.mapReverse2(list{1, 2, 3}, list{1, 2}, (x, y) => x + y), list{4, 2}) + }) + + test("take", () => { + eq(__LOC__, N.take(list{1, 2, 3}, 2), Some(list{1, 2})) + eq(__LOC__, N.take(list{}, 1), None) + eq(__LOC__, N.take(list{1, 2}, 3), None) + eq(__LOC__, N.take(list{1, 2}, 2), Some(list{1, 2})) + eq(__LOC__, N.take(length_10_id, 8), Some(length_8_id)) + eq(__LOC__, N.take(length_10_id, 0), Some(list{})) + eq(__LOC__, N.take(length_8_id, -2), None) + }) + + test("droo", () => { + eq(__LOC__, N.drop(length_10_id, 10), Some(list{})) + eq(__LOC__, N.drop(length_10_id, 8), Some(list{8, 9})) + eq(__LOC__, N.drop(length_10_id, 0), Some(length_10_id)) + eq(__LOC__, N.drop(length_8_id, -1), None) + }) + + test("splitAt", () => { + let a = N.makeBy(5, id) + eq(__LOC__, N.splitAt(list{}, 1), None) + eq(__LOC__, N.splitAt(a, 6), None) + eq(__LOC__, N.splitAt(a, 5), Some(a, list{})) + eq(__LOC__, N.splitAt(a, 4), Some(list{0, 1, 2, 3}, list{4})) + eq(__LOC__, N.splitAt(a, 3), Some(list{0, 1, 2}, list{3, 4})) + eq(__LOC__, N.splitAt(a, 2), Some(list{0, 1}, list{2, 3, 4})) + eq(__LOC__, N.splitAt(a, 1), Some(list{0}, list{1, 2, 3, 4})) + eq(__LOC__, N.splitAt(a, 0), Some(list{}, a)) + eq(__LOC__, N.splitAt(a, -1), None) + }) + + test("removeAssoc", () => { + let eqx = (x, y) => (x: int) == y + + ok(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"=")) + ok(__LOC__, !N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, \"=")) + ok(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, (x, y) => x + 1 == y)) + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, \"="), list{(1, "1"), (2, "2")}) + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, \"="), list{(2, "2"), (3, "3")}) + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"="), list{(1, "1"), (3, "3")}) + eq( + __LOC__, + N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 0, \"="), + list{(1, "1"), (2, "2"), (3, "3")}, + ) + + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, eqx), list{(1, "1"), (2, "2")}) + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, eqx), list{(2, "2"), (3, "3")}) + eq(__LOC__, N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, eqx), list{(1, "1"), (3, "3")}) + eq(__LOC__, N.removeAssoc(list{}, 2, eqx), list{}) + let ll = list{(1, "1"), (2, "2"), (3, "3")} + let ll0 = N.removeAssoc(ll, 0, eqx) + ok(__LOC__, ll === ll0) + let ll1 = N.setAssoc(ll, 2, "22", \"=") + eq(__LOC__, ll1, list{(1, "1"), (2, "22"), (3, "3")}) + let ll2 = N.setAssoc(ll1, 22, "2", \"=") + ok(__LOC__, ll2 == list{(22, "2"), ...ll1}) + ok(__LOC__, N.tailExn(ll2) === ll1) + ok( + __LOC__, + N.setAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 2, "x", \"=") == + list{(1, "a"), (2, "x"), (3, "c")}, + ) + ok( + __LOC__, + N.setAssoc(list{(1, "a"), (3, "c")}, 2, "2", \"=") == list{(2, "2"), (1, "a"), (3, "c")}, + ) + eq(__LOC__, N.setAssoc(list{}, 1, "1", \"="), list{(1, "1")}) + eq(__LOC__, N.setAssoc(list{(1, "2")}, 1, "1", \"="), list{(1, "1")}) + + eq(__LOC__, N.setAssoc(list{(0, "0"), (1, "2")}, 1, "1", \"="), list{(0, "0"), (1, "1")}) + ok(__LOC__, N.getAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 2, \"=") == Some("b")) + ok(__LOC__, N.getAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 4, \"=") == None) + }) + + + test("head/tail etc.", () => { + let succx = x => x + 1 + + eq( + __LOC__, + (N.head(length_10_id), N.tail(length_10_id)), + (Some(0), N.drop(length_10_id, 1)), + ) + eq(__LOC__, N.head(list{}), None) + throw(__LOC__, () => N.headExn(list{})) + throw(__LOC__, () => N.tailExn(list{})->ignore) + throw(__LOC__, () => N.getExn(list{0, 1}, -1)->ignore) + throw(__LOC__, () => N.getExn(list{0, 1}, 2)->ignore) + eq(__LOC__, N.map(list{0, 1}, i => N.getExn(list{0, 1}, i)), list{0, 1}) + eq(__LOC__, N.headExn(list{1}), 1) + eq(__LOC__, N.tailExn(list{1}), list{}) + N.forEachWithIndex(length_10_id, (i, x) => eq(__LOC__, N.get(length_10_id, i), Some(x))) + eq(__LOC__, N.tail(list{}), None) + eq(__LOC__, N.drop(list{}, 3), None) + eq(__LOC__, N.mapWithIndex(list{}, (i, x) => i + x), list{}) + eq(__LOC__, N.get(length_10_id, -1), None) + eq(__LOC__, N.get(length_10_id, 12), None) + eq(__LOC__, sum(list{}), 0) + eq(__LOC__, sum(length_10_id), 45) + eq(__LOC__, N.makeBy(0, id), list{}) + eq( + __LOC__, + N.reverse(N.reverse(length_10_id)), + length_10_id, + ) + eq( + __LOC__, + N.reverse(N.reverse(length_8_id)), + length_8_id, + ) + eq(__LOC__, N.reverse(list{}), list{}) + eq(__LOC__, N.reverse(N.mapReverse(length_10_id, succx)), N.map(length_10_id, succx)) + eq(__LOC__, N.reduce(length_10_id, 0, add), 45) + eq(__LOC__, N.reduceReverse(length_10_id, 0, add), 45) + eq(__LOC__, N.reduceReverse(N.makeBy(10_000, i => i), 0, \"+"), 0 + 9_999 * 5_000) + /* eq __LOC__ + (N.mapRev2 length_10_id length_8_id add ) */ + eq(__LOC__, sum2(length_10_id, length_10_id), 90) + eq(__LOC__, sum2(length_8_id, length_10_id), 56) + eq(__LOC__, sum2(length_10_id, length_8_id), 56) + eq(__LOC__, N.reduce2(length_10_id, length_8_id, 0, (acc, x, y) => acc + x + y), 56) + eq(__LOC__, N.reduce2(list{1, 2, 3}, list{2, 4, 6}, 0, (a, b, c) => a + b + c), 18) + eq(__LOC__, N.reduceReverse2(length_10_id, length_8_id, 0, (acc, x, y) => acc + x + y), 56) + eq(__LOC__, N.reduceReverse2(length_10_id, length_10_id, 0, (acc, x, y) => acc + x + y), 90) + eq(__LOC__, N.reduceReverse2(list{1, 2, 3}, list{1, 2}, 0, (acc, x, y) => acc + x + y), 6) + eq(__LOC__, N.every(list{2, 4, 6}, mod2), true) + eq(__LOC__, N.every(list{1}, mod2), false) + eq(__LOC__, N.every(list{}, mod2), true) + eq(__LOC__, N.some(list{1, 2, 5}, mod2), true) + eq(__LOC__, N.some(list{1, 3, 5}, mod2), false) + eq(__LOC__, N.some(list{}, mod2), false) + eq(__LOC__, N.has(list{1, 2, 3}, "2", (x, s) => string_of_int(x) == s), true) + eq(__LOC__, N.has(list{1, 2, 3}, "0", (x, s) => string_of_int(x) == s), false) + + ok(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, 0, \"+") == 10) + ok(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, 10, \"-") == 0) + ok(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, list{}, N.add) == list{1, 2, 3, 4}) + ok(__LOC__, N.reduce(list{1, 2, 3, 4}, 0, \"+") == 10) + ok(__LOC__, N.reduce(list{1, 2, 3, 4}, 10, \"-") == 0) + ok(__LOC__, N.reduce(list{1, 2, 3, 4}, list{}, N.add) == list{4, 3, 2, 1}) + ok(__LOC__, N.reduceWithIndex(list{1, 2, 3, 4}, 0, (acc, x, i) => acc + x + i) == 16) + ok(__LOC__, N.reduceReverse2(list{1, 2, 3}, list{1, 2}, 0, (acc, x, y) => acc + x + y) == 6) + let a = N.makeBy(10_000, i => i) + ok( + __LOC__, + N.reduceReverse2(a, list{0, ...a}, 0, (acc, x, y) => acc + x + y) == 9_999 * 10_000 - 9999, + ) + }) + + test("every2", () => { + eq(__LOC__, N.every2(list{}, list{1}, (x, y) => x > y), true) + eq(__LOC__, N.every2(list{2, 3}, list{1}, (x, y) => x > y), true) + eq(__LOC__, N.every2(list{2}, list{1}, (x, y) => x > y), true) + eq(__LOC__, N.every2(list{2, 3}, list{1, 4}, (x, y) => x > y), false) + eq(__LOC__, N.every2(list{2, 3}, list{1, 0}, (x, y) => x > y), true) + }) + + test("some2", () => { + eq(__LOC__, N.some2(list{}, list{1}, (x, y) => x > y), false) + eq(__LOC__, N.some2(list{2, 3}, list{1}, (x, y) => x > y), true) + eq(__LOC__, N.some2(list{2, 3}, list{1, 4}, (x, y) => x > y), true) + eq(__LOC__, N.some2(list{0, 3}, list{1, 4}, (x, y) => x > y), false) + eq(__LOC__, N.some2(list{0, 3}, list{3, 2}, (x, y) => x > y), true) + eq(__LOC__, N.some2(list{1, 2, 3}, list{-1, -2}, (x, y) => x == y), false) + }) + + + test("add", () => { + eq(__LOC__, list{}->N.add(3)->N.add(2), list{2, 3}) + }) + + test("cmp", () => { + ok(__LOC__, N.cmp(list{1, 2, 3}, list{0, 1, 2, 3}, compare) > 0) + ok(__LOC__, N.cmp(list{1, 2, 3, 4}, list{1, 2, 3}, compare) > 0) + ok(__LOC__, N.cmp(list{1, 2, 3}, list{1, 2, 3, 4}, compare) < 0) + ok(__LOC__, N.cmp(list{1, 2, 3}, list{0, 1, 2}, (x, y) => compare(x, y)) > 0) + ok(__LOC__, N.cmp(list{1, 2, 3}, list{1, 2, 3}, (x, y) => compare(x, y)) == 0) + ok(__LOC__, N.cmp(list{1, 2, 4}, list{1, 2, 3}, (x, y) => compare(x, y)) > 0) + }) + + test("cmpByLength", () => { + ok(__LOC__, N.cmpByLength(list{}, list{}) == 0) + ok(__LOC__, N.cmpByLength(list{1}, list{}) > 0) + ok(__LOC__, N.cmpByLength(list{}, list{1}) < 0) + ok(__LOC__, N.cmpByLength(list{1, 2}, list{1}) > 0) + ok(__LOC__, N.cmpByLength(list{1}, list{1, 2}) < 0) + ok(__LOC__, N.cmpByLength(list{1, 3}, list{1, 2}) == 0) + }) + + test("makeBy", () => { + let makeTest = n => eq(__LOC__, N.make(n, 3), N.makeBy(n, _ => 3)) + + makeTest(0) + makeTest(1) + makeTest(2) + makeTest(3) + }) + + test("sort", () => { + let cmp = (a, b) => a - b + eq(__LOC__, N.sort(list{5, 4, 3, 2}, cmp), list{2, 3, 4, 5}) + eq(__LOC__, N.sort(list{3, 9, 37, 3, 1}, cmp), list{1, 3, 3, 9, 37}) + }) + + test("eq", () => { + ok(__LOC__, !N.eq(list{1, 2, 3}, list{1, 2}, (x, y) => x == y)) + ok(__LOC__, N.eq(list{1, 2, 3}, list{1, 2, 3}, (x, y) => x == y)) + ok(__LOC__, !N.eq(list{1, 2, 3}, list{1, 2, 4}, (x, y) => x == y)) + ok(__LOC__, !N.eq(list{1, 2, 3}, list{1, 2, 3, 4}, \"=")) + }) + + test("keepMap", () => { + let u0 = N.makeBy(20, x => x) + let u1 = u0->N.keepMap(x => + if mod(x, 7) == 0 { + Some(x + 1) + } else { + None + } + ) + eq(__LOC__, u1, list{1, 8, 15}) + ok( + __LOC__, + { + open N + + list{1, 2, 3, 4}->keepMap(x => + if mod(x, 2) == 0 { + Some(-x) + } else { + None + } + ) == list{-2, -4} + }, + ) + ok( + __LOC__, + N.keepMap(list{1, 2, 3, 4}, x => + if mod(x, 5) == 0 { + Some(x) + } else { + None + } + ) == list{}, + ) + }) +}) diff --git a/jscomp/test/belt_mapint_ntest.js b/jscomp/test/belt_mapint_ntest.js index eac12a4e46..93d3835da2 100644 --- a/jscomp/test/belt_mapint_ntest.js +++ b/jscomp/test/belt_mapint_ntest.js @@ -3,11 +3,7 @@ let Nodetest = require("node:test"); let Belt_MapInt = require("../../lib/js/belt_MapInt.js"); -let Nodeassert = require("node:assert"); - -function ok(loc, a) { - Nodeassert.ok(a, loc); -} +let Node_test_util = require("./node_test_util.js"); Nodetest.describe("Belt.Map.Int", () => { Nodetest.test("set", () => { @@ -16,17 +12,16 @@ Nodetest.describe("Belt.Map.Int", () => { m = Belt_MapInt.set(m, i, i); } for (let i$1 = 0; i$1 <= 999999; ++i$1) { - ok("File \"belt_mapint_ntest.res\", line 18, characters 9-16", Belt_MapInt.get(m, i$1) !== undefined); + Node_test_util.ok("File \"belt_mapint_ntest.res\", line 17, characters 9-16", Belt_MapInt.get(m, i$1) !== undefined); } for (let i$2 = 0; i$2 <= 999999; ++i$2) { m = Belt_MapInt.remove(m, i$2); } - ok("File \"belt_mapint_ntest.res\", line 24, characters 7-14", Belt_MapInt.isEmpty(m)); + Node_test_util.ok("File \"belt_mapint_ntest.res\", line 23, characters 7-14", Belt_MapInt.isEmpty(m)); }); }); let M; -exports.ok = ok; exports.M = M; /* Not a pure module */ diff --git a/jscomp/test/belt_mapint_ntest.res b/jscomp/test/belt_mapint_ntest.res index 12c086a683..61d7528787 100644 --- a/jscomp/test/belt_mapint_ntest.res +++ b/jscomp/test/belt_mapint_ntest.res @@ -1,8 +1,7 @@ @@config({flags: ["-bs-no-cross-module-opt"]}) open Node_test - -let ok = (loc, a) => Node_assert.ok(a, ~message=loc) +open Node_test_util module M = Belt.Map.Int diff --git a/jscomp/test/belt_sortarray_ntest.js b/jscomp/test/belt_sortarray_ntest.js new file mode 100644 index 0000000000..e218b046f4 --- /dev/null +++ b/jscomp/test/belt_sortarray_ntest.js @@ -0,0 +1,344 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +let Nodetest = require("node:test"); +let Belt_Array = require("../../lib/js/belt_Array.js"); +let Belt_Range = require("../../lib/js/belt_Range.js"); +let Belt_SortArray = require("../../lib/js/belt_SortArray.js"); +let Node_test_util = require("./node_test_util.js"); +let Array_data_util = require("./array_data_util.js"); +let Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); + +function cmp(x, y) { + return x - y | 0; +} + +function unions(xs, ys) { + let lenX = xs.length; + let lenY = ys.length; + let o = new Array(lenX + lenY | 0); + let v = Belt_SortArray.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + o.length = v; + return o; +} + +function inters(xs, ys) { + let lenX = xs.length; + let lenY = ys.length; + let o = new Array(lenX); + let v = Belt_SortArray.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + o.length = v; + return o; +} + +function diffs(xs, ys) { + let lenX = xs.length; + let lenY = ys.length; + let o = new Array(lenX); + let v = Belt_SortArray.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); + o.length = v; + return o; +} + +Nodetest.describe("Belt.SortArray", () => { + Nodetest.test("union", () => { + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 38, characters 7-14", unions(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(1, 13)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 39, characters 7-14", unions(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(1, 13)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 40, characters 7-14", unions(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(8, 13)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 41, characters 7-14", unions(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ + 0, + 1, + 2, + 4, + 5, + 6, + 7 + ]); + }); + Nodetest.test("intersect", () => { + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 45, characters 7-14", inters(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(3, 10)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 46, characters 7-14", inters(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(9, 10)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 47, characters 7-14", inters(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(9, 10)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 48, characters 7-14", inters(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), []); + }); + Nodetest.test("diff", () => { + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 52, characters 7-14", diffs(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(1, 2)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 53, characters 7-14", diffs(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(1, 8)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 54, characters 7-14", diffs(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(8, 8)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 55, characters 7-14", diffs(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ + 0, + 1, + 2 + ]); + }); + Nodetest.test("isSorted", () => { + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 59, characters 7-14", Belt_SortArray.isSorted([], cmp)); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 60, characters 7-14", Belt_SortArray.isSorted([0], cmp)); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 61, characters 7-14", Belt_SortArray.isSorted([ + 0, + 1 + ], cmp)); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 62, characters 7-14", !Belt_SortArray.isSorted([ + 1, + 0 + ], cmp)); + }); + Nodetest.test("stableSortInPlaceBy", () => Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 67, characters 6-13", Belt_Range.every(0, 200, i => { + let v = Array_data_util.randomRange(0, i); + Belt_SortArray.stableSortInPlaceBy(v, cmp); + return Belt_SortArray.isSorted(v, cmp); + }))); + Nodetest.test("stableSortInPlaceBy 2", () => { + let u = Array_data_util.randomRange(0, 1000000); + let u1 = u.slice(0); + Belt_SortArray.stableSortInPlaceBy(u, cmp); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 85, characters 7-14", Belt_SortArray.isSorted(u, cmp)); + Belt_SortArrayInt.stableSortInPlace(u1); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 87, characters 7-14", Belt_SortArray.isSorted(u1, cmp)); + }); + Nodetest.test("stableSortInPlaceBy 3", () => { + let u = [ + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 2, + "a" + ] + ]; + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 92, characters 7-14", Belt_SortArray.stableSortBy(u, (param, param$1) => param[0] - param$1[0] | 0), [ + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 2, + "a" + ] + ]); + let u$1 = [ + [ + 1, + "b" + ], + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 2, + "a" + ] + ]; + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 95, characters 6-13", Belt_SortArray.stableSortBy(u$1, (param, param$1) => param[0] - param$1[0] | 0), [ + [ + 1, + "b" + ], + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 2, + "a" + ] + ]); + let u$2 = [ + [ + 1, + "c" + ], + [ + 1, + "b" + ], + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 1, + "c" + ], + [ + 2, + "a" + ] + ]; + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 101, characters 6-13", Belt_SortArray.stableSortBy(u$2, (param, param$1) => param[0] - param$1[0] | 0), [ + [ + 1, + "c" + ], + [ + 1, + "b" + ], + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 1, + "c" + ], + [ + 2, + "a" + ] + ]); + }); + Nodetest.test("binarySearchBy", () => { + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 108, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 3, + 5, + 7 + ], 4, cmp) ^ -1, 2); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 109, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 33, cmp), 4); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 110, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 1, cmp), 0); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 111, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 2, cmp), 1); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 112, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 3, cmp), 2); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 113, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 4, cmp), 3); + let aa = Array_data_util.range(0, 1000); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 115, characters 7-14", Belt_Range.every(0, 1000, i => Belt_SortArray.binarySearchBy(aa, i, cmp) === i)); + let cc = Belt_Array.map(Array_data_util.range(0, 2000), x => (x << 1)); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 118, characters 7-14", Belt_SortArray.binarySearchBy(cc, 5000, cmp) ^ -1, 2001); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 119, characters 7-14", Belt_SortArray.binarySearchBy(cc, -1, cmp) ^ -1, 0); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 120, characters 7-14", Belt_SortArray.binarySearchBy(cc, 0, cmp), 0); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 122, characters 7-14", Belt_SortArray.binarySearchBy(cc, 1, cmp) ^ -1, 1); + Node_test_util.ok("File \"belt_sortarray_ntest.res\", line 124, characters 6-13", Belt_Range.every(0, 1999, i => (Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp) ^ -1) === (i + 1 | 0))); + }); + Nodetest.test("strictlySortedLength", () => { + let lt = (x, y) => x < y; + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 133, characters 7-14", Belt_SortArray.strictlySortedLength([], lt), 0); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 134, characters 7-14", Belt_SortArray.strictlySortedLength([1], lt), 1); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 135, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 1 + ], lt), 1); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 136, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 1, + 2 + ], lt), 1); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 137, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 2 + ], lt), 2); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 138, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 2, + 3, + 4, + 3 + ], lt), 4); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 139, characters 7-14", Belt_SortArray.strictlySortedLength([ + 4, + 4, + 3, + 2, + 1 + ], lt), 1); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 140, characters 7-14", Belt_SortArray.strictlySortedLength([ + 4, + 3, + 2, + 1 + ], lt), -4); + Node_test_util.eq("File \"belt_sortarray_ntest.res\", line 141, characters 7-14", Belt_SortArray.strictlySortedLength([ + 4, + 3, + 2, + 1, + 0 + ], lt), -5); + }); +}); + +let I; + +let R; + +let A; + +let S; + +let SI; + +exports.I = I; +exports.R = R; +exports.A = A; +exports.S = S; +exports.SI = SI; +exports.cmp = cmp; +exports.unions = unions; +exports.inters = inters; +exports.diffs = diffs; +/* Not a pure module */ diff --git a/jscomp/test/belt_sortarray_ntest.res b/jscomp/test/belt_sortarray_ntest.res new file mode 100644 index 0000000000..b67b3d7341 --- /dev/null +++ b/jscomp/test/belt_sortarray_ntest.res @@ -0,0 +1,143 @@ +open Node_test +open Node_test_util + +module I = Array_data_util +module R = Belt.Range +module A = Belt.Array +module S = Belt.SortArray +module SI = Belt.SortArray.Int + +let cmp = (x, y) => x - y + +let unions = (xs, ys) => { + let (lenX, lenY) = (A.length(xs), A.length(ys)) + let o = A.makeUninitializedUnsafe(lenX + lenY) + let v = S.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) + A.truncateToLengthUnsafe(o, v) + o +} + +let inters = (xs, ys) => { + let (lenX, lenY) = (A.length(xs), A.length(ys)) + let o = A.makeUninitializedUnsafe(lenX) + let v = S.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) + A.truncateToLengthUnsafe(o, v) + o +} + +let diffs = (xs, ys) => { + let (lenX, lenY) = (A.length(xs), A.length(ys)) + let o = A.makeUninitializedUnsafe(lenX) + let v = S.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) + A.truncateToLengthUnsafe(o, v) + o +} + +describe("Belt.SortArray", () => { + test("union", () => { + eq(__LOC__, unions(I.range(1, 10), I.range(3, 13)), I.range(1, 13)) + eq(__LOC__, unions(I.range(1, 10), I.range(9, 13)), I.range(1, 13)) + eq(__LOC__, unions(I.range(8, 10), I.range(9, 13)), I.range(8, 13)) + eq(__LOC__, unions(I.range(0, 2), I.range(4, 7)), [0, 1, 2, 4, 5, 6, 7]) + }) + + test("intersect", () => { + eq(__LOC__, inters(I.range(1, 10), I.range(3, 13)), I.range(3, 10)) + eq(__LOC__, inters(I.range(1, 10), I.range(9, 13)), I.range(9, 10)) + eq(__LOC__, inters(I.range(8, 10), I.range(9, 13)), I.range(9, 10)) + eq(__LOC__, inters(I.range(0, 2), I.range(4, 7)), []) + }) + + test("diff", () => { + eq(__LOC__, diffs(I.range(1, 10), I.range(3, 13)), I.range(1, 2)) + eq(__LOC__, diffs(I.range(1, 10), I.range(9, 13)), I.range(1, 8)) + eq(__LOC__, diffs(I.range(8, 10), I.range(9, 13)), I.range(8, 8)) + eq(__LOC__, diffs(I.range(0, 2), I.range(4, 7)), [0, 1, 2]) + }) + + test("isSorted", () => { + ok(__LOC__, S.isSorted([], cmp)) + ok(__LOC__, S.isSorted([0], cmp)) + ok(__LOC__, S.isSorted([0, 1], cmp)) + ok(__LOC__, !S.isSorted([1, 0], cmp)) + }) + + test("stableSortInPlaceBy", () => { + ok( + __LOC__, + R.every( + 0, + 200, + i => { + let v = I.randomRange(0, i) + S.stableSortInPlaceBy(v, cmp) + S.isSorted(v, cmp) + }, + ), + ) + }) + + test("stableSortInPlaceBy 2", () => { + let u = I.randomRange(0, 1_000_000) + let u1 = A.copy(u) + + S.stableSortInPlaceBy(u, cmp) + ok(__LOC__, S.isSorted(u, cmp)) + SI.stableSortInPlace(u1) + ok(__LOC__, S.isSorted(u1, cmp)) + }) + + test("stableSortInPlaceBy 3", () => { + let u = [(1, "a"), (1, "b"), (2, "a")] + eq(__LOC__, S.stableSortBy(u, ((a, _), (b, _)) => a - b), [(1, "a"), (1, "b"), (2, "a")]) + let u = [(1, "b"), (1, "a"), (1, "b"), (2, "a")] + eq( + __LOC__, + S.stableSortBy(u, ((a, _), (b, _)) => a - b), + [(1, "b"), (1, "a"), (1, "b"), (2, "a")], + ) + let u = [(1, "c"), (1, "b"), (1, "a"), (1, "b"), (1, "c"), (2, "a")] + eq( + __LOC__, + S.stableSortBy(u, ((a, _), (b, _)) => a - b), + [(1, "c"), (1, "b"), (1, "a"), (1, "b"), (1, "c"), (2, "a")], + ) + }) + + test("binarySearchBy", () => { + eq(__LOC__, lnot(S.binarySearchBy([1, 3, 5, 7], 4, cmp)), 2) + eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 33, cmp), 4) + eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 1, cmp), 0) + eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 2, cmp), 1) + eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 3, cmp), 2) + eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 4, cmp), 3) + let aa = I.range(0, 1000) + ok(__LOC__, R.every(0, 1000, i => S.binarySearchBy(aa, i, cmp) == i)) + /* 0, 2, 4, ... 4000 */ + let cc = A.map(I.range(0, 2000), x => x * 2) + eq(__LOC__, lnot(S.binarySearchBy(cc, 5000, cmp)), 2001) + eq(__LOC__, lnot(S.binarySearchBy(cc, -1, cmp)), 0) + eq(__LOC__, S.binarySearchBy(cc, 0, cmp), 0) + + eq(__LOC__, lnot(S.binarySearchBy(cc, 1, cmp)), 1) + ok( + __LOC__, + R.every(0, 1999, i => lnot(S.binarySearchBy(cc, 2 * i + 1, cmp)) == i + 1), + /* 1, 3, 5, ... , 3999 */ + ) + }) + + test("strictlySortedLength", () => { + let lt = (x: int, y) => x < y + + eq(__LOC__, S.strictlySortedLength([], lt), 0) + eq(__LOC__, S.strictlySortedLength([1], lt), 1) + eq(__LOC__, S.strictlySortedLength([1, 1], lt), 1) + eq(__LOC__, S.strictlySortedLength([1, 1, 2], lt), 1) + eq(__LOC__, S.strictlySortedLength([1, 2], lt), 2) + eq(__LOC__, S.strictlySortedLength([1, 2, 3, 4, 3], lt), 4) + eq(__LOC__, S.strictlySortedLength([4, 4, 3, 2, 1], lt), 1) + eq(__LOC__, S.strictlySortedLength([4, 3, 2, 1], lt), -4) + eq(__LOC__, S.strictlySortedLength([4, 3, 2, 1, 0], lt), -5) + }) +}) diff --git a/jscomp/test/bs_hashmap_test.js b/jscomp/test/bs_hashmap_test.js deleted file mode 100644 index 62e1d947f6..0000000000 --- a/jscomp/test/bs_hashmap_test.js +++ /dev/null @@ -1,133 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Caml = require("../../lib/js/caml.js"); -let Hashtbl = require("../../lib/js/hashtbl.js"); -let Belt_Array = require("../../lib/js/belt_Array.js"); -let Belt_HashMap = require("../../lib/js/belt_HashMap.js"); -let Belt_SortArray = require("../../lib/js/belt_SortArray.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eqx(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function b(loc, x) { - Mt.bool_suites(test_id, suites, loc, x); -} - -function eq(x, y) { - return x === y; -} - -let hash = Hashtbl.hash; - -let cmp = Caml.int_compare; - -let Y = { - hash: hash, - eq: eq -}; - -let empty = Belt_internalBucketsType.make(hash, eq, 30); - -function add(prim0, prim1) { - return prim0 + prim1 | 0; -} - -Belt_HashMap.mergeMany(empty, [ - [ - 1, - 1 - ], - [ - 2, - 3 - ], - [ - 3, - 3 - ], - [ - 2, - 2 - ] -]); - -eqx("File \"bs_hashmap_test.res\", line 30, characters 6-13", Belt_HashMap.get(empty, 2), 2); - -eqx("File \"bs_hashmap_test.res\", line 31, characters 6-13", empty.size, 3); - -let u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); - -let v = Belt_Array.zip(u, u); - -let xx = Belt_HashMap.fromArray(v, Y); - -eqx("File \"bs_hashmap_test.res\", line 41, characters 6-13", xx.size, 91); - -eqx("File \"bs_hashmap_test.res\", line 42, characters 6-13", Belt_SortArray.stableSortBy(Belt_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); - -let u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - -let v$1 = Belt_internalBucketsType.make(hash, eq, 40); - -Belt_HashMap.mergeMany(v$1, Belt_Array.zip(u$1, u$1)); - -eqx("File \"bs_hashmap_test.res\", line 49, characters 6-13", v$1.size, 100001); - -for (let i = 0; i <= 1000; ++i) { - Belt_HashMap.remove(v$1, i); -} - -eqx("File \"bs_hashmap_test.res\", line 53, characters 6-13", v$1.size, 99000); - -for (let i$1 = 0; i$1 <= 2000; ++i$1) { - Belt_HashMap.remove(v$1, i$1); -} - -eqx("File \"bs_hashmap_test.res\", line 57, characters 6-13", v$1.size, 98000); - -b("File \"bs_hashmap_test.res\", line 58, characters 4-11", Belt_Array.every(Array_data_util.range(2001, 100000), x => Belt_HashMap.has(v$1, x))); - -Mt.from_pair_suites("Bs_hashmap_test", suites.contents); - -let N; - -let S; - -let I; - -let $plus$plus = Belt_Array.concat; - -let A; - -let So; - -exports.suites = suites; -exports.test_id = test_id; -exports.eqx = eqx; -exports.b = b; -exports.N = N; -exports.S = S; -exports.eq = eq; -exports.hash = hash; -exports.cmp = cmp; -exports.Y = Y; -exports.empty = empty; -exports.I = I; -exports.$plus$plus = $plus$plus; -exports.add = add; -exports.A = A; -exports.So = So; -/* empty Not a pure module */ diff --git a/jscomp/test/bs_hashmap_test.res b/jscomp/test/bs_hashmap_test.res deleted file mode 100644 index d525565673..0000000000 --- a/jscomp/test/bs_hashmap_test.res +++ /dev/null @@ -1,61 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) -let eqx = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) -module N = Belt.HashMap -module S = Belt.Map.Int -/* module Y = struct - type t = int - - end */ -let eq = (x: int, y) => x == y -let hash = (x: int) => Hashtbl.hash(x) -let cmp = (x: int, y) => compare(x, y) -module Y = unpack(Belt.Id.hashable(~eq, ~hash)) -let empty: N.t = N.make(~id=module(Y), ~hintSize=30) - -/* -[%bs.hash { - eq : - hash : -}] -*/ - -module I = Array_data_util -let \"++" = Belt.Array.concat -let add = \"+" - -let () = { - N.mergeMany(empty, [(1, 1), (2, 3), (3, 3), (2, 2)]) - eqx(__LOC__, N.get(empty, 2), Some(2)) - eqx(__LOC__, N.size(empty), 3) -} - -module A = Belt.Array -module So = Belt.SortArray - -let () = { - let u = \"++"(I.randomRange(30, 100), I.randomRange(40, 120)) - let v = A.zip(u, u) - let xx = N.fromArray(~id=module(Y), v) - eqx(__LOC__, N.size(xx), 91) - eqx(__LOC__, So.stableSortBy(N.keysToArray(xx), cmp), I.range(30, 120)) -} - -let () = { - let u = \"++"(I.randomRange(0, 100_000), I.randomRange(0, 100)) - let v = N.make(~id=module(Y), ~hintSize=40) - N.mergeMany(v, A.zip(u, u)) - eqx(__LOC__, N.size(v), 100_001) - for i in 0 to 1_000 { - N.remove(v, i) - } - eqx(__LOC__, N.size(v), 99_000) - for i in 0 to 2_000 { - N.remove(v, i) - } - eqx(__LOC__, N.size(v), 98_000) - b(__LOC__, A.every(I.range(2_001, 100_000), x => N.has(v, x))) -} - -Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/bs_hashset_int_test.js b/jscomp/test/bs_hashset_int_test.js deleted file mode 100644 index cb3339dcec..0000000000 --- a/jscomp/test/bs_hashset_int_test.js +++ /dev/null @@ -1,132 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Array = require("../../lib/js/belt_Array.js"); -let Belt_SetInt = require("../../lib/js/belt_SetInt.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_HashSetInt = require("../../lib/js/belt_HashSetInt.js"); -let Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); -let Belt_internalBucketsType = require("../../lib/js/belt_internalBucketsType.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function b(loc, x) { - Mt.bool_suites(test_id, suites, loc, x); -} - -function add(x, y) { - return x + y | 0; -} - -function sum2(h) { - let v = { - contents: 0 - }; - Belt_HashSetInt.forEach(h, x => { - v.contents = v.contents + x | 0; - }); - return v.contents; -} - -let u = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); - -let v = Belt_HashSetInt.fromArray(u); - -eq("File \"bs_hashset_int_test.res\", line 20, characters 5-12", v.size, 91); - -let xs = Belt_SetInt.toArray(Belt_SetInt.fromArray(Belt_HashSetInt.toArray(v))); - -eq("File \"bs_hashset_int_test.res\", line 22, characters 5-12", xs, Array_data_util.range(30, 120)); - -eq("File \"bs_hashset_int_test.res\", line 24, characters 5-12", Belt_HashSetInt.reduce(v, 0, add), 6825); - -eq("File \"bs_hashset_int_test.res\", line 25, characters 5-12", sum2(v), 6825); - -let u$1 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - -let v$1 = Belt_internalBucketsType.make(undefined, undefined, 40); - -Belt_HashSetInt.mergeMany(v$1, u$1); - -eq("File \"bs_hashset_int_test.res\", line 32, characters 5-12", v$1.size, 100001); - -for (let i = 0; i <= 1000; ++i) { - Belt_HashSetInt.remove(v$1, i); -} - -eq("File \"bs_hashset_int_test.res\", line 36, characters 5-12", v$1.size, 99000); - -for (let i$1 = 0; i$1 <= 2000; ++i$1) { - Belt_HashSetInt.remove(v$1, i$1); -} - -eq("File \"bs_hashset_int_test.res\", line 40, characters 5-12", v$1.size, 98000); - -let u0 = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 100000)); - -let u1 = Belt_HashSetInt.copy(u0); - -eq("File \"bs_hashset_int_test.res\", line 49, characters 5-12", Belt_HashSetInt.toArray(u0), Belt_HashSetInt.toArray(u1)); - -for (let i$2 = 0; i$2 <= 2000; ++i$2) { - Belt_HashSetInt.remove(u1, i$2); -} - -for (let i$3 = 0; i$3 <= 1000; ++i$3) { - Belt_HashSetInt.remove(u0, i$3); -} - -let v0 = Belt_Array.concat(Array_data_util.range(0, 1000), Belt_HashSetInt.toArray(u0)); - -let v1 = Belt_Array.concat(Array_data_util.range(0, 2000), Belt_HashSetInt.toArray(u1)); - -Belt_SortArrayInt.stableSortInPlace(v0); - -Belt_SortArrayInt.stableSortInPlace(v1); - -eq("File \"bs_hashset_int_test.res\", line 60, characters 5-12", v0, v1); - -let h = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 1000000)); - -let histo = Belt_HashSetInt.getBucketHistogram(h); - -b("File \"bs_hashset_int_test.res\", line 66, characters 4-11", histo.length <= 10); - -Mt.from_pair_suites("Bs_hashset_int_test", suites.contents); - -let N; - -let S; - -let I; - -let $plus$plus = Belt_Array.concat; - -let A; - -let SI; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.N = N; -exports.S = S; -exports.I = I; -exports.$plus$plus = $plus$plus; -exports.add = add; -exports.sum2 = sum2; -exports.A = A; -exports.SI = SI; -/* u Not a pure module */ diff --git a/jscomp/test/bs_hashset_int_test.res b/jscomp/test/bs_hashset_int_test.res deleted file mode 100644 index ff89644de2..0000000000 --- a/jscomp/test/bs_hashset_int_test.res +++ /dev/null @@ -1,68 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) -module N = Belt.HashSet.Int -module S = Belt.Set.Int - -module I = Array_data_util -let \"++" = Belt.Array.concat -let add = (x, y) => x + y - -let sum2 = h => { - let v = ref(0) - N.forEach(h, x => v := v.contents + x) - v.contents -} -let () = { - let u = \"++"(I.randomRange(30, 100), I.randomRange(40, 120)) - let v = N.fromArray(u) - eq(__LOC__, N.size(v), 91) - let xs = S.toArray(S.fromArray(N.toArray(v))) - eq(__LOC__, xs, I.range(30, 120)) - let x = (30 + 120) / 2 * 91 - eq(__LOC__, N.reduce(v, 0, add), x) - eq(__LOC__, sum2(v), x) -} - -let () = { - let u = \"++"(I.randomRange(0, 100_000), I.randomRange(0, 100)) - let v = N.make(~hintSize=40) - N.mergeMany(v, u) - eq(__LOC__, N.size(v), 100_001) - for i in 0 to 1_000 { - N.remove(v, i) - } - eq(__LOC__, N.size(v), 99_000) - for i in 0 to 2_000 { - N.remove(v, i) - } - eq(__LOC__, N.size(v), 98_000) -} -module A = Belt.Array - -module SI = Belt.SortArray.Int - -let () = { - let u0 = N.fromArray(I.randomRange(0, 100_000)) - let u1 = N.copy(u0) - eq(__LOC__, N.toArray(u0), N.toArray(u1)) - for i in 0 to 2000 { - N.remove(u1, i) - } - for i in 0 to 1000 { - N.remove(u0, i) - } - let v0 = A.concat(I.range(0, 1000), N.toArray(u0)) - let v1 = A.concat(I.range(0, 2000), N.toArray(u1)) - SI.stableSortInPlace(v0) - SI.stableSortInPlace(v1) - eq(__LOC__, v0, v1) -} - -let () = { - let h = N.fromArray(I.randomRange(0, 1_000_000)) - let histo = N.getBucketHistogram(h) - b(__LOC__, A.length(histo) <= 10) -} -let () = Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/bs_list_test.js b/jscomp/test/bs_list_test.js deleted file mode 100644 index f5a308dd12..0000000000 --- a/jscomp/test/bs_list_test.js +++ /dev/null @@ -1,2395 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Caml = require("../../lib/js/caml.js"); -let Caml_obj = require("../../lib/js/caml_obj.js"); -let Belt_List = require("../../lib/js/belt_List.js"); -let Belt_Array = require("../../lib/js/belt_Array.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function b(loc, x) { - Mt.bool_suites(test_id, suites, loc, x); -} - -function $$throw(loc, x) { - Mt.throw_suites(test_id, suites, loc, x); -} - -function sum(xs) { - let v = { - contents: 0 - }; - Belt_List.forEach(xs, x => { - v.contents = v.contents + x | 0; - }); - return v.contents; -} - -function sum2(xs, ys) { - let v = { - contents: 0 - }; - Belt_List.forEach2(xs, ys, (x, y) => { - v.contents = (v.contents + x | 0) + y | 0; - }); - return v.contents; -} - -let u = Belt_List.makeBy(5, i => Math.imul(i, i)); - -function f(i) { - eq("File \"bs_list_test.res\", line 27, characters 18-25", Belt_List.getExn(u, i), Math.imul(i, i)); -} - -for (let i = 0; i <= 4; ++i) { - f(i); -} - -eq("File \"bs_list_test.res\", line 31, characters 5-12", Belt_List.map(u, i => i + 1 | 0), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 5, - tl: { - hd: 10, - tl: { - hd: 17, - tl: /* [] */0 - } - } - } - } -}); - -eq("File \"bs_list_test.res\", line 32, characters 5-12", Belt_List.getBy({ - hd: 1, - tl: { - hd: 4, - tl: { - hd: 3, - tl: { - hd: 2, - tl: /* [] */0 - } - } - } -}, x => x % 2 === 0), 4); - -eq("File \"bs_list_test.res\", line 33, characters 5-12", Belt_List.getBy({ - hd: 1, - tl: { - hd: 4, - tl: { - hd: 3, - tl: { - hd: 2, - tl: /* [] */0 - } - } - } -}, x => x % 5 === 0), undefined); - -eq("FLATTEN", Belt_List.flatten({ - hd: { - hd: 1, - tl: /* [] */0 - }, - tl: { - hd: { - hd: 2, - tl: /* [] */0 - }, - tl: { - hd: { - hd: 3, - tl: /* [] */0 - }, - tl: { - hd: /* [] */0, - tl: { - hd: Belt_List.makeBy(4, i => i), - tl: /* [] */0 - } - } - } - } -}), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - } - } - } - } -}); - -eq("FLATTEN", Belt_List.flatten(/* [] */0), /* [] */0); - -eq("FLATTEN", Belt_List.flatten({ - hd: /* [] */0, - tl: { - hd: /* [] */0, - tl: { - hd: { - hd: 2, - tl: /* [] */0 - }, - tl: { - hd: { - hd: 1, - tl: /* [] */0 - }, - tl: { - hd: { - hd: 2, - tl: /* [] */0 - }, - tl: { - hd: /* [] */0, - tl: /* [] */0 - } - } - } - } - } -}), { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } -}); - -eq("CONCATMANY", Belt_List.concatMany([ - { - hd: 1, - tl: /* [] */0 - }, - { - hd: 2, - tl: /* [] */0 - }, - { - hd: 3, - tl: /* [] */0 - }, - /* [] */0, - Belt_List.makeBy(4, i => i) -]), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - } - } - } - } -}); - -eq("CONCATMANY", Belt_List.concatMany([]), /* [] */0); - -eq("CONCATMANY", Belt_List.concatMany([ - /* [] */0, - /* [] */0, - { - hd: 2, - tl: /* [] */0 - }, - { - hd: 1, - tl: /* [] */0 - }, - { - hd: 2, - tl: /* [] */0 - }, - /* [] */0 -]), { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } -}); - -eq("CONCATMANY", Belt_List.concatMany([ - /* [] */0, - /* [] */0, - { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - }, - { - hd: 1, - tl: /* [] */0 - }, - { - hd: 2, - tl: /* [] */0 - }, - /* [] */0 -]), { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } - } -}); - -eq("CONCATMANY", Belt_List.concatMany([{ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }]), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}); - -eq("File \"bs_list_test.res\", line 66, characters 2-9", Belt_List.toArray(Belt_List.concat(Belt_List.makeBy(100, i => i), Belt_List.makeBy(100, i => i))), Belt_Array.concat(Belt_Array.makeBy(100, i => i), Belt_Array.makeBy(100, i => i))); - -eq("APPEND", Belt_List.concat({ - hd: 1, - tl: /* [] */0 -}, /* [] */0), { - hd: 1, - tl: /* [] */0 -}); - -eq("APPEND", Belt_List.concat(/* [] */0, { - hd: 1, - tl: /* [] */0 -}), { - hd: 1, - tl: /* [] */0 -}); - -eq("ZIP", Belt_List.zip({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } -}), { - hd: [ - 1, - 3 - ], - tl: { - hd: [ - 2, - 4 - ], - tl: /* [] */0 - } -}); - -eq("ZIP", Belt_List.zip(/* [] */0, { - hd: 1, - tl: /* [] */0 -}), /* [] */0); - -eq("ZIP", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); - -eq("ZIP", Belt_List.zip({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, /* [] */0), /* [] */0); - -eq("ZIP", Belt_List.zip({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } -}), { - hd: [ - 1, - 2 - ], - tl: { - hd: [ - 2, - 3 - ], - tl: { - hd: [ - 3, - 4 - ], - tl: /* [] */0 - } - } -}); - -function mod2(x) { - return x % 2 === 0; -} - -function evenIndex(_x, i) { - return i % 2 === 0; -} - -eq("PARTITION", Belt_List.partition({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - } - } -}, mod2), [ - { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } - }, - { - hd: 1, - tl: { - hd: 3, - tl: { - hd: 3, - tl: /* [] */0 - } - } - } -]); - -eq("PARTITION", Belt_List.partition({ - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, mod2), [ - { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - }, - /* [] */0 -]); - -eq("PARTITION", Belt_List.partition({ - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, x => !mod2(x)), [ - /* [] */0, - { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - } -]); - -eq("PARTITION", Belt_List.partition(/* [] */0, mod2), [ - /* [] */0, - /* [] */0 -]); - -eq("UNZIP", Belt_List.unzip(/* [] */0), [ - /* [] */0, - /* [] */0 -]); - -eq("UNZIP", Belt_List.unzip({ - hd: [ - 1, - 2 - ], - tl: /* [] */0 -}), [ - { - hd: 1, - tl: /* [] */0 - }, - { - hd: 2, - tl: /* [] */0 - } -]); - -eq("UNZIP", Belt_List.unzip({ - hd: [ - 1, - 2 - ], - tl: { - hd: [ - 3, - 4 - ], - tl: /* [] */0 - } -}), [ - { - hd: 1, - tl: { - hd: 3, - tl: /* [] */0 - } - }, - { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } -]); - -eq("FILTER", Belt_List.keep({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, mod2), { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } -}); - -eq("FILTER", Belt_List.keep({ - hd: 1, - tl: { - hd: 3, - tl: { - hd: 41, - tl: /* [] */0 - } - } -}, mod2), /* [] */0); - -eq("FILTER", Belt_List.keep(/* [] */0, mod2), /* [] */0); - -eq("FILTER", Belt_List.keep({ - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } - } - } -}, mod2), { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } - } - } -}); - -eq("FILTER2", Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); - -eq("FILTER2", Belt_List.keepWithIndex({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, evenIndex), { - hd: 1, - tl: { - hd: 3, - tl: /* [] */0 - } -}); - -eq("FILTER2", Belt_List.keepWithIndex({ - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: { - hd: 5, - tl: { - hd: 6, - tl: { - hd: 7, - tl: /* [] */0 - } - } - } - } - } - } - } -}, evenIndex), { - hd: 0, - tl: { - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } - } -}); - -function id(x) { - return x; -} - -eq("MAP", Belt_List.map(Belt_List.makeBy(5, id), x => (x << 1)), { - hd: 0, - tl: { - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: { - hd: 8, - tl: /* [] */0 - } - } - } - } -}); - -eq("MAP", Belt_List.map(/* [] */0, id), /* [] */0); - -eq("MAP", Belt_List.map({ - hd: 1, - tl: /* [] */0 -}, x => -x | 0), { - hd: -1, - tl: /* [] */0 -}); - -function add(a, b) { - return a + b | 0; -} - -let length_10_id = Belt_List.makeBy(10, id); - -let length_8_id = Belt_List.makeBy(8, id); - -let d = Belt_List.makeBy(10, x => (x << 1)); - -eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), d); - -eq("MAP2", Belt_List.zipBy(/* [] */0, { - hd: 1, - tl: /* [] */0 -}, add), /* [] */0); - -eq("MAP2", Belt_List.zipBy({ - hd: 1, - tl: /* [] */0 -}, /* [] */0, add), /* [] */0); - -eq("MAP2", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); - -eq("MAP2", Belt_List.zipBy(length_10_id, length_10_id, add), Belt_List.concat(Belt_List.map(length_8_id, x => (x << 1)), { - hd: 16, - tl: { - hd: 18, - tl: /* [] */0 - } -})); - -eq("MAP2", Belt_List.zipBy(length_10_id, length_8_id, add), Belt_List.mapWithIndex(length_8_id, (i, x) => i + x | 0)); - -eq("MAP2", Belt_List.reverse(Belt_List.mapReverse2(length_10_id, length_10_id, add)), Belt_List.map(length_10_id, x => (x << 1))); - -let xs = Belt_List.reverse(Belt_List.mapReverse2(length_8_id, length_10_id, add)); - -eq("File \"bs_list_test.res\", line 163, characters 5-12", Belt_List.length(xs), 8); - -eq("MAP2", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); - -eq("MAP2", Belt_List.mapReverse2({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, (x, y) => x + y | 0), { - hd: 4, - tl: { - hd: 2, - tl: /* [] */0 - } -}); - -eq("TAKE", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, 2), { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}); - -eq("TAKE", Belt_List.take(/* [] */0, 1), undefined); - -eq("TAKE", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, 3), undefined); - -eq("TAKE", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, 2), { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}); - -eq("TAKE", Belt_List.take(length_10_id, 8), length_8_id); - -eq("TAKE", Belt_List.take(length_10_id, 0), /* [] */0); - -eq("TAKE", Belt_List.take(length_8_id, -2), undefined); - -eq("DROP", Belt_List.drop(length_10_id, 10), /* [] */0); - -eq("DROP", Belt_List.drop(length_10_id, 8), { - hd: 8, - tl: { - hd: 9, - tl: /* [] */0 - } -}); - -eq("DROP", Belt_List.drop(length_10_id, 0), length_10_id); - -eq("DROP", Belt_List.drop(length_8_id, -1), undefined); - -let a = Belt_List.makeBy(5, id); - -eq("SPLIT", Belt_List.splitAt(/* [] */0, 1), undefined); - -eq("SPLIT", Belt_List.splitAt(a, 6), undefined); - -eq("SPLIT", Belt_List.splitAt(a, 5), [ - a, - /* [] */0 -]); - -eq("SPLIT", Belt_List.splitAt(a, 4), [ - { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - } - }, - { - hd: 4, - tl: /* [] */0 - } -]); - -eq("SPLIT", Belt_List.splitAt(a, 3), [ - { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } - }, - { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } -]); - -eq("SPLIT", Belt_List.splitAt(a, 2), [ - { - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } - }, - { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -]); - -eq("SPLIT", Belt_List.splitAt(a, 1), [ - { - hd: 0, - tl: /* [] */0 - }, - { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - } -]); - -eq("SPLIT", Belt_List.splitAt(a, 0), [ - /* [] */0, - a -]); - -eq("SPLIT", Belt_List.splitAt(a, -1), undefined); - -function succx(x) { - return x + 1 | 0; -} - -function eqx(x, y) { - return x === y; -} - -b("File \"bs_list_test.res\", line 205, characters 4-11", Belt_List.hasAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 2, (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_list_test.res\", line 206, characters 4-11", !Belt_List.hasAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 4, (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_list_test.res\", line 207, characters 4-11", Belt_List.hasAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 4, (x, y) => (x + 1 | 0) === y)); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 3, (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 1, (prim0, prim1) => prim0 === prim1), { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 2, (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 0, (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 3, eqx), { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 1, eqx), { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}, 2, eqx), { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } -}); - -eq("REMOVEASSOQ", Belt_List.removeAssoc(/* [] */0, 2, eqx), /* [] */0); - -let ll = { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}; - -let ll0 = Belt_List.removeAssoc(ll, 0, eqx); - -b("File \"bs_list_test.res\", line 222, characters 4-11", ll === ll0); - -let ll1 = Belt_List.setAssoc(ll, 2, "22", (prim0, prim1) => prim0 === prim1); - -eq("File \"bs_list_test.res\", line 224, characters 5-12", ll1, { - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "22" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } -}); - -let ll2 = Belt_List.setAssoc(ll1, 22, "2", (prim0, prim1) => prim0 === prim1); - -b("File \"bs_list_test.res\", line 226, characters 4-11", Caml_obj.equal(ll2, { - hd: [ - 22, - "2" - ], - tl: ll1 -})); - -b("File \"bs_list_test.res\", line 227, characters 4-11", Belt_List.tailExn(ll2) === ll1); - -b("File \"bs_list_test.res\", line 229, characters 4-11", Caml_obj.equal(Belt_List.setAssoc({ - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 2, - "b" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } -}, 2, "x", (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 2, - "x" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } -})); - -b("File \"bs_list_test.res\", line 234, characters 4-11", Caml_obj.equal(Belt_List.setAssoc({ - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } -}, 2, "2", (prim0, prim1) => prim0 === prim1), { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } -})); - -eq("File \"bs_list_test.res\", line 237, characters 5-12", Belt_List.setAssoc(/* [] */0, 1, "1", (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: /* [] */0 -}); - -debugger; - -eq("File \"bs_list_test.res\", line 239, characters 5-12", Belt_List.setAssoc({ - hd: [ - 1, - "2" - ], - tl: /* [] */0 -}, 1, "1", (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: /* [] */0 -}); - -eq("File \"bs_list_test.res\", line 241, characters 5-12", Belt_List.setAssoc({ - hd: [ - 0, - "0" - ], - tl: { - hd: [ - 1, - "2" - ], - tl: /* [] */0 - } -}, 1, "1", (prim0, prim1) => prim0 === prim1), { - hd: [ - 0, - "0" - ], - tl: { - hd: [ - 1, - "1" - ], - tl: /* [] */0 - } -}); - -b("File \"bs_list_test.res\", line 242, characters 4-11", Caml_obj.equal(Belt_List.getAssoc({ - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 2, - "b" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } -}, 2, (prim0, prim1) => prim0 === prim1), "b")); - -b("File \"bs_list_test.res\", line 243, characters 4-11", Belt_List.getAssoc({ - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 2, - "b" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } -}, 4, (prim0, prim1) => prim0 === prim1) === undefined); - -eq("File \"bs_list_test.res\", line 248, characters 4-11", [ - Belt_List.head(length_10_id), - Belt_List.tail(length_10_id) -], [ - 0, - Belt_List.drop(length_10_id, 1) -]); - -eq("File \"bs_list_test.res\", line 255, characters 5-12", Belt_List.head(/* [] */0), undefined); - -$$throw("File \"bs_list_test.res\", line 256, characters 8-15", () => Belt_List.headExn(/* [] */0)); - -$$throw("File \"bs_list_test.res\", line 257, characters 8-15", () => { - Belt_List.tailExn(/* [] */0); -}); - -$$throw("File \"bs_list_test.res\", line 258, characters 8-15", () => { - Belt_List.getExn({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } - }, -1); -}); - -$$throw("File \"bs_list_test.res\", line 259, characters 8-15", () => { - Belt_List.getExn({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } - }, 2); -}); - -eq("File \"bs_list_test.res\", line 260, characters 5-12", Belt_List.map({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } -}, i => Belt_List.getExn({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } -}, i)), { - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } -}); - -eq("File \"bs_list_test.res\", line 261, characters 5-12", Belt_List.headExn({ - hd: 1, - tl: /* [] */0 -}), 1); - -eq("File \"bs_list_test.res\", line 262, characters 5-12", Belt_List.tailExn({ - hd: 1, - tl: /* [] */0 -}), /* [] */0); - -Belt_List.forEachWithIndex(length_10_id, (i, x) => eq("File \"bs_list_test.res\", line 263, characters 48-55", Belt_List.get(length_10_id, i), x)); - -eq("File \"bs_list_test.res\", line 264, characters 5-12", Belt_List.tail(/* [] */0), undefined); - -eq("File \"bs_list_test.res\", line 265, characters 5-12", Belt_List.drop(/* [] */0, 3), undefined); - -eq("File \"bs_list_test.res\", line 266, characters 5-12", Belt_List.mapWithIndex(/* [] */0, (i, x) => i + x | 0), /* [] */0); - -eq("File \"bs_list_test.res\", line 267, characters 5-12", Belt_List.get(length_10_id, -1), undefined); - -eq("File \"bs_list_test.res\", line 268, characters 5-12", Belt_List.get(length_10_id, 12), undefined); - -eq("File \"bs_list_test.res\", line 269, characters 5-12", sum(/* [] */0), 0); - -eq("File \"bs_list_test.res\", line 270, characters 5-12", sum(length_10_id), 45); - -eq("File \"bs_list_test.res\", line 271, characters 5-12", Belt_List.makeBy(0, id), /* [] */0); - -eq("File \"bs_list_test.res\", line 273, characters 4-11", Belt_List.reverse(Belt_List.reverse(length_10_id)), length_10_id); - -eq("File \"bs_list_test.res\", line 281, characters 4-11", Belt_List.reverse(Belt_List.reverse(length_8_id)), length_8_id); - -eq("File \"bs_list_test.res\", line 288, characters 5-12", Belt_List.reverse(/* [] */0), /* [] */0); - -eq("File \"bs_list_test.res\", line 289, characters 5-12", Belt_List.reverse(Belt_List.mapReverse(length_10_id, succx)), Belt_List.map(length_10_id, succx)); - -eq("File \"bs_list_test.res\", line 290, characters 5-12", Belt_List.reduce(length_10_id, 0, add), 45); - -eq("File \"bs_list_test.res\", line 291, characters 5-12", Belt_List.reduceReverse(length_10_id, 0, add), 45); - -eq("File \"bs_list_test.res\", line 292, characters 5-12", Belt_List.reduceReverse(Belt_List.makeBy(10000, i => i), 0, (prim0, prim1) => prim0 + prim1 | 0), 49995000); - -eq("File \"bs_list_test.res\", line 295, characters 5-12", sum2(length_10_id, length_10_id), 90); - -eq("File \"bs_list_test.res\", line 296, characters 5-12", sum2(length_8_id, length_10_id), 56); - -eq("File \"bs_list_test.res\", line 297, characters 5-12", sum2(length_10_id, length_8_id), 56); - -eq("File \"bs_list_test.res\", line 298, characters 5-12", Belt_List.reduce2(length_10_id, length_8_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 56); - -eq("File \"bs_list_test.res\", line 299, characters 5-12", Belt_List.reduce2({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } -}, 0, (a, b, c) => (a + b | 0) + c | 0), 18); - -eq("File \"bs_list_test.res\", line 300, characters 5-12", Belt_List.reduceReverse2(length_10_id, length_8_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 56); - -eq("File \"bs_list_test.res\", line 301, characters 5-12", Belt_List.reduceReverse2(length_10_id, length_10_id, 0, (acc, x, y) => (acc + x | 0) + y | 0), 90); - -eq("File \"bs_list_test.res\", line 302, characters 5-12", Belt_List.reduceReverse2({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, 0, (acc, x, y) => (acc + x | 0) + y | 0), 6); - -eq("File \"bs_list_test.res\", line 303, characters 5-12", Belt_List.every({ - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } -}, mod2), true); - -eq("File \"bs_list_test.res\", line 304, characters 5-12", Belt_List.every({ - hd: 1, - tl: /* [] */0 -}, mod2), false); - -eq("File \"bs_list_test.res\", line 305, characters 5-12", Belt_List.every(/* [] */0, mod2), true); - -eq("File \"bs_list_test.res\", line 306, characters 5-12", Belt_List.some({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 5, - tl: /* [] */0 - } - } -}, mod2), true); - -eq("File \"bs_list_test.res\", line 307, characters 5-12", Belt_List.some({ - hd: 1, - tl: { - hd: 3, - tl: { - hd: 5, - tl: /* [] */0 - } - } -}, mod2), false); - -eq("File \"bs_list_test.res\", line 308, characters 5-12", Belt_List.some(/* [] */0, mod2), false); - -eq("File \"bs_list_test.res\", line 309, characters 5-12", Belt_List.has({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, "2", (x, s) => String(x) === s), true); - -eq("File \"bs_list_test.res\", line 310, characters 5-12", Belt_List.has({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, "0", (x, s) => String(x) === s), false); - -b("File \"bs_list_test.res\", line 312, characters 4-11", Belt_List.reduceReverse({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, 0, (prim0, prim1) => prim0 + prim1 | 0) === 10); - -b("File \"bs_list_test.res\", line 313, characters 4-11", Belt_List.reduceReverse({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, 10, (prim0, prim1) => prim0 - prim1 | 0) === 0); - -b("File \"bs_list_test.res\", line 314, characters 4-11", Caml_obj.equal(Belt_List.reduceReverse({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, /* [] */0, Belt_List.add), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -})); - -b("File \"bs_list_test.res\", line 315, characters 4-11", Belt_List.reduce({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, 0, (prim0, prim1) => prim0 + prim1 | 0) === 10); - -b("File \"bs_list_test.res\", line 316, characters 4-11", Belt_List.reduce({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, 10, (prim0, prim1) => prim0 - prim1 | 0) === 0); - -b("File \"bs_list_test.res\", line 317, characters 4-11", Caml_obj.equal(Belt_List.reduce({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, /* [] */0, Belt_List.add), { - hd: 4, - tl: { - hd: 3, - tl: { - hd: 2, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } -})); - -b("File \"bs_list_test.res\", line 318, characters 4-11", Belt_List.reduceWithIndex({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, 0, (acc, x, i) => (acc + x | 0) + i | 0) === 16); - -b("File \"bs_list_test.res\", line 319, characters 4-11", Belt_List.reduceReverse2({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 6); - -let a$1 = Belt_List.makeBy(10000, i => i); - -b("File \"bs_list_test.res\", line 322, characters 4-11", Belt_List.reduceReverse2(a$1, { - hd: 0, - tl: a$1 -}, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 99980001); - -eq("File \"bs_list_test.res\", line 328, characters 5-12", Belt_List.every2(/* [] */0, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 329, characters 5-12", Belt_List.every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 330, characters 5-12", Belt_List.every2({ - hd: 2, - tl: /* [] */0 -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 331, characters 5-12", Belt_List.every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), false); - -eq("File \"bs_list_test.res\", line 332, characters 5-12", Belt_List.every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 0, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 333, characters 5-12", Belt_List.some2(/* [] */0, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), false); - -eq("File \"bs_list_test.res\", line 334, characters 5-12", Belt_List.some2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 335, characters 5-12", Belt_List.some2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 336, characters 5-12", Belt_List.some2({ - hd: 0, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), false); - -eq("File \"bs_list_test.res\", line 337, characters 5-12", Belt_List.some2({ - hd: 0, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 3, - tl: { - hd: 2, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_list_test.res\", line 338, characters 5-12", Belt_List.some2({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: -1, - tl: { - hd: -2, - tl: /* [] */0 - } -}, (x, y) => x === y), false); - -function makeTest(n) { - eq("File \"bs_list_test.res\", line 341, characters 23-30", Belt_List.make(n, 3), Belt_List.makeBy(n, param => 3)); -} - -eq("File \"bs_list_test.res\", line 343, characters 12-19", { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}); - -b("File \"bs_list_test.res\", line 345, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - } -}, Caml.int_compare) > 0); - -b("File \"bs_list_test.res\", line 346, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, Caml.int_compare) > 0); - -b("File \"bs_list_test.res\", line 347, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, Caml.int_compare) < 0); - -b("File \"bs_list_test.res\", line 348, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 0, - tl: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } -}, Caml.int_compare) > 0); - -b("File \"bs_list_test.res\", line 349, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, Caml.int_compare) === 0); - -b("File \"bs_list_test.res\", line 350, characters 4-11", Belt_List.cmp({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, Caml.int_compare) > 0); - -b("File \"bs_list_test.res\", line 351, characters 4-11", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0); - -b("File \"bs_list_test.res\", line 352, characters 4-11", Belt_List.cmpByLength({ - hd: 1, - tl: /* [] */0 -}, /* [] */0) > 0); - -b("File \"bs_list_test.res\", line 353, characters 4-11", Belt_List.cmpByLength(/* [] */0, { - hd: 1, - tl: /* [] */0 -}) < 0); - -b("File \"bs_list_test.res\", line 354, characters 4-11", Belt_List.cmpByLength({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, { - hd: 1, - tl: /* [] */0 -}) > 0); - -b("File \"bs_list_test.res\", line 355, characters 4-11", Belt_List.cmpByLength({ - hd: 1, - tl: /* [] */0 -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}) < 0); - -b("File \"bs_list_test.res\", line 356, characters 4-11", Belt_List.cmpByLength({ - hd: 1, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}) === 0); - -makeTest(0); - -makeTest(1); - -makeTest(2); - -makeTest(3); - -function cmp(a, b) { - return a - b | 0; -} - -eq("SORT", Belt_List.sort({ - hd: 5, - tl: { - hd: 4, - tl: { - hd: 3, - tl: { - hd: 2, - tl: /* [] */0 - } - } - } -}, cmp), { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: { - hd: 5, - tl: /* [] */0 - } - } - } -}); - -eq("SORT", Belt_List.sort({ - hd: 3, - tl: { - hd: 9, - tl: { - hd: 37, - tl: { - hd: 3, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } - } -}, cmp), { - hd: 1, - tl: { - hd: 3, - tl: { - hd: 3, - tl: { - hd: 9, - tl: { - hd: 37, - tl: /* [] */0 - } - } - } - } -}); - -b("File \"bs_list_test.res\", line 374, characters 4-11", !Belt_List.eq({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}, (x, y) => x === y)); - -b("File \"bs_list_test.res\", line 375, characters 4-11", Belt_List.eq({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, (x, y) => x === y)); - -b("File \"bs_list_test.res\", line 376, characters 4-11", !Belt_List.eq({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 4, - tl: /* [] */0 - } - } -}, (x, y) => x === y)); - -b("File \"bs_list_test.res\", line 377, characters 4-11", !Belt_List.eq({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, (prim0, prim1) => prim0 === prim1)); - -let u0 = Belt_List.makeBy(20, x => x); - -let u1 = Belt_List.keepMap(u0, x => { - if (x % 7 === 0) { - return x + 1 | 0; - } - -}); - -eq("File \"bs_list_test.res\", line 388, characters 5-12", u1, { - hd: 1, - tl: { - hd: 8, - tl: { - hd: 15, - tl: /* [] */0 - } - } -}); - -b("File \"bs_list_test.res\", line 390, characters 4-11", Caml_obj.equal(Belt_List.keepMap({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, x => { - if (x % 2 === 0) { - return -x | 0; - } - -}), { - hd: -2, - tl: { - hd: -4, - tl: /* [] */0 - } -})); - -b("File \"bs_list_test.res\", line 404, characters 4-11", Belt_List.keepMap({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } -}, x => { - if (x % 5 === 0) { - return x; - } - -}) === /* [] */0); - -Mt.from_pair_suites("Bs_list_test", suites.contents); - -let N; - -let A; - -let J; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.$$throw = $$throw; -exports.N = N; -exports.A = A; -exports.J = J; -exports.sum = sum; -exports.sum2 = sum2; -exports.mod2 = mod2; -exports.evenIndex = evenIndex; -exports.id = id; -exports.add = add; -exports.length_10_id = length_10_id; -exports.length_8_id = length_8_id; -exports.succx = succx; -exports.makeTest = makeTest; -/* u Not a pure module */ diff --git a/jscomp/test/bs_list_test.res b/jscomp/test/bs_list_test.res deleted file mode 100644 index bf4fe73776..0000000000 --- a/jscomp/test/bs_list_test.res +++ /dev/null @@ -1,414 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) - -let eq = (loc, x, y) => Mt.eq_suites(loc, x, y, ~test_id, ~suites) -let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) -let throw = (loc, x) => Mt.throw_suites(~test_id, ~suites, loc, x) - -/* module N = Belt.LinkList */ -module N = Belt.List -module A = Belt.Array -module J = Js.Json -let sum = xs => { - let v = ref(0) - N.forEach(xs, x => v := v.contents + x) - v.contents -} - -let sum2 = (xs, ys) => { - let v = ref(0) - N.forEach2(xs, ys, (x, y) => v := v.contents + x + y) - v.contents -} -let () = { - let u = N.makeBy(5, i => i * i) - - /* N.checkInvariantInternal u ; */ - let f = i => eq(__LOC__, N.getExn(u, i), i * i) - for i in 0 to 4 { - f(i) - } - eq(__LOC__, N.map(u, i => i + 1), list{1, 2, 5, 10, 17}) - eq(__LOC__, N.getBy(list{1, 4, 3, 2}, x => mod(x, 2) == 0), Some(4)) - eq(__LOC__, N.getBy(list{1, 4, 3, 2}, x => mod(x, 5) == 0), None) -} - -let () = { - let \"=~" = eq("FLATTEN", ...) - - \"=~"( - { - open N - flatten(list{list{1}, list{2}, list{3}, list{}, makeBy(4, i => i)}) - }, - list{1, 2, 3, 0, 1, 2, 3}, - ) - \"=~"(N.flatten(list{}), list{}) - \"=~"(N.flatten(list{list{}, list{}, list{2}, list{1}, list{2}, list{}}), list{2, 1, 2}) -} - -let () = { - let \"=~" = eq("CONCATMANY", ...) - \"=~"( - { - open N - concatMany([list{1}, list{2}, list{3}, list{}, makeBy(4, i => i)]) - }, - list{1, 2, 3, 0, 1, 2, 3}, - ) - \"=~"(N.concatMany([]), list{}) - \"=~"(N.concatMany([list{}, list{}, list{2}, list{1}, list{2}, list{}]), list{2, 1, 2}) - \"=~"(N.concatMany([list{}, list{}, list{2, 3}, list{1}, list{2}, list{}]), list{2, 3, 1, 2}) - \"=~"(N.concatMany([list{1, 2, 3}]), list{1, 2, 3}) -} - -let () = eq( - __LOC__, - { - open N - concat(makeBy(100, i => i), makeBy(100, i => i)) - } |> N.toArray, - { - open A - concat(makeBy(100, i => i), makeBy(100, i => i)) - }, -) -let () = { - let \"=~" = eq("APPEND", ...) - \"=~"(N.concat(list{1}, list{}), list{1}) - \"=~"(N.concat(list{}, list{1}), list{1}) -} - -let () = { - let \"=~" = eq("ZIP", ...) - - \"=~"(N.zip(list{1, 2, 3}, list{3, 4}), list{(1, 3), (2, 4)}) - \"=~"(N.zip(list{}, list{1}), list{}) - \"=~"(N.zip(list{}, list{}), list{}) - \"=~"(N.zip(list{1, 2, 3}, list{}), list{}) - \"=~"(N.zip(list{1, 2, 3}, list{2, 3, 4}), list{(1, 2), (2, 3), (3, 4)}) -} - -let mod2 = x => mod(x, 2) == 0 -let evenIndex = (_x, i) => mod(i, 2) == 0 - -let () = { - let \"=~" = eq("PARTITION", ...) - - \"=~"(N.partition(list{1, 2, 3, 2, 3, 4}, mod2), (list{2, 2, 4}, list{1, 3, 3})) - \"=~"(N.partition(list{2, 2, 2, 4}, mod2), (list{2, 2, 2, 4}, list{})) - \"=~"(N.partition(list{2, 2, 2, 4}, x => !mod2(x)), (list{}, list{2, 2, 2, 4})) - \"=~"(N.partition(list{}, mod2), (list{}, list{})) -} - -let () = { - let \"=~" = eq("UNZIP", ...) - \"=~"(N.unzip(list{}), (list{}, list{})) - \"=~"(N.unzip(list{(1, 2)}), (list{1}, list{2})) - \"=~"(N.unzip(list{(1, 2), (3, 4)}), (list{1, 3}, list{2, 4})) -} - -let () = { - let \"=~" = eq("FILTER", ...) - \"=~"(N.keep(list{1, 2, 3, 4}, mod2), list{2, 4}) - \"=~"(N.keep(list{1, 3, 41}, mod2), list{}) - \"=~"(N.keep(list{}, mod2), list{}) - \"=~"(N.keep(list{2, 2, 2, 4, 6}, mod2), list{2, 2, 2, 4, 6}) -} - -let () = { - let \"=~" = eq("FILTER2", ...) - \"=~"(N.keepWithIndex(list{}, evenIndex), list{}) - \"=~"(N.keepWithIndex(list{1, 2, 3, 4}, evenIndex), list{1, 3}) - \"=~"(N.keepWithIndex(list{0, 1, 2, 3, 4, 5, 6, 7}, evenIndex), list{0, 2, 4, 6}) -} - -let id: int => int = x => x - -let () = { - let \"=~" = eq("MAP", ...) - \"=~"(N.map(N.makeBy(5, id), x => x * 2), list{0, 2, 4, 6, 8}) - \"=~"(N.map(list{}, id), list{}) - \"=~"(N.map(list{1}, x => -x), list{-1}) -} -let add = (a, b) => a + b -let length_10_id = N.makeBy(10, id) -let length_8_id = N.makeBy(8, id) -let () = { - let \"=~" = eq("MAP2", ...) - let b = length_10_id - let c = length_8_id - let d = N.makeBy(10, x => 2 * x) - let map2_add = (x, y) => N.zipBy(x, y, add) - \"=~"(map2_add(length_10_id, b), d) - \"=~"(map2_add(list{}, list{1}), list{}) - \"=~"(map2_add(list{1}, list{}), list{}) - \"=~"(map2_add(list{}, list{}), list{}) - \"=~"( - map2_add(length_10_id, b), - { - open N - concat(map(c, x => x * 2), list{16, 18}) - }, - ) - \"=~"( - map2_add(length_10_id, length_8_id), - { - open N - mapWithIndex(length_8_id, (i, x) => i + x) - }, - ) - \"=~"(N.reverse(N.mapReverse2(length_10_id, length_10_id, add)), N.map(length_10_id, x => x * 2)) - let xs = N.reverse(N.mapReverse2(length_8_id, length_10_id, add)) - eq(__LOC__, N.length(xs), 8) - \"=~"(xs, N.zipBy(length_10_id, length_8_id, add)) - \"=~"(N.mapReverse2(list{1, 2, 3}, list{1, 2}, (x, y) => x + y), list{4, 2}) -} - -let () = { - let \"=~" = eq("TAKE", ...) - \"=~"(N.take(list{1, 2, 3}, 2), Some(list{1, 2})) - \"=~"(N.take(list{}, 1), None) - \"=~"(N.take(list{1, 2}, 3), None) - \"=~"(N.take(list{1, 2}, 2), Some(list{1, 2})) - \"=~"(N.take(length_10_id, 8), Some(length_8_id)) - \"=~"(N.take(length_10_id, 0), Some(list{})) - \"=~"(N.take(length_8_id, -2), None) -} - -let () = { - let \"=~" = eq("DROP", ...) - \"=~"(N.drop(length_10_id, 10), Some(list{})) - \"=~"(N.drop(length_10_id, 8), Some(list{8, 9})) - \"=~"(N.drop(length_10_id, 0), Some(length_10_id)) - \"=~"(N.drop(length_8_id, -1), None) -} - -let () = { - let \"=~" = eq("SPLIT", ...) - let a = N.makeBy(5, id) - \"=~"(N.splitAt(list{}, 1), None) - \"=~"(N.splitAt(a, 6), None) - \"=~"(N.splitAt(a, 5), Some(a, list{})) - \"=~"(N.splitAt(a, 4), Some(list{0, 1, 2, 3}, list{4})) - \"=~"(N.splitAt(a, 3), Some(list{0, 1, 2}, list{3, 4})) - \"=~"(N.splitAt(a, 2), Some(list{0, 1}, list{2, 3, 4})) - \"=~"(N.splitAt(a, 1), Some(list{0}, list{1, 2, 3, 4})) - \"=~"(N.splitAt(a, 0), Some(list{}, a)) - \"=~"(N.splitAt(a, -1), None) -} -let succx = x => x + 1 - -let () = { - let \"=~" = eq("REMOVEASSOQ", ...) - let eqx = (x, y) => (x: int) == y - b(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"=")) - b(__LOC__, !N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, \"=")) - b(__LOC__, N.hasAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 4, (x, y) => x + 1 == y)) - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, \"="), list{(1, "1"), (2, "2")}) - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, \"="), list{(2, "2"), (3, "3")}) - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, \"="), list{(1, "1"), (3, "3")}) - \"=~"( - N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 0, \"="), - list{(1, "1"), (2, "2"), (3, "3")}, - ) - - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 3, eqx), list{(1, "1"), (2, "2")}) - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 1, eqx), list{(2, "2"), (3, "3")}) - \"=~"(N.removeAssoc(list{(1, "1"), (2, "2"), (3, "3")}, 2, eqx), list{(1, "1"), (3, "3")}) - \"=~"(N.removeAssoc(list{}, 2, eqx), list{}) - let ll = list{(1, "1"), (2, "2"), (3, "3")} - let ll0 = N.removeAssoc(ll, 0, eqx) - b(__LOC__, ll === ll0) - let ll1 = N.setAssoc(ll, 2, "22", \"=") - eq(__LOC__, ll1, list{(1, "1"), (2, "22"), (3, "3")}) - let ll2 = N.setAssoc(ll1, 22, "2", \"=") - b(__LOC__, ll2 == list{(22, "2"), ...ll1}) - b(__LOC__, N.tailExn(ll2) === ll1) - b( - __LOC__, - N.setAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 2, "x", \"=") == - list{(1, "a"), (2, "x"), (3, "c")}, - ) - b( - __LOC__, - N.setAssoc(list{(1, "a"), (3, "c")}, 2, "2", \"=") == list{(2, "2"), (1, "a"), (3, "c")}, - ) - eq(__LOC__, N.setAssoc(list{}, 1, "1", \"="), list{(1, "1")}) - %debugger - eq(__LOC__, N.setAssoc(list{(1, "2")}, 1, "1", \"="), list{(1, "1")}) - - eq(__LOC__, N.setAssoc(list{(0, "0"), (1, "2")}, 1, "1", \"="), list{(0, "0"), (1, "1")}) - b(__LOC__, N.getAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 2, \"=") == Some("b")) - b(__LOC__, N.getAssoc(list{(1, "a"), (2, "b"), (3, "c")}, 4, \"=") == None) -} - -let () = { - eq( - __LOC__, - { - open N - (head(length_10_id), tail(length_10_id)) - }, - (Some(0), N.drop(length_10_id, 1)), - ) - eq(__LOC__, N.head(list{}), None) - throw(__LOC__, _ => N.headExn(list{})) - throw(__LOC__, _ => N.tailExn(list{}) |> ignore) - throw(__LOC__, _ => N.getExn(list{0, 1}, -1) |> ignore) - throw(__LOC__, _ => N.getExn(list{0, 1}, 2) |> ignore) - eq(__LOC__, N.map(list{0, 1}, i => N.getExn(list{0, 1}, i)), list{0, 1}) - eq(__LOC__, N.headExn(list{1}), 1) - eq(__LOC__, N.tailExn(list{1}), list{}) - N.forEachWithIndex(length_10_id, (i, x) => eq(__LOC__, N.get(length_10_id, i), Some(x))) - eq(__LOC__, N.tail(list{}), None) - eq(__LOC__, N.drop(list{}, 3), None) - eq(__LOC__, N.mapWithIndex(list{}, (i, x) => i + x), list{}) - eq(__LOC__, N.get(length_10_id, -1), None) - eq(__LOC__, N.get(length_10_id, 12), None) - eq(__LOC__, sum(list{}), 0) - eq(__LOC__, sum(length_10_id), 45) - eq(__LOC__, N.makeBy(0, id), list{}) - eq( - __LOC__, - { - open N - reverse(reverse(length_10_id)) - }, - length_10_id, - ) - eq( - __LOC__, - { - open N - reverse(reverse(length_8_id)) - }, - length_8_id, - ) - eq(__LOC__, N.reverse(list{}), list{}) - eq(__LOC__, N.reverse(N.mapReverse(length_10_id, succx)), N.map(length_10_id, succx)) - eq(__LOC__, N.reduce(length_10_id, 0, add), 45) - eq(__LOC__, N.reduceReverse(length_10_id, 0, add), 45) - eq(__LOC__, N.reduceReverse(N.makeBy(10_000, i => i), 0, \"+"), 0 + 9_999 * 5_000) - /* eq __LOC__ - (N.mapRev2 length_10_id length_8_id add ) */ - eq(__LOC__, sum2(length_10_id, length_10_id), 90) - eq(__LOC__, sum2(length_8_id, length_10_id), 56) - eq(__LOC__, sum2(length_10_id, length_8_id), 56) - eq(__LOC__, N.reduce2(length_10_id, length_8_id, 0, (acc, x, y) => acc + x + y), 56) - eq(__LOC__, N.reduce2(list{1, 2, 3}, list{2, 4, 6}, 0, (a, b, c) => a + b + c), 18) - eq(__LOC__, N.reduceReverse2(length_10_id, length_8_id, 0, (acc, x, y) => acc + x + y), 56) - eq(__LOC__, N.reduceReverse2(length_10_id, length_10_id, 0, (acc, x, y) => acc + x + y), 90) - eq(__LOC__, N.reduceReverse2(list{1, 2, 3}, list{1, 2}, 0, (acc, x, y) => acc + x + y), 6) - eq(__LOC__, N.every(list{2, 4, 6}, mod2), true) - eq(__LOC__, N.every(list{1}, mod2), false) - eq(__LOC__, N.every(list{}, mod2), true) - eq(__LOC__, N.some(list{1, 2, 5}, mod2), true) - eq(__LOC__, N.some(list{1, 3, 5}, mod2), false) - eq(__LOC__, N.some(list{}, mod2), false) - eq(__LOC__, N.has(list{1, 2, 3}, "2", (x, s) => string_of_int(x) == s), true) - eq(__LOC__, N.has(list{1, 2, 3}, "0", (x, s) => string_of_int(x) == s), false) - - b(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, 0, \"+") == 10) - b(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, 10, \"-") == 0) - b(__LOC__, N.reduceReverse(list{1, 2, 3, 4}, list{}, N.add) == list{1, 2, 3, 4}) - b(__LOC__, N.reduce(list{1, 2, 3, 4}, 0, \"+") == 10) - b(__LOC__, N.reduce(list{1, 2, 3, 4}, 10, \"-") == 0) - b(__LOC__, N.reduce(list{1, 2, 3, 4}, list{}, N.add) == list{4, 3, 2, 1}) - b(__LOC__, N.reduceWithIndex(list{1, 2, 3, 4}, 0, (acc, x, i) => acc + x + i) == 16) - b(__LOC__, N.reduceReverse2(list{1, 2, 3}, list{1, 2}, 0, (acc, x, y) => acc + x + y) == 6) - let a = N.makeBy(10_000, i => i) - b( - __LOC__, - N.reduceReverse2(a, list{0, ...a}, 0, (acc, x, y) => acc + x + y) == 9_999 * 10_000 - 9999, - ) -} - -let () = { - eq(__LOC__, N.every2(list{}, list{1}, (x, y) => x > y), true) - eq(__LOC__, N.every2(list{2, 3}, list{1}, (x, y) => x > y), true) - eq(__LOC__, N.every2(list{2}, list{1}, (x, y) => x > y), true) - eq(__LOC__, N.every2(list{2, 3}, list{1, 4}, (x, y) => x > y), false) - eq(__LOC__, N.every2(list{2, 3}, list{1, 0}, (x, y) => x > y), true) - eq(__LOC__, N.some2(list{}, list{1}, (x, y) => x > y), false) - eq(__LOC__, N.some2(list{2, 3}, list{1}, (x, y) => x > y), true) - eq(__LOC__, N.some2(list{2, 3}, list{1, 4}, (x, y) => x > y), true) - eq(__LOC__, N.some2(list{0, 3}, list{1, 4}, (x, y) => x > y), false) - eq(__LOC__, N.some2(list{0, 3}, list{3, 2}, (x, y) => x > y), true) - eq(__LOC__, N.some2(list{1, 2, 3}, list{-1, -2}, (x, y) => x == y), false) -} - -let makeTest = n => eq(__LOC__, N.make(n, 3), N.makeBy(n, _ => 3)) - -let () = eq(__LOC__, list{}->N.add(3)->N.add(2), list{2, 3}) -let () = { - b(__LOC__, N.cmp(list{1, 2, 3}, list{0, 1, 2, 3}, compare) > 0) - b(__LOC__, N.cmp(list{1, 2, 3, 4}, list{1, 2, 3}, compare) > 0) - b(__LOC__, N.cmp(list{1, 2, 3}, list{1, 2, 3, 4}, compare) < 0) - b(__LOC__, N.cmp(list{1, 2, 3}, list{0, 1, 2}, (x, y) => compare(x, y)) > 0) - b(__LOC__, N.cmp(list{1, 2, 3}, list{1, 2, 3}, (x, y) => compare(x, y)) == 0) - b(__LOC__, N.cmp(list{1, 2, 4}, list{1, 2, 3}, (x, y) => compare(x, y)) > 0) - b(__LOC__, N.cmpByLength(list{}, list{}) == 0) - b(__LOC__, N.cmpByLength(list{1}, list{}) > 0) - b(__LOC__, N.cmpByLength(list{}, list{1}) < 0) - b(__LOC__, N.cmpByLength(list{1, 2}, list{1}) > 0) - b(__LOC__, N.cmpByLength(list{1}, list{1, 2}) < 0) - b(__LOC__, N.cmpByLength(list{1, 3}, list{1, 2}) == 0) -} - -let () = { - makeTest(0) - makeTest(1) - makeTest(2) - makeTest(3) -} - -let () = { - let \"=~" = eq("SORT", ...) - let cmp = (a, b) => a - b - \"=~"(N.sort(list{5, 4, 3, 2}, cmp), list{2, 3, 4, 5}) - \"=~"(N.sort(list{3, 9, 37, 3, 1}, cmp), list{1, 3, 3, 9, 37}) -} - -let () = { - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2}, (x, y) => x == y))) - b(__LOC__, N.eq(list{1, 2, 3}, list{1, 2, 3}, (x, y) => x == y)) - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2, 4}, (x, y) => x == y))) - b(__LOC__, \"@@"(not, N.eq(list{1, 2, 3}, list{1, 2, 3, 4}, \"="))) -} -let () = { - let u0 = N.makeBy(20, x => x) - let u1 = u0->N.keepMap(x => - if mod(x, 7) == 0 { - Some(x + 1) - } else { - None - } - ) - eq(__LOC__, u1, list{1, 8, 15}) - b( - __LOC__, - { - open N - - list{1, 2, 3, 4}->keepMap(x => - if mod(x, 2) == 0 { - Some(-x) - } else { - None - } - ) == list{-2, -4} - }, - ) - b( - __LOC__, - N.keepMap(list{1, 2, 3, 4}, x => - if mod(x, 5) == 0 { - Some(x) - } else { - None - } - ) == list{}, - ) -} -Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/bs_sort_test.js b/jscomp/test/bs_sort_test.js deleted file mode 100644 index a3c9b0a5f8..0000000000 --- a/jscomp/test/bs_sort_test.js +++ /dev/null @@ -1,415 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Caml = require("../../lib/js/caml.js"); -let Belt_Array = require("../../lib/js/belt_Array.js"); -let Belt_Range = require("../../lib/js/belt_Range.js"); -let Belt_SortArray = require("../../lib/js/belt_SortArray.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_SortArrayInt = require("../../lib/js/belt_SortArrayInt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function b(loc, x) { - Mt.bool_suites(test_id, suites, loc, x); -} - -function cmp(x, y) { - return x - y | 0; -} - -function unions(xs, ys) { - let lenX = xs.length; - let lenY = ys.length; - let o = new Array(lenX + lenY | 0); - let v = Belt_SortArray.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); - o.length = v; - return o; -} - -function inters(xs, ys) { - let lenX = xs.length; - let lenY = ys.length; - let o = new Array(lenX); - let v = Belt_SortArray.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); - o.length = v; - return o; -} - -function diffs(xs, ys) { - let lenX = xs.length; - let lenY = ys.length; - let o = new Array(lenX); - let v = Belt_SortArray.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp); - o.length = v; - return o; -} - -eq("File \"bs_sort_test.res\", line 35, characters 5-12", unions(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(1, 13)); - -eq("File \"bs_sort_test.res\", line 36, characters 5-12", unions(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(1, 13)); - -eq("File \"bs_sort_test.res\", line 37, characters 5-12", unions(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(8, 13)); - -eq("File \"bs_sort_test.res\", line 38, characters 5-12", unions(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ - 0, - 1, - 2, - 4, - 5, - 6, - 7 -]); - -eq("File \"bs_sort_test.res\", line 42, characters 5-12", inters(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(3, 10)); - -eq("File \"bs_sort_test.res\", line 43, characters 5-12", inters(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(9, 10)); - -eq("File \"bs_sort_test.res\", line 44, characters 5-12", inters(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(9, 10)); - -eq("File \"bs_sort_test.res\", line 45, characters 5-12", inters(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), []); - -eq("File \"bs_sort_test.res\", line 49, characters 5-12", diffs(Array_data_util.range(1, 10), Array_data_util.range(3, 13)), Array_data_util.range(1, 2)); - -eq("File \"bs_sort_test.res\", line 50, characters 5-12", diffs(Array_data_util.range(1, 10), Array_data_util.range(9, 13)), Array_data_util.range(1, 8)); - -eq("File \"bs_sort_test.res\", line 51, characters 5-12", diffs(Array_data_util.range(8, 10), Array_data_util.range(9, 13)), Array_data_util.range(8, 8)); - -eq("File \"bs_sort_test.res\", line 52, characters 5-12", diffs(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ - 0, - 1, - 2 -]); - -b("File \"bs_sort_test.res\", line 56, characters 4-11", Belt_Range.every(0, 200, i => { - let v = Array_data_util.randomRange(0, i); - Belt_SortArray.stableSortInPlaceBy(v, cmp); - return Belt_SortArray.isSorted(v, cmp); -})); - -b("File \"bs_sort_test.res\", line 64, characters 4-11", Belt_Range.every(0, 200, i => { - let v = Array_data_util.randomRange(0, i); - Belt_SortArray.stableSortInPlaceBy(v, cmp); - return Belt_SortArray.isSorted(v, cmp); -})); - -b("File \"bs_sort_test.res\", line 71, characters 4-11", Belt_SortArray.isSorted([], cmp)); - -b("File \"bs_sort_test.res\", line 73, characters 4-11", Belt_SortArray.isSorted([0], cmp)); - -b("File \"bs_sort_test.res\", line 75, characters 4-11", Belt_SortArray.isSorted([ - 0, - 1 -], cmp)); - -b("File \"bs_sort_test.res\", line 76, characters 4-11", !Belt_SortArray.isSorted([ - 1, - 0 -], cmp)); - -let u = Array_data_util.randomRange(0, 1000000); - -let u1 = u.slice(0); - -let u2 = u.slice(0); - -Belt_SortArray.stableSortInPlaceBy(u, cmp); - -b("File \"bs_sort_test.res\", line 86, characters 4-11", Belt_SortArray.isSorted(u, cmp)); - -Belt_SortArrayInt.stableSortInPlace(u2); - -b("File \"bs_sort_test.res\", line 88, characters 4-11", Belt_SortArray.isSorted(u2, cmp)); - -Belt_SortArray.stableSortInPlaceBy(u1, cmp); - -b("File \"bs_sort_test.res\", line 90, characters 4-11", Belt_SortArray.isSorted(u1, cmp)); - -let u$1 = [ - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 2, - "a" - ] -]; - -eq("File \"bs_sort_test.res\", line 95, characters 5-12", Belt_SortArray.stableSortBy(u$1, (param, param$1) => param[0] - param$1[0] | 0), [ - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 2, - "a" - ] -]); - -let u$2 = [ - [ - 1, - "b" - ], - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 2, - "a" - ] -]; - -eq("File \"bs_sort_test.res\", line 98, characters 4-11", Belt_SortArray.stableSortBy(u$2, (param, param$1) => param[0] - param$1[0] | 0), [ - [ - 1, - "b" - ], - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 2, - "a" - ] -]); - -let u$3 = [ - [ - 1, - "c" - ], - [ - 1, - "b" - ], - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 1, - "c" - ], - [ - 2, - "a" - ] -]; - -eq("File \"bs_sort_test.res\", line 104, characters 4-11", Belt_SortArray.stableSortBy(u$3, (param, param$1) => param[0] - param$1[0] | 0), [ - [ - 1, - "c" - ], - [ - 1, - "b" - ], - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 1, - "c" - ], - [ - 2, - "a" - ] -]); - -eq("File \"bs_sort_test.res\", line 111, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 3, - 5, - 7 -], 4, Caml.int_compare) ^ -1, 2); - -eq("File \"bs_sort_test.res\", line 112, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 -], 33, cmp), 4); - -eq("File \"bs_sort_test.res\", line 113, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 -], 1, cmp), 0); - -eq("File \"bs_sort_test.res\", line 114, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 -], 2, cmp), 1); - -eq("File \"bs_sort_test.res\", line 115, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 -], 3, cmp), 2); - -eq("File \"bs_sort_test.res\", line 116, characters 5-12", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 -], 4, cmp), 3); - -let aa = Array_data_util.range(0, 1000); - -b("File \"bs_sort_test.res\", line 118, characters 4-11", Belt_Range.every(0, 1000, i => Belt_SortArray.binarySearchBy(aa, i, cmp) === i)); - -let cc = Belt_Array.map(Array_data_util.range(0, 2000), x => (x << 1)); - -eq("File \"bs_sort_test.res\", line 121, characters 5-12", Belt_SortArray.binarySearchBy(cc, 5000, cmp) ^ -1, 2001); - -eq("File \"bs_sort_test.res\", line 122, characters 5-12", Belt_SortArray.binarySearchBy(cc, -1, cmp) ^ -1, 0); - -eq("File \"bs_sort_test.res\", line 123, characters 5-12", Belt_SortArray.binarySearchBy(cc, 0, cmp), 0); - -eq("File \"bs_sort_test.res\", line 125, characters 5-12", Belt_SortArray.binarySearchBy(cc, 1, cmp) ^ -1, 1); - -b("File \"bs_sort_test.res\", line 126, characters 6-13", Belt_Range.every(0, 1999, i => (Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp) ^ -1) === (i + 1 | 0))); - -function lt(x, y) { - return x < y; -} - -eq("File \"bs_sort_test.res\", line 135, characters 5-12", Belt_SortArray.strictlySortedLength([], lt), 0); - -eq("File \"bs_sort_test.res\", line 136, characters 5-12", Belt_SortArray.strictlySortedLength([1], lt), 1); - -eq("File \"bs_sort_test.res\", line 137, characters 5-12", Belt_SortArray.strictlySortedLength([ - 1, - 1 -], lt), 1); - -eq("File \"bs_sort_test.res\", line 138, characters 5-12", Belt_SortArray.strictlySortedLength([ - 1, - 1, - 2 -], lt), 1); - -eq("File \"bs_sort_test.res\", line 139, characters 5-12", Belt_SortArray.strictlySortedLength([ - 1, - 2 -], lt), 2); - -eq("File \"bs_sort_test.res\", line 140, characters 5-12", Belt_SortArray.strictlySortedLength([ - 1, - 2, - 3, - 4, - 3 -], lt), 4); - -eq("File \"bs_sort_test.res\", line 141, characters 5-12", Belt_SortArray.strictlySortedLength([ - 4, - 4, - 3, - 2, - 1 -], lt), 1); - -eq("File \"bs_sort_test.res\", line 142, characters 5-12", Belt_SortArray.strictlySortedLength([ - 4, - 3, - 2, - 1 -], lt), -4); - -eq("File \"bs_sort_test.res\", line 143, characters 5-12", Belt_SortArray.strictlySortedLength([ - 4, - 3, - 2, - 1, - 0 -], lt), -5); - -Mt.from_pair_suites("Bs_sort_test", suites.contents); - -let I; - -let S; - -let R; - -let A; - -let SI; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.I = I; -exports.S = S; -exports.R = R; -exports.cmp = cmp; -exports.A = A; -exports.unions = unions; -exports.inters = inters; -exports.diffs = diffs; -exports.SI = SI; -exports.lt = lt; -/* Not a pure module */ diff --git a/jscomp/test/bs_sort_test.res b/jscomp/test/bs_sort_test.res deleted file mode 100644 index 4e6f5a78f5..0000000000 --- a/jscomp/test/bs_sort_test.res +++ /dev/null @@ -1,146 +0,0 @@ -let suites: ref = ref(list{}) -let test_id = ref(0) -let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) -let b = (loc, x) => Mt.bool_suites(~test_id, ~suites, loc, x) - -module I = Array_data_util -module S = Belt.SortArray -module R = Belt.Range -let cmp = (x, y) => x - y -module A = Belt.Array - -let unions = (xs, ys) => { - let (lenX, lenY) = (A.length(xs), A.length(ys)) - let o = A.makeUninitializedUnsafe(lenX + lenY) - let v = S.union(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) - A.truncateToLengthUnsafe(o, v) - o -} -let inters = (xs, ys) => { - let (lenX, lenY) = (A.length(xs), A.length(ys)) - let o = A.makeUninitializedUnsafe(lenX) - let v = S.intersect(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) - A.truncateToLengthUnsafe(o, v) - o -} -let diffs = (xs, ys) => { - let (lenX, lenY) = (A.length(xs), A.length(ys)) - let o = A.makeUninitializedUnsafe(lenX) - let v = S.diff(xs, 0, lenX, ys, 0, lenY, o, 0, cmp) - A.truncateToLengthUnsafe(o, v) - o -} - -let () = { - eq(__LOC__, unions(I.range(1, 10), I.range(3, 13)), I.range(1, 13)) - eq(__LOC__, unions(I.range(1, 10), I.range(9, 13)), I.range(1, 13)) - eq(__LOC__, unions(I.range(8, 10), I.range(9, 13)), I.range(8, 13)) - eq(__LOC__, unions(I.range(0, 2), I.range(4, 7)), [0, 1, 2, 4, 5, 6, 7]) -} - -let () = { - eq(__LOC__, inters(I.range(1, 10), I.range(3, 13)), I.range(3, 10)) - eq(__LOC__, inters(I.range(1, 10), I.range(9, 13)), I.range(9, 10)) - eq(__LOC__, inters(I.range(8, 10), I.range(9, 13)), I.range(9, 10)) - eq(__LOC__, inters(I.range(0, 2), I.range(4, 7)), []) -} - -let () = { - eq(__LOC__, diffs(I.range(1, 10), I.range(3, 13)), I.range(1, 2)) - eq(__LOC__, diffs(I.range(1, 10), I.range(9, 13)), I.range(1, 8)) - eq(__LOC__, diffs(I.range(8, 10), I.range(9, 13)), I.range(8, 8)) - eq(__LOC__, diffs(I.range(0, 2), I.range(4, 7)), [0, 1, 2]) -} -let () = { - b( - __LOC__, - R.every(0, 200, i => { - let v = I.randomRange(0, i) - S.stableSortInPlaceBy(v, cmp) - S.isSorted(v, cmp) - }), - ) - b( - __LOC__, - R.every(0, 200, i => { - let v = I.randomRange(0, i) - S.stableSortInPlaceBy(v, cmp) - S.isSorted(v, cmp) - }), - ) - b(__LOC__, S.isSorted([], cmp)) - - b(__LOC__, S.isSorted([0], cmp)) - - b(__LOC__, S.isSorted([0, 1], cmp)) - b(__LOC__, \"@@"(not, S.isSorted([1, 0], cmp))) -} - -module SI = Belt.SortArray.Int -let () = { - let u = I.randomRange(0, 1_000_000) - let u1 = A.copy(u) - let u2 = A.copy(u) - /* let u3 = A.map u (fun[@bs] x -> float x) in */ - S.stableSortInPlaceBy(u, cmp) - b(__LOC__, S.isSorted(u, cmp)) - SI.stableSortInPlace(u2) - b(__LOC__, S.isSorted(u2, cmp)) - S.stableSortInPlaceBy(u1, cmp) - b(__LOC__, S.isSorted(u1, cmp)) -} - -let () = { - let u = [(1, "a"), (1, "b"), (2, "a")] - eq(__LOC__, S.stableSortBy(u, ((a, _), (b, _)) => a - b), [(1, "a"), (1, "b"), (2, "a")]) - let u = [(1, "b"), (1, "a"), (1, "b"), (2, "a")] - eq( - __LOC__, - S.stableSortBy(u, ((a, _), (b, _)) => a - b), - [(1, "b"), (1, "a"), (1, "b"), (2, "a")], - ) - let u = [(1, "c"), (1, "b"), (1, "a"), (1, "b"), (1, "c"), (2, "a")] - eq( - __LOC__, - S.stableSortBy(u, ((a, _), (b, _)) => a - b), - [(1, "c"), (1, "b"), (1, "a"), (1, "b"), (1, "c"), (2, "a")], - ) -} - -let () = { - eq(__LOC__, lnot(S.binarySearchBy([1, 3, 5, 7], 4, compare)), 2) - eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 33, cmp), 4) - eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 1, cmp), 0) - eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 2, cmp), 1) - eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 3, cmp), 2) - eq(__LOC__, S.binarySearchBy([1, 2, 3, 4, 33, 35, 36], 4, cmp), 3) - let aa = I.range(0, 1000) - b(__LOC__, R.every(0, 1000, i => S.binarySearchBy(aa, i, cmp) == i)) - /* 0, 2, 4, ... 4000 */ - let cc = A.map(I.range(0, 2000), x => x * 2) - eq(__LOC__, lnot(S.binarySearchBy(cc, 5000, cmp)), 2001) - eq(__LOC__, lnot(S.binarySearchBy(cc, -1, cmp)), 0) - eq(__LOC__, S.binarySearchBy(cc, 0, cmp), 0) - - eq(__LOC__, lnot(S.binarySearchBy(cc, 1, cmp)), 1) - b(__LOC__, - R.every(0, 1999, i => - lnot(S.binarySearchBy(cc, 2 * i + 1, cmp)) == i + 1 - /* 1, 3, 5, ... , 3999 */ - )) -} - -let lt = (x: int, y) => x < y -let () = { - eq(__LOC__, S.strictlySortedLength([], lt), 0) - eq(__LOC__, S.strictlySortedLength([1], lt), 1) - eq(__LOC__, S.strictlySortedLength([1, 1], lt), 1) - eq(__LOC__, S.strictlySortedLength([1, 1, 2], lt), 1) - eq(__LOC__, S.strictlySortedLength([1, 2], lt), 2) - eq(__LOC__, S.strictlySortedLength([1, 2, 3, 4, 3], lt), 4) - eq(__LOC__, S.strictlySortedLength([4, 4, 3, 2, 1], lt), 1) - eq(__LOC__, S.strictlySortedLength([4, 3, 2, 1], lt), -4) - eq(__LOC__, S.strictlySortedLength([4, 3, 2, 1, 0], lt), -5) -} - -Mt.from_pair_suites(__MODULE__, suites.contents) diff --git a/jscomp/test/build.ninja b/jscomp/test/build.ninja index ad0407c8ba..a2dca978d3 100644 --- a/jscomp/test/build.ninja +++ b/jscomp/test/build.ninja @@ -73,11 +73,15 @@ o test/basic_module_test.cmj : cc_cmi test/basic_module_test.res | test/basic_mo o test/basic_module_test.cmi : cc test/basic_module_test.resi | $bsc $stdlib runtime o test/bb.cmi test/bb.cmj : cc test/bb.res | $bsc $stdlib runtime o test/bdd.cmi test/bdd.cmj : cc test/bdd.res | $bsc $stdlib runtime -o test/belt_float_ntest.cmi test/belt_float_ntest.cmj : cc test/belt_float_ntest.res | test/node_assert.cmj test/node_test.cmj $bsc $stdlib runtime -o test/belt_int_ntest.cmi test/belt_int_ntest.cmj : cc test/belt_int_ntest.res | test/node_assert.cmj test/node_test.cmj $bsc $stdlib runtime +o test/belt_float_ntest.cmi test/belt_float_ntest.cmj : cc test/belt_float_ntest.res | test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime +o test/belt_hashmap_ntest.cmi test/belt_hashmap_ntest.cmj : cc test/belt_hashmap_ntest.res | test/array_data_util.cmj test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime +o test/belt_hashset_int_ntest.cmi test/belt_hashset_int_ntest.cmj : cc test/belt_hashset_int_ntest.res | test/array_data_util.cmj test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime +o test/belt_int_ntest.cmi test/belt_int_ntest.cmj : cc test/belt_int_ntest.res | test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime o test/belt_internal_test.cmi test/belt_internal_test.cmj : cc test/belt_internal_test.res | $bsc $stdlib runtime -o test/belt_mapint_ntest.cmi test/belt_mapint_ntest.cmj : cc test/belt_mapint_ntest.res | test/node_assert.cmj test/node_test.cmj $bsc $stdlib runtime +o test/belt_list_ntest.cmi test/belt_list_ntest.cmj : cc test/belt_list_ntest.res | test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime +o test/belt_mapint_ntest.cmi test/belt_mapint_ntest.cmj : cc test/belt_mapint_ntest.res | test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime o test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj : cc test/belt_result_alias_test.res | $bsc $stdlib runtime +o test/belt_sortarray_ntest.cmi test/belt_sortarray_ntest.cmj : cc test/belt_sortarray_ntest.res | test/array_data_util.cmj test/node_test.cmj test/node_test_util.cmj $bsc $stdlib runtime o test/bench.cmi test/bench.cmj : cc test/bench.res | $bsc $stdlib runtime o test/big_enum.cmi test/big_enum.cmj : cc test/big_enum.res | $bsc $stdlib runtime o test/big_polyvar_test.cmi test/big_polyvar_test.cmj : cc test/big_polyvar_test.res | $bsc $stdlib runtime @@ -89,11 +93,8 @@ o test/bs_abstract_test.cmi : cc test/bs_abstract_test.resi | $bsc $stdlib runti o test/bs_array_test.cmi test/bs_array_test.cmj : cc test/bs_array_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj : cc test/bs_auto_uncurry.res | $bsc $stdlib runtime o test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj : cc test/bs_auto_uncurry_test.res | test/mt.cmj $bsc $stdlib runtime -o test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj : cc test/bs_hashmap_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime -o test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj : cc test/bs_hashset_int_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj : cc test/bs_ignore_effect.res | test/mt.cmj $bsc $stdlib runtime o test/bs_ignore_test.cmi test/bs_ignore_test.cmj : cc test/bs_ignore_test.res | $bsc $stdlib runtime -o test/bs_list_test.cmi test/bs_list_test.cmj : cc test/bs_list_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj : cc test/bs_map_set_dict_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_map_test.cmi test/bs_map_test.cmj : cc test/bs_map_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_min_max_test.cmi test/bs_min_max_test.cmj : cc test/bs_min_max_test.res | test/mt.cmj $bsc $stdlib runtime @@ -106,7 +107,6 @@ o test/bs_qualified.cmi test/bs_qualified.cmj : cc test/bs_qualified.res | $bsc o test/bs_queue_test.cmi test/bs_queue_test.cmj : cc test/bs_queue_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_rest_test.cmi test/bs_rest_test.cmj : cc test/bs_rest_test.res | $bsc $stdlib runtime o test/bs_set_int_test.cmi test/bs_set_int_test.cmj : cc test/bs_set_int_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime -o test/bs_sort_test.cmi test/bs_sort_test.cmj : cc test/bs_sort_test.res | test/array_data_util.cmj test/mt.cmj $bsc $stdlib runtime o test/bs_splice_partial.cmi test/bs_splice_partial.cmj : cc test/bs_splice_partial.res | $bsc $stdlib runtime o test/bs_stack_test.cmi test/bs_stack_test.cmj : cc test/bs_stack_test.res | test/mt.cmj $bsc $stdlib runtime o test/bs_string_test.cmi test/bs_string_test.cmj : cc test/bs_string_test.res | test/mt.cmj $bsc $stdlib runtime @@ -456,6 +456,7 @@ o test/noassert.cmi test/noassert.cmj : cc test/noassert.res | $bsc $stdlib runt o test/node_assert.cmi test/node_assert.cmj : cc test/node_assert.res | $bsc $stdlib runtime o test/node_path_test.cmi test/node_path_test.cmj : cc test/node_path_test.res | $bsc $stdlib runtime o test/node_test.cmi test/node_test.cmj : cc test/node_test.res | $bsc $stdlib runtime +o test/node_test_util.cmi test/node_test_util.cmj : cc test/node_test_util.res | test/node_assert.cmj $bsc $stdlib runtime o test/number_lexer.cmi test/number_lexer.cmj : cc test/number_lexer.res | $bsc $stdlib runtime o test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj : cc test/obj_literal_ppx.res | $bsc $stdlib runtime o test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj : cc test/obj_literal_ppx_test.res | $bsc $stdlib runtime @@ -691,4 +692,4 @@ o test/update_record_test.cmi test/update_record_test.cmj : cc test/update_recor o test/variant.cmi test/variant.cmj : cc test/variant.res | $bsc $stdlib runtime o test/variantsMatching.cmi test/variantsMatching.cmj : cc test/variantsMatching.res | $bsc $stdlib runtime o test/webpack_config.cmi test/webpack_config.cmj : cc test/webpack_config.res | $bsc $stdlib runtime -o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/AsInUncurriedExternals.cmi test/AsInUncurriedExternals.cmj test/Coercion.cmi test/Coercion.cmj test/DerivingAccessorsCurried.cmi test/DerivingAccessorsCurried.cmj test/DerivingAccessorsUncurried.cmi test/DerivingAccessorsUncurried.cmj test/DictInference.cmi test/DictInference.cmj test/DisambiguateOptionalFields.cmi test/DisambiguateOptionalFields.cmj test/DotDotDot.cmi test/DotDotDot.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/ExternalArity.cmi test/ExternalArity.cmj test/FFI.cmi test/FFI.cmj test/Import.cmi test/Import.cmj test/ImportAttributes.cmi test/ImportAttributes.cmj test/PartialApplicationNoRuntimeCurry.cmi test/PartialApplicationNoRuntimeCurry.cmj test/RecordCoercion.cmi test/RecordCoercion.cmj test/RecordOrObject.cmi test/RecordOrObject.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/UntaggedVariants.cmi test/UntaggedVariants.cmj test/VariantCoercion.cmi test/VariantCoercion.cmj test/VariantSpreads.cmi test/VariantSpreads.cmj test/a.cmi test/a.cmj test/a_filename_test.cmi test/a_filename_test.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/as_inline_record_test.cmi test/as_inline_record_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_inline.cmi test/async_inline.cmj test/async_inside_loop.cmi test/async_inside_loop.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_float_ntest.cmi test/belt_float_ntest.cmj test/belt_int_ntest.cmi test/belt_int_ntest.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_mapint_ntest.cmi test/belt_mapint_ntest.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/bigint_test.cmi test/bigint_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_abstract_test.cmi test/bs_abstract_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_hashmap_test.cmi test/bs_hashmap_test.cmj test/bs_hashset_int_test.cmi test/bs_hashset_int_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_list_test.cmi test/bs_list_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_sort_test.cmi test/bs_sort_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/caml_format_test.cmi test/caml_format_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/digest_test.cmi test/digest_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exotic_labels_test.cmi test/exotic_labels_test.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/function_directives.cmi test/function_directives.cmj test/function_directives_no_inline.cmi test/function_directives_no_inline.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/google_closure_test.cmi test/google_closure_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/ignore_uncurry_attribute.cmi test/ignore_uncurry_attribute.cmj test/import2.cmi test/import2.cmj test/import_external.cmi test/import_external.cmj test/import_side_effect.cmi test/import_side_effect.cmj test/import_side_effect_free.cmi test/import_side_effect_free.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_condition_with_pattern_matching.cmi test/inline_condition_with_pattern_matching.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/keep_uncurry_attribute.cmi test/keep_uncurry_attribute.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_assert.cmi test/node_assert.cmj test/node_path_test.cmi test/node_path_test.cmj test/node_test.cmi test/node_test.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/ocaml_re_test.cmi test/ocaml_re_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/omit_trailing_undefined_in_external_calls.cmi test/omit_trailing_undefined_in_external_calls.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/random_test.cmi test/random_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactCompat.cmi test/reasonReactCompat.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/recmodule.cmi test/recmodule.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_type_spread.cmi test/record_type_spread.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/sexp.cmi test/sexp.cmj test/sexpm.cmi test/sexpm.cmj test/sexpm_test.cmi test/sexpm_test.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect2.cmi test/side_effect2.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tagged_template_test.cmi test/tagged_template_test.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_google_closure.cmi test/test_google_closure.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type-coercion-free-vars.cmi test/type-coercion-free-vars.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/update_record_test.cmi test/update_record_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/webpack_config.cmi test/webpack_config.cmj +o test : phony test/406_primitive_test.cmi test/406_primitive_test.cmj test/AsInUncurriedExternals.cmi test/AsInUncurriedExternals.cmj test/Coercion.cmi test/Coercion.cmj test/DerivingAccessorsCurried.cmi test/DerivingAccessorsCurried.cmj test/DerivingAccessorsUncurried.cmi test/DerivingAccessorsUncurried.cmj test/DictInference.cmi test/DictInference.cmj test/DisambiguateOptionalFields.cmi test/DisambiguateOptionalFields.cmj test/DotDotDot.cmi test/DotDotDot.cmj test/EmptyRecord.cmi test/EmptyRecord.cmj test/ExternalArity.cmi test/ExternalArity.cmj test/FFI.cmi test/FFI.cmj test/Import.cmi test/Import.cmj test/ImportAttributes.cmi test/ImportAttributes.cmj test/PartialApplicationNoRuntimeCurry.cmi test/PartialApplicationNoRuntimeCurry.cmj test/RecordCoercion.cmi test/RecordCoercion.cmj test/RecordOrObject.cmi test/RecordOrObject.cmj test/SafePromises.cmi test/SafePromises.cmj test/UncurriedAlways.cmi test/UncurriedAlways.cmj test/UncurriedExternals.cmi test/UncurriedExternals.cmj test/UncurriedPervasives.cmi test/UncurriedPervasives.cmj test/UntaggedVariants.cmi test/UntaggedVariants.cmj test/VariantCoercion.cmi test/VariantCoercion.cmj test/VariantSpreads.cmi test/VariantSpreads.cmj test/a.cmi test/a.cmj test/a_filename_test.cmi test/a_filename_test.cmj test/a_list_test.cmi test/a_list_test.cmj test/a_recursive_type.cmi test/a_recursive_type.cmj test/a_scope_bug.cmi test/a_scope_bug.cmj test/a_string_test.cmi test/a_string_test.cmj test/abstract_type.cmi test/abstract_type.cmj test/adt_optimize_test.cmi test/adt_optimize_test.cmj test/alias_default_value_test.cmi test/alias_default_value_test.cmj test/alias_test.cmi test/alias_test.cmj test/and_or_tailcall_test.cmi test/and_or_tailcall_test.cmj test/argv_test.cmi test/argv_test.cmj test/ari_regress_test.cmi test/ari_regress_test.cmj test/arith_lexer.cmi test/arith_lexer.cmj test/arith_parser.cmi test/arith_parser.cmj test/arith_syntax.cmi test/arith_syntax.cmj test/arity.cmi test/arity.cmj test/arity_deopt.cmi test/arity_deopt.cmj test/arity_infer.cmi test/arity_infer.cmj test/array_data_util.cmi test/array_data_util.cmj test/array_safe_get.cmi test/array_safe_get.cmj test/array_subtle_test.cmi test/array_subtle_test.cmj test/array_test.cmi test/array_test.cmj test/as_inline_record_test.cmi test/as_inline_record_test.cmj test/ast_abstract_test.cmi test/ast_abstract_test.cmj test/ast_mapper_unused_warning_test.cmi test/ast_mapper_unused_warning_test.cmj test/async_await.cmi test/async_await.cmj test/async_inline.cmi test/async_inline.cmj test/async_inside_loop.cmi test/async_inside_loop.cmj test/attr_test.cmi test/attr_test.cmj test/b.cmi test/b.cmj test/bal_set_mini.cmi test/bal_set_mini.cmj test/bang_primitive.cmi test/bang_primitive.cmj test/basic_module_test.cmi test/basic_module_test.cmj test/bb.cmi test/bb.cmj test/bdd.cmi test/bdd.cmj test/belt_float_ntest.cmi test/belt_float_ntest.cmj test/belt_hashmap_ntest.cmi test/belt_hashmap_ntest.cmj test/belt_hashset_int_ntest.cmi test/belt_hashset_int_ntest.cmj test/belt_int_ntest.cmi test/belt_int_ntest.cmj test/belt_internal_test.cmi test/belt_internal_test.cmj test/belt_list_ntest.cmi test/belt_list_ntest.cmj test/belt_mapint_ntest.cmi test/belt_mapint_ntest.cmj test/belt_result_alias_test.cmi test/belt_result_alias_test.cmj test/belt_sortarray_ntest.cmi test/belt_sortarray_ntest.cmj test/bench.cmi test/bench.cmj test/big_enum.cmi test/big_enum.cmj test/big_polyvar_test.cmi test/big_polyvar_test.cmj test/bigint_test.cmi test/bigint_test.cmj test/block_alias_test.cmi test/block_alias_test.cmj test/boolean_test.cmi test/boolean_test.cmj test/bs_abstract_test.cmi test/bs_abstract_test.cmj test/bs_array_test.cmi test/bs_array_test.cmj test/bs_auto_uncurry.cmi test/bs_auto_uncurry.cmj test/bs_auto_uncurry_test.cmi test/bs_auto_uncurry_test.cmj test/bs_ignore_effect.cmi test/bs_ignore_effect.cmj test/bs_ignore_test.cmi test/bs_ignore_test.cmj test/bs_map_set_dict_test.cmi test/bs_map_set_dict_test.cmj test/bs_map_test.cmi test/bs_map_test.cmj test/bs_min_max_test.cmi test/bs_min_max_test.cmj test/bs_mutable_set_test.cmi test/bs_mutable_set_test.cmj test/bs_poly_map_test.cmi test/bs_poly_map_test.cmj test/bs_poly_mutable_map_test.cmi test/bs_poly_mutable_map_test.cmj test/bs_poly_mutable_set_test.cmi test/bs_poly_mutable_set_test.cmj test/bs_poly_set_test.cmi test/bs_poly_set_test.cmj test/bs_qualified.cmi test/bs_qualified.cmj test/bs_queue_test.cmi test/bs_queue_test.cmj test/bs_rest_test.cmi test/bs_rest_test.cmj test/bs_set_int_test.cmi test/bs_set_int_test.cmj test/bs_splice_partial.cmi test/bs_splice_partial.cmj test/bs_stack_test.cmi test/bs_stack_test.cmj test/bs_string_test.cmi test/bs_string_test.cmj test/bs_unwrap_test.cmi test/bs_unwrap_test.cmj test/buffer_test.cmi test/buffer_test.cmj test/bytes_split_gpr_743_test.cmi test/bytes_split_gpr_743_test.cmj test/caml_compare_bigint_test.cmi test/caml_compare_bigint_test.cmj test/caml_compare_test.cmi test/caml_compare_test.cmj test/caml_format_test.cmi test/caml_format_test.cmj test/chain_code_test.cmi test/chain_code_test.cmj test/chn_test.cmi test/chn_test.cmj test/class_type_ffi_test.cmi test/class_type_ffi_test.cmj test/coercion_module_alias_test.cmi test/coercion_module_alias_test.cmj test/compare_test.cmi test/compare_test.cmj test/complete_parmatch_test.cmi test/complete_parmatch_test.cmj test/complex_if_test.cmi test/complex_if_test.cmj test/complex_test.cmi test/complex_test.cmj test/complex_while_loop.cmi test/complex_while_loop.cmj test/condition_compilation_test.cmi test/condition_compilation_test.cmj test/config1_test.cmi test/config1_test.cmj test/console_log_test.cmi test/console_log_test.cmj test/const_block_test.cmi test/const_block_test.cmj test/const_defs.cmi test/const_defs.cmj test/const_defs_test.cmi test/const_defs_test.cmj test/const_test.cmi test/const_test.cmj test/cont_int_fold_test.cmi test/cont_int_fold_test.cmj test/cps_test.cmi test/cps_test.cmj test/cross_module_inline_test.cmi test/cross_module_inline_test.cmj test/custom_error_test.cmi test/custom_error_test.cmj test/debug_keep_test.cmi test/debug_keep_test.cmj test/debug_mode_value.cmi test/debug_mode_value.cmj test/debug_tmp.cmi test/debug_tmp.cmj test/debugger_test.cmi test/debugger_test.cmj test/default_export_test.cmi test/default_export_test.cmj test/defunctor_make_test.cmi test/defunctor_make_test.cmj test/demo_int_map.cmi test/demo_int_map.cmj test/demo_page.cmi test/demo_page.cmj test/demo_pipe.cmi test/demo_pipe.cmj test/derive_projector_test.cmi test/derive_projector_test.cmj test/digest_test.cmi test/digest_test.cmj test/directives.cmi test/directives.cmj test/div_by_zero_test.cmi test/div_by_zero_test.cmj test/dollar_escape_test.cmi test/dollar_escape_test.cmj test/earger_curry_test.cmi test/earger_curry_test.cmj test/effect.cmi test/effect.cmj test/epsilon_test.cmi test/epsilon_test.cmj test/equal_box_test.cmi test/equal_box_test.cmj test/equal_exception_test.cmi test/equal_exception_test.cmj test/equal_test.cmi test/equal_test.cmj test/es6_export.cmi test/es6_export.cmj test/es6_import.cmi test/es6_import.cmj test/es6_module_test.cmi test/es6_module_test.cmj test/escape_esmodule.cmi test/escape_esmodule.cmj test/esmodule_ref.cmi test/esmodule_ref.cmj test/event_ffi.cmi test/event_ffi.cmj test/exception_alias.cmi test/exception_alias.cmj test/exception_raise_test.cmi test/exception_raise_test.cmj test/exception_rebound_err_test.cmi test/exception_rebound_err_test.cmj test/exception_value_test.cmi test/exception_value_test.cmj test/exotic_labels_test.cmi test/exotic_labels_test.cmj test/exponentiation_precedence_test.cmi test/exponentiation_precedence_test.cmj test/export_keyword.cmi test/export_keyword.cmj test/ext_array_test.cmi test/ext_array_test.cmj test/ext_bytes_test.cmi test/ext_bytes_test.cmj test/ext_filename_test.cmi test/ext_filename_test.cmj test/ext_list_test.cmi test/ext_list_test.cmj test/ext_pervasives_test.cmi test/ext_pervasives_test.cmj test/ext_string_test.cmi test/ext_string_test.cmj test/ext_sys_test.cmi test/ext_sys_test.cmj test/extensible_variant_test.cmi test/extensible_variant_test.cmj test/external_ppx.cmi test/external_ppx.cmj test/external_ppx2.cmi test/external_ppx2.cmj test/ffi_arity_test.cmi test/ffi_arity_test.cmj test/ffi_array_test.cmi test/ffi_array_test.cmj test/ffi_js_test.cmi test/ffi_js_test.cmj test/ffi_splice_test.cmi test/ffi_splice_test.cmj test/ffi_test.cmi test/ffi_test.cmj test/fib.cmi test/fib.cmj test/flattern_order_test.cmi test/flattern_order_test.cmj test/flexible_array_test.cmi test/flexible_array_test.cmj test/float_array.cmi test/float_array.cmj test/float_of_bits_test.cmi test/float_of_bits_test.cmj test/float_record.cmi test/float_record.cmj test/float_test.cmi test/float_test.cmj test/floatarray_test.cmi test/floatarray_test.cmj test/for_loop_test.cmi test/for_loop_test.cmj test/for_side_effect_test.cmi test/for_side_effect_test.cmj test/format_regression.cmi test/format_regression.cmj test/format_test.cmi test/format_test.cmj test/fun_pattern_match.cmi test/fun_pattern_match.cmj test/function_directives.cmi test/function_directives.cmj test/function_directives_no_inline.cmi test/function_directives_no_inline.cmj test/functor_app_test.cmi test/functor_app_test.cmj test/functor_def.cmi test/functor_def.cmj test/functor_ffi.cmi test/functor_ffi.cmj test/functor_inst.cmi test/functor_inst.cmj test/functors.cmi test/functors.cmj test/gbk.cmi test/gbk.cmj test/genlex_test.cmi test/genlex_test.cmj test/gentTypeReTest.cmi test/gentTypeReTest.cmj test/global_exception_regression_test.cmi test/global_exception_regression_test.cmj test/global_mangles.cmi test/global_mangles.cmj test/global_module_alias_test.cmi test/global_module_alias_test.cmj test/google_closure_test.cmi test/google_closure_test.cmj test/gpr496_test.cmi test/gpr496_test.cmj test/gpr_1072.cmi test/gpr_1072.cmj test/gpr_1072_reg.cmi test/gpr_1072_reg.cmj test/gpr_1150.cmi test/gpr_1150.cmj test/gpr_1154_test.cmi test/gpr_1154_test.cmj test/gpr_1170.cmi test/gpr_1170.cmj test/gpr_1240_missing_unbox.cmi test/gpr_1240_missing_unbox.cmj test/gpr_1245_test.cmi test/gpr_1245_test.cmj test/gpr_1268.cmi test/gpr_1268.cmj test/gpr_1409_test.cmi test/gpr_1409_test.cmj test/gpr_1423_app_test.cmi test/gpr_1423_app_test.cmj test/gpr_1423_nav.cmi test/gpr_1423_nav.cmj test/gpr_1438.cmi test/gpr_1438.cmj test/gpr_1481.cmi test/gpr_1481.cmj test/gpr_1484.cmi test/gpr_1484.cmj test/gpr_1503_test.cmi test/gpr_1503_test.cmj test/gpr_1539_test.cmi test/gpr_1539_test.cmj test/gpr_1658_test.cmi test/gpr_1658_test.cmj test/gpr_1667_test.cmi test/gpr_1667_test.cmj test/gpr_1692_test.cmi test/gpr_1692_test.cmj test/gpr_1698_test.cmi test/gpr_1698_test.cmj test/gpr_1701_test.cmi test/gpr_1701_test.cmj test/gpr_1716_test.cmi test/gpr_1716_test.cmj test/gpr_1717_test.cmi test/gpr_1717_test.cmj test/gpr_1728_test.cmi test/gpr_1728_test.cmj test/gpr_1749_test.cmi test/gpr_1749_test.cmj test/gpr_1759_test.cmi test/gpr_1759_test.cmj test/gpr_1760_test.cmi test/gpr_1760_test.cmj test/gpr_1762_test.cmi test/gpr_1762_test.cmj test/gpr_1817_test.cmi test/gpr_1817_test.cmj test/gpr_1822_test.cmi test/gpr_1822_test.cmj test/gpr_1891_test.cmi test/gpr_1891_test.cmj test/gpr_1943_test.cmi test/gpr_1943_test.cmj test/gpr_1946_test.cmi test/gpr_1946_test.cmj test/gpr_2316_test.cmi test/gpr_2316_test.cmj test/gpr_2352_test.cmi test/gpr_2352_test.cmj test/gpr_2413_test.cmi test/gpr_2413_test.cmj test/gpr_2474.cmi test/gpr_2474.cmj test/gpr_2487.cmi test/gpr_2487.cmj test/gpr_2503_test.cmi test/gpr_2503_test.cmj test/gpr_2608_test.cmi test/gpr_2608_test.cmj test/gpr_2614_test.cmi test/gpr_2614_test.cmj test/gpr_2633_test.cmi test/gpr_2633_test.cmj test/gpr_2642_test.cmi test/gpr_2642_test.cmj test/gpr_2682_test.cmi test/gpr_2682_test.cmj test/gpr_2700_test.cmi test/gpr_2700_test.cmj test/gpr_2731_test.cmi test/gpr_2731_test.cmj test/gpr_2789_test.cmi test/gpr_2789_test.cmj test/gpr_2931_test.cmi test/gpr_2931_test.cmj test/gpr_3142_test.cmi test/gpr_3142_test.cmj test/gpr_3154_test.cmi test/gpr_3154_test.cmj test/gpr_3209_test.cmi test/gpr_3209_test.cmj test/gpr_3492_test.cmi test/gpr_3492_test.cmj test/gpr_3519_jsx_test.cmi test/gpr_3519_jsx_test.cmj test/gpr_3519_test.cmi test/gpr_3519_test.cmj test/gpr_3536_test.cmi test/gpr_3536_test.cmj test/gpr_3546_test.cmi test/gpr_3546_test.cmj test/gpr_3548_test.cmi test/gpr_3548_test.cmj test/gpr_3549_test.cmi test/gpr_3549_test.cmj test/gpr_3566_drive_test.cmi test/gpr_3566_drive_test.cmj test/gpr_3566_test.cmi test/gpr_3566_test.cmj test/gpr_3595_test.cmi test/gpr_3595_test.cmj test/gpr_3609_test.cmi test/gpr_3609_test.cmj test/gpr_3697_test.cmi test/gpr_3697_test.cmj test/gpr_373_test.cmi test/gpr_373_test.cmj test/gpr_3770_test.cmi test/gpr_3770_test.cmj test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj test/gpr_3852_alias_reify.cmi test/gpr_3852_alias_reify.cmj test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj test/gpr_3865.cmi test/gpr_3865.cmj test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj test/gpr_3875_test.cmi test/gpr_3875_test.cmj test/gpr_3877_test.cmi test/gpr_3877_test.cmj test/gpr_3895_test.cmi test/gpr_3895_test.cmj test/gpr_3897_test.cmi test/gpr_3897_test.cmj test/gpr_3931_test.cmi test/gpr_3931_test.cmj test/gpr_3980_test.cmi test/gpr_3980_test.cmj test/gpr_4025_test.cmi test/gpr_4025_test.cmj test/gpr_405_test.cmi test/gpr_405_test.cmj test/gpr_4069_test.cmi test/gpr_4069_test.cmj test/gpr_4265_test.cmi test/gpr_4265_test.cmj test/gpr_4274_test.cmi test/gpr_4274_test.cmj test/gpr_4280_test.cmi test/gpr_4280_test.cmj test/gpr_4407_test.cmi test/gpr_4407_test.cmj test/gpr_441.cmi test/gpr_441.cmj test/gpr_4442_test.cmi test/gpr_4442_test.cmj test/gpr_4491_test.cmi test/gpr_4491_test.cmj test/gpr_4494_test.cmi test/gpr_4494_test.cmj test/gpr_4519_test.cmi test/gpr_4519_test.cmj test/gpr_459_test.cmi test/gpr_459_test.cmj test/gpr_4632.cmi test/gpr_4632.cmj test/gpr_4639_test.cmi test/gpr_4639_test.cmj test/gpr_4900_test.cmi test/gpr_4900_test.cmj test/gpr_4924_test.cmi test/gpr_4924_test.cmj test/gpr_4931.cmi test/gpr_4931.cmj test/gpr_4931_allow.cmi test/gpr_4931_allow.cmj test/gpr_5071_test.cmi test/gpr_5071_test.cmj test/gpr_5169_test.cmi test/gpr_5169_test.cmj test/gpr_5218_test.cmi test/gpr_5218_test.cmj test/gpr_5280_optimize_test.cmi test/gpr_5280_optimize_test.cmj test/gpr_5557.cmi test/gpr_5557.cmj test/gpr_5753.cmi test/gpr_5753.cmj test/gpr_658.cmi test/gpr_658.cmj test/gpr_858_test.cmi test/gpr_858_test.cmj test/gpr_858_unit2_test.cmi test/gpr_858_unit2_test.cmj test/gpr_904_test.cmi test/gpr_904_test.cmj test/gpr_974_test.cmi test/gpr_974_test.cmj test/gpr_977_test.cmi test/gpr_977_test.cmj test/gpr_return_type_unused_attribute.cmi test/gpr_return_type_unused_attribute.cmj test/gray_code_test.cmi test/gray_code_test.cmj test/guide_for_ext.cmi test/guide_for_ext.cmj test/hash_collision_test.cmi test/hash_collision_test.cmj test/hash_sugar_desugar.cmi test/hash_sugar_desugar.cmj test/hash_test.cmi test/hash_test.cmj test/hashtbl_test.cmi test/hashtbl_test.cmj test/hello.foo.cmi test/hello.foo.cmj test/hello_res.cmi test/hello_res.cmj test/ignore_test.cmi test/ignore_test.cmj test/ignore_uncurry_attribute.cmi test/ignore_uncurry_attribute.cmj test/import2.cmi test/import2.cmj test/import_external.cmi test/import_external.cmj test/import_side_effect.cmi test/import_side_effect.cmj test/import_side_effect_free.cmi test/import_side_effect_free.cmj test/include_side_effect.cmi test/include_side_effect.cmj test/include_side_effect_free.cmi test/include_side_effect_free.cmj test/incomplete_toplevel_test.cmi test/incomplete_toplevel_test.cmj test/infer_type_test.cmi test/infer_type_test.cmj test/inline_condition_with_pattern_matching.cmi test/inline_condition_with_pattern_matching.cmj test/inline_const.cmi test/inline_const.cmj test/inline_const_test.cmi test/inline_const_test.cmj test/inline_edge_cases.cmi test/inline_edge_cases.cmj test/inline_map2_test.cmi test/inline_map2_test.cmj test/inline_map_demo.cmi test/inline_map_demo.cmj test/inline_map_test.cmi test/inline_map_test.cmj test/inline_record_test.cmi test/inline_record_test.cmj test/inline_regression_test.cmi test/inline_regression_test.cmj test/inline_string_test.cmi test/inline_string_test.cmj test/inner_call.cmi test/inner_call.cmj test/inner_define.cmi test/inner_define.cmj test/inner_unused.cmi test/inner_unused.cmj test/installation_test.cmi test/installation_test.cmj test/int32_test.cmi test/int32_test.cmj test/int64_mul_div_test.cmi test/int64_mul_div_test.cmj test/int64_string_bench.cmi test/int64_string_bench.cmj test/int64_string_test.cmi test/int64_string_test.cmj test/int64_test.cmi test/int64_test.cmj test/int_hashtbl_test.cmi test/int_hashtbl_test.cmj test/int_map.cmi test/int_map.cmj test/int_overflow_test.cmi test/int_overflow_test.cmj test/int_poly_var.cmi test/int_poly_var.cmj test/int_switch_test.cmi test/int_switch_test.cmj test/internal_unused_test.cmi test/internal_unused_test.cmj test/io_test.cmi test/io_test.cmj test/js_array_test.cmi test/js_array_test.cmj test/js_bool_test.cmi test/js_bool_test.cmj test/js_cast_test.cmi test/js_cast_test.cmj test/js_date_test.cmi test/js_date_test.cmj test/js_dict_test.cmi test/js_dict_test.cmj test/js_exception_catch_test.cmi test/js_exception_catch_test.cmj test/js_float_test.cmi test/js_float_test.cmj test/js_global_test.cmi test/js_global_test.cmj test/js_int_test.cmi test/js_int_test.cmj test/js_json_test.cmi test/js_json_test.cmj test/js_math_test.cmi test/js_math_test.cmj test/js_null_test.cmi test/js_null_test.cmj test/js_null_undefined_test.cmi test/js_null_undefined_test.cmj test/js_nullable_test.cmi test/js_nullable_test.cmj test/js_obj_test.cmi test/js_obj_test.cmj test/js_option_test.cmi test/js_option_test.cmj test/js_re_test.cmi test/js_re_test.cmj test/js_string_test.cmi test/js_string_test.cmj test/js_undefined_test.cmi test/js_undefined_test.cmj test/js_val.cmi test/js_val.cmj test/jsoo_400_test.cmi test/jsoo_400_test.cmj test/jsoo_485_test.cmi test/jsoo_485_test.cmj test/jsxv4_newtype.cmi test/jsxv4_newtype.cmj test/keep_uncurry_attribute.cmi test/keep_uncurry_attribute.cmj test/key_word_property.cmi test/key_word_property.cmj test/key_word_property2.cmi test/key_word_property2.cmj test/key_word_property_plus_test.cmi test/key_word_property_plus_test.cmj test/label_uncurry.cmi test/label_uncurry.cmj test/large_integer_pat.cmi test/large_integer_pat.cmj test/large_record_duplication_test.cmi test/large_record_duplication_test.cmj test/largest_int_flow.cmi test/largest_int_flow.cmj test/lazy_demo.cmi test/lazy_demo.cmj test/lazy_test.cmi test/lazy_test.cmj test/lib_js_test.cmi test/lib_js_test.cmj test/libarg_test.cmi test/libarg_test.cmj test/libqueue_test.cmi test/libqueue_test.cmj test/limits_test.cmi test/limits_test.cmj test/list_stack.cmi test/list_stack.cmj test/list_test.cmi test/list_test.cmj test/local_exception_test.cmi test/local_exception_test.cmj test/loop_regression_test.cmi test/loop_regression_test.cmj test/map_find_test.cmi test/map_find_test.cmj test/map_test.cmi test/map_test.cmj test/mario_game.cmi test/mario_game.cmj test/meth_annotation.cmi test/meth_annotation.cmj test/method_name_test.cmi test/method_name_test.cmj test/method_string_name.cmi test/method_string_name.cmj test/minimal_test.cmi test/minimal_test.cmj test/miss_colon_test.cmi test/miss_colon_test.cmj test/mock_mt.cmi test/mock_mt.cmj test/module_alias_test.cmi test/module_alias_test.cmj test/module_as_class_ffi.cmi test/module_as_class_ffi.cmj test/module_as_function.cmi test/module_as_function.cmj test/module_missing_conversion.cmi test/module_missing_conversion.cmj test/module_parameter_test.cmi test/module_parameter_test.cmj test/module_splice_test.cmi test/module_splice_test.cmj test/more_poly_variant_test.cmi test/more_poly_variant_test.cmj test/more_uncurry.cmi test/more_uncurry.cmj test/mpr_6033_test.cmi test/mpr_6033_test.cmj test/mt.cmi test/mt.cmj test/mt_global.cmi test/mt_global.cmj test/mutable_obj_test.cmi test/mutable_obj_test.cmj test/mutable_uncurry_test.cmi test/mutable_uncurry_test.cmj test/mutual_non_recursive_type.cmi test/mutual_non_recursive_type.cmj test/name_mangle_test.cmi test/name_mangle_test.cmj test/nested_include.cmi test/nested_include.cmj test/nested_module_alias.cmi test/nested_module_alias.cmj test/nested_obj_literal.cmi test/nested_obj_literal.cmj test/nested_obj_test.cmi test/nested_obj_test.cmj test/nested_pattern_match_test.cmi test/nested_pattern_match_test.cmj test/noassert.cmi test/noassert.cmj test/node_assert.cmi test/node_assert.cmj test/node_path_test.cmi test/node_path_test.cmj test/node_test.cmi test/node_test.cmj test/node_test_util.cmi test/node_test_util.cmj test/number_lexer.cmi test/number_lexer.cmj test/obj_literal_ppx.cmi test/obj_literal_ppx.cmj test/obj_literal_ppx_test.cmi test/obj_literal_ppx_test.cmj test/obj_magic_test.cmi test/obj_magic_test.cmj test/obj_type_test.cmi test/obj_type_test.cmj test/ocaml_re_test.cmi test/ocaml_re_test.cmj test/of_string_test.cmi test/of_string_test.cmj test/offset.cmi test/offset.cmj test/omit_trailing_undefined_in_external_calls.cmi test/omit_trailing_undefined_in_external_calls.cmj test/option_encoding_test.cmi test/option_encoding_test.cmj test/option_repr_test.cmi test/option_repr_test.cmj test/optional_ffi_test.cmi test/optional_ffi_test.cmj test/optional_regression_test.cmi test/optional_regression_test.cmj test/pipe_send_readline.cmi test/pipe_send_readline.cmj test/pipe_syntax.cmi test/pipe_syntax.cmj test/poly_empty_array.cmi test/poly_empty_array.cmj test/poly_variant_test.cmi test/poly_variant_test.cmj test/polymorphic_raw_test.cmi test/polymorphic_raw_test.cmj test/polymorphism_test.cmi test/polymorphism_test.cmj test/polyvar_convert.cmi test/polyvar_convert.cmj test/polyvar_test.cmi test/polyvar_test.cmj test/ppx_apply_test.cmi test/ppx_apply_test.cmj test/pq_test.cmi test/pq_test.cmj test/pr6726.cmi test/pr6726.cmj test/prepend_data_ffi.cmi test/prepend_data_ffi.cmj test/primitive_reg_test.cmi test/primitive_reg_test.cmj test/print_alpha_test.cmi test/print_alpha_test.cmj test/queue_402.cmi test/queue_402.cmj test/queue_test.cmi test/queue_test.cmj test/random_test.cmi test/random_test.cmj test/raw_hash_tbl_bench.cmi test/raw_hash_tbl_bench.cmj test/raw_output_test.cmi test/raw_output_test.cmj test/raw_pure_test.cmi test/raw_pure_test.cmj test/rbset.cmi test/rbset.cmj test/react.cmi test/react.cmj test/reactDOMRe.cmi test/reactDOMRe.cmj test/reactDOMServerRe.cmi test/reactDOMServerRe.cmj test/reactEvent.cmi test/reactEvent.cmj test/reactTestUtils.cmi test/reactTestUtils.cmj test/reasonReact.cmi test/reasonReact.cmj test/reasonReactCompat.cmi test/reasonReactCompat.cmj test/reasonReactOptimizedCreateClass.cmi test/reasonReactOptimizedCreateClass.cmj test/reasonReactRouter.cmi test/reasonReactRouter.cmj test/rebind_module.cmi test/rebind_module.cmj test/rebind_module_test.cmi test/rebind_module_test.cmj test/rec_array_test.cmi test/rec_array_test.cmj test/rec_fun_test.cmi test/rec_fun_test.cmj test/rec_module_opt.cmi test/rec_module_opt.cmj test/rec_module_test.cmi test/rec_module_test.cmj test/recmodule.cmi test/recmodule.cmj test/record_debug_test.cmi test/record_debug_test.cmj test/record_extension_test.cmi test/record_extension_test.cmj test/record_name_test.cmi test/record_name_test.cmj test/record_regression.cmi test/record_regression.cmj test/record_type_spread.cmi test/record_type_spread.cmj test/record_with_test.cmi test/record_with_test.cmj test/recursive_module.cmi test/recursive_module.cmj test/recursive_module_test.cmi test/recursive_module_test.cmj test/recursive_react_component.cmi test/recursive_react_component.cmj test/recursive_records_test.cmi test/recursive_records_test.cmj test/recursive_unbound_module_test.cmi test/recursive_unbound_module_test.cmj test/regression_print.cmi test/regression_print.cmj test/relative_path.cmi test/relative_path.cmj test/res_debug.cmi test/res_debug.cmj test/return_check.cmi test/return_check.cmj test/runtime_encoding_test.cmi test/runtime_encoding_test.cmj test/set_annotation.cmi test/set_annotation.cmj test/set_gen.cmi test/set_gen.cmj test/sexp.cmi test/sexp.cmj test/sexpm.cmi test/sexpm.cmj test/sexpm_test.cmi test/sexpm_test.cmj test/side_effect.cmi test/side_effect.cmj test/side_effect2.cmi test/side_effect2.cmj test/side_effect_free.cmi test/side_effect_free.cmj test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj test/single_module_alias.cmi test/single_module_alias.cmj test/singular_unit_test.cmi test/singular_unit_test.cmj test/small_inline_test.cmi test/small_inline_test.cmj test/splice_test.cmi test/splice_test.cmj test/stack_comp_test.cmi test/stack_comp_test.cmj test/stack_test.cmi test/stack_test.cmj test/stream_parser_test.cmi test/stream_parser_test.cmj test/string_bound_get_test.cmi test/string_bound_get_test.cmj test/string_constant_compare.cmi test/string_constant_compare.cmj test/string_get_set_test.cmi test/string_get_set_test.cmj test/string_runtime_test.cmi test/string_runtime_test.cmj test/string_set.cmi test/string_set.cmj test/string_set_test.cmi test/string_set_test.cmj test/string_test.cmi test/string_test.cmj test/string_unicode_test.cmi test/string_unicode_test.cmj test/stringmatch_test.cmi test/stringmatch_test.cmj test/submodule.cmi test/submodule.cmj test/submodule_call.cmi test/submodule_call.cmj test/switch_case_test.cmi test/switch_case_test.cmj test/switch_string.cmi test/switch_string.cmj test/tagged_template_test.cmi test/tagged_template_test.cmj test/tailcall_inline_test.cmi test/tailcall_inline_test.cmj test/template.cmi test/template.cmj test/test2.cmi test/test2.cmj test/test_alias.cmi test/test_alias.cmj test/test_ari.cmi test/test_ari.cmj test/test_array.cmi test/test_array.cmj test/test_array_append.cmi test/test_array_append.cmj test/test_array_primitive.cmi test/test_array_primitive.cmj test/test_bool_equal.cmi test/test_bool_equal.cmj test/test_bs_this.cmi test/test_bs_this.cmj test/test_bug.cmi test/test_bug.cmj test/test_bytes.cmi test/test_bytes.cmj test/test_case_opt_collision.cmi test/test_case_opt_collision.cmj test/test_case_set.cmi test/test_case_set.cmj test/test_char.cmi test/test_char.cmj test/test_closure.cmi test/test_closure.cmj test/test_common.cmi test/test_common.cmj test/test_const_elim.cmi test/test_const_elim.cmj test/test_const_propogate.cmi test/test_const_propogate.cmj test/test_cpp.cmi test/test_cpp.cmj test/test_cps.cmi test/test_cps.cmj test/test_demo.cmi test/test_demo.cmj test/test_dup_param.cmi test/test_dup_param.cmj test/test_eq.cmi test/test_eq.cmj test/test_exception.cmi test/test_exception.cmj test/test_exception_escape.cmi test/test_exception_escape.cmj test/test_export2.cmi test/test_export2.cmj test/test_external.cmi test/test_external.cmj test/test_external_unit.cmi test/test_external_unit.cmj test/test_ffi.cmi test/test_ffi.cmj test/test_fib.cmi test/test_fib.cmj test/test_filename.cmi test/test_filename.cmj test/test_for_loop.cmi test/test_for_loop.cmj test/test_for_map.cmi test/test_for_map.cmj test/test_for_map2.cmi test/test_for_map2.cmj test/test_functor_dead_code.cmi test/test_functor_dead_code.cmj test/test_generative_module.cmi test/test_generative_module.cmj test/test_global_print.cmi test/test_global_print.cmj test/test_google_closure.cmi test/test_google_closure.cmj test/test_include.cmi test/test_include.cmj test/test_incomplete.cmi test/test_incomplete.cmj test/test_incr_ref.cmi test/test_incr_ref.cmj test/test_int_map_find.cmi test/test_int_map_find.cmj test/test_is_js.cmi test/test_is_js.cmj test/test_js_ffi.cmi test/test_js_ffi.cmj test/test_let.cmi test/test_let.cmj test/test_list.cmi test/test_list.cmj test/test_literal.cmi test/test_literal.cmj test/test_literals.cmi test/test_literals.cmj test/test_match_exception.cmi test/test_match_exception.cmj test/test_mutliple.cmi test/test_mutliple.cmj test/test_nat64.cmi test/test_nat64.cmj test/test_nested_let.cmi test/test_nested_let.cmj test/test_nested_print.cmi test/test_nested_print.cmj test/test_non_export.cmi test/test_non_export.cmj test/test_nullary.cmi test/test_nullary.cmj test/test_obj.cmi test/test_obj.cmj test/test_order.cmi test/test_order.cmj test/test_order_tailcall.cmi test/test_order_tailcall.cmj test/test_other_exn.cmi test/test_other_exn.cmj test/test_per.cmi test/test_per.cmj test/test_pervasive.cmi test/test_pervasive.cmj test/test_pervasives2.cmi test/test_pervasives2.cmj test/test_pervasives3.cmi test/test_pervasives3.cmj test/test_primitive.cmi test/test_primitive.cmj test/test_ramification.cmi test/test_ramification.cmj test/test_react.cmi test/test_react.cmj test/test_react_case.cmi test/test_react_case.cmj test/test_regex.cmi test/test_regex.cmj test/test_runtime_encoding.cmi test/test_runtime_encoding.cmj test/test_scope.cmi test/test_scope.cmj test/test_seq.cmi test/test_seq.cmj test/test_set.cmi test/test_set.cmj test/test_side_effect_functor.cmi test/test_side_effect_functor.cmj test/test_simple_include.cmi test/test_simple_include.cmj test/test_simple_pattern_match.cmi test/test_simple_pattern_match.cmj test/test_simple_ref.cmi test/test_simple_ref.cmj test/test_simple_tailcall.cmi test/test_simple_tailcall.cmj test/test_small.cmi test/test_small.cmj test/test_stack.cmi test/test_stack.cmj test/test_static_catch_ident.cmi test/test_static_catch_ident.cmj test/test_string.cmi test/test_string.cmj test/test_string_case.cmi test/test_string_case.cmj test/test_string_const.cmi test/test_string_const.cmj test/test_string_map.cmi test/test_string_map.cmj test/test_string_switch.cmi test/test_string_switch.cmj test/test_switch.cmi test/test_switch.cmj test/test_trywith.cmi test/test_trywith.cmj test/test_tuple.cmi test/test_tuple.cmj test/test_tuple_destructring.cmi test/test_tuple_destructring.cmj test/test_type_based_arity.cmi test/test_type_based_arity.cmj test/test_u.cmi test/test_u.cmj test/test_unknown.cmi test/test_unknown.cmj test/test_unsafe_cmp.cmi test/test_unsafe_cmp.cmj test/test_unsafe_obj_ffi.cmi test/test_unsafe_obj_ffi.cmj test/test_unsafe_obj_ffi_ppx.cmi test/test_unsafe_obj_ffi_ppx.cmj test/test_while_closure.cmi test/test_while_closure.cmj test/test_while_side_effect.cmi test/test_while_side_effect.cmj test/test_zero_nullable.cmi test/test_zero_nullable.cmj test/then_mangle_test.cmi test/then_mangle_test.cmj test/ticker.cmi test/ticker.cmj test/to_string_test.cmi test/to_string_test.cmj test/topsort_test.cmi test/topsort_test.cmj test/tramp_fib.cmi test/tramp_fib.cmj test/tuple_alloc.cmi test/tuple_alloc.cmj test/type-coercion-free-vars.cmi test/type-coercion-free-vars.cmj test/type_disambiguate.cmi test/type_disambiguate.cmj test/typeof_test.cmi test/typeof_test.cmj test/unboxed_attribute.cmi test/unboxed_attribute.cmj test/unboxed_attribute_test.cmi test/unboxed_attribute_test.cmj test/unboxed_crash.cmi test/unboxed_crash.cmj test/unboxed_use_case.cmi test/unboxed_use_case.cmj test/uncurried_cast.cmi test/uncurried_cast.cmj test/uncurried_default.args.cmi test/uncurried_default.args.cmj test/uncurried_pipe.cmi test/uncurried_pipe.cmj test/uncurry_external_test.cmi test/uncurry_external_test.cmj test/uncurry_glob_test.cmi test/uncurry_glob_test.cmj test/uncurry_test.cmi test/uncurry_test.cmj test/undef_regression_test.cmi test/undef_regression_test.cmj test/unit_undefined_test.cmi test/unit_undefined_test.cmj test/unsafe_full_apply_primitive.cmi test/unsafe_full_apply_primitive.cmj test/unsafe_ppx_test.cmi test/unsafe_ppx_test.cmj test/update_record_test.cmi test/update_record_test.cmj test/variant.cmi test/variant.cmj test/variantsMatching.cmi test/variantsMatching.cmj test/webpack_config.cmi test/webpack_config.cmj diff --git a/jscomp/test/node_assert.res b/jscomp/test/node_assert.res index 584df1c8e2..69be2a90c2 100644 --- a/jscomp/test/node_assert.res +++ b/jscomp/test/node_assert.res @@ -4,3 +4,4 @@ @module("node:assert") external notDeepEqual: ('a, 'a, ~message: string=?) => unit = "notDeepStrictEqual" @module("node:assert") external fail: (~message: string=?) => unit = "fail" +@module("node:assert") external throws: (unit => unit, ~error: 'a=?, ~message: string=?) => unit = "throws" diff --git a/jscomp/test/node_test_util.js b/jscomp/test/node_test_util.js new file mode 100644 index 0000000000..272a721080 --- /dev/null +++ b/jscomp/test/node_test_util.js @@ -0,0 +1,21 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +let Nodeassert = require("node:assert"); + +function ok(loc, a) { + Nodeassert.ok(a, loc); +} + +function eq(loc, a, b) { + Nodeassert.deepStrictEqual(a, b, loc); +} + +function $$throw(loc, f) { + Nodeassert.throws(f, undefined, loc); +} + +exports.ok = ok; +exports.eq = eq; +exports.$$throw = $$throw; +/* node:assert Not a pure module */ diff --git a/jscomp/test/node_test_util.res b/jscomp/test/node_test_util.res new file mode 100644 index 0000000000..da81707236 --- /dev/null +++ b/jscomp/test/node_test_util.res @@ -0,0 +1,3 @@ +let ok = (loc, a) => Node_assert.ok(a, ~message=loc) +let eq = (loc, a, b) => Node_assert.deepEqual(a, b, ~message=loc) +let throw = (loc, f) => Node_assert.throws(f, ~message=loc) diff --git a/jscomp/test/record_extension_test.js b/jscomp/test/record_extension_test.js index 8a81d1d76d..dedeabf26c 100644 --- a/jscomp/test/record_extension_test.js +++ b/jscomp/test/record_extension_test.js @@ -96,7 +96,7 @@ function u(f) { } } -eq("File \"record_extension_test.res\", line 59, characters 3-10", u(function () { +eq("File \"record_extension_test.res\", line 59, characters 3-10", u(() => { throw new Error(A, { cause: { RE_EXN_ID: A, @@ -106,7 +106,7 @@ eq("File \"record_extension_test.res\", line 59, characters 3-10", u(function () }); }), 2); -eq("File \"record_extension_test.res\", line 60, characters 3-10", u(function () { +eq("File \"record_extension_test.res\", line 60, characters 3-10", u(() => { throw new Error(B, { cause: { RE_EXN_ID: B, @@ -116,7 +116,7 @@ eq("File \"record_extension_test.res\", line 60, characters 3-10", u(function () }); }), 3); -eq("File \"record_extension_test.res\", line 61, characters 3-10", u(function () { +eq("File \"record_extension_test.res\", line 61, characters 3-10", u(() => { throw new Error(C, { cause: { RE_EXN_ID: C,