diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9f8c3366..3c4d4ed6b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ - Move `ounit_tests` into the `tests` folder. https://github.com/rescript-lang/rescript-compiler/pull/7096 - Move `syntax_tests` into the `tests` folder. https://github.com/rescript-lang/rescript-compiler/pull/7090 https://github.com/rescript-lang/rescript-compiler/pull/7097 - Capitalize runtime filenames. https://github.com/rescript-lang/rescript-compiler/pull/7110 +- Build mocha tests as esmodule / .mjs. https://github.com/rescript-lang/rescript-compiler/pull/7115 # 12.0.0-alpha.3 diff --git a/biome.json b/biome.json index d0163d504c..9899a7bbc5 100644 --- a/biome.json +++ b/biome.json @@ -23,7 +23,6 @@ "ignore": [ "tests/build_tests/**", "tests/tests/**", - "tests/tests_esmodule/**", "lib/**", "ninja/**", "playground/**", diff --git a/scripts/test.js b/scripts/test.js index ebba6688c9..f55482b211 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -65,12 +65,7 @@ async function runTests() { stdio: [0, 1, 2], }); - cp.execSync(rescript_exe, { - cwd: path.join(__dirname, "..", "tests/tests_esmodule"), - stdio: [0, 1, 2], - }); - - cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.js`, { + cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.mjs`, { cwd: path.join(__dirname, ".."), stdio: [0, 1, 2], }); diff --git a/tests/tests/rescript.json b/tests/tests/rescript.json index 69ceca9c90..c7dfdd6f05 100644 --- a/tests/tests/rescript.json +++ b/tests/tests/rescript.json @@ -7,8 +7,9 @@ } ], "package-specs": { - "module": "commonjs", - "in-source": true + "module": "esmodule", + "in-source": true, + "suffix": ".mjs" }, "bsc-flags": [ "-w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104", diff --git a/tests/tests/src/AsInUncurriedExternals.js b/tests/tests/src/AsInUncurriedExternals.js deleted file mode 100644 index 70125156e8..0000000000 --- a/tests/tests/src/AsInUncurriedExternals.js +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function mo(prim0, prim1) { - return { - objectMode: false, - name: prim0, - someOther: true - }; -} - -let options = { - objectMode: false, - name: "foo", - someOther: true -}; - -function shouldNotFail(objectMode, name) { - return 3; -} - -exports.mo = mo; -exports.options = options; -exports.shouldNotFail = shouldNotFail; -/* No side effect */ diff --git a/tests/tests/src/AsInUncurriedExternals.mjs b/tests/tests/src/AsInUncurriedExternals.mjs new file mode 100644 index 0000000000..28e4aa1779 --- /dev/null +++ b/tests/tests/src/AsInUncurriedExternals.mjs @@ -0,0 +1,27 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function mo(prim0, prim1) { + return { + objectMode: false, + name: prim0, + someOther: true + }; +} + +let options = { + objectMode: false, + name: "foo", + someOther: true +}; + +function shouldNotFail(objectMode, name) { + return 3; +} + +export { + mo, + options, + shouldNotFail, +} +/* No side effect */ diff --git a/tests/tests/src/Coercion.js b/tests/tests/src/Coercion.js deleted file mode 100644 index 2758b87ff9..0000000000 --- a/tests/tests/src/Coercion.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function foo(x) { - return x; -} - -let x = 1; - -let xx = 1; - -exports.x = x; -exports.xx = xx; -exports.foo = foo; -/* No side effect */ diff --git a/tests/tests/src/Coercion.mjs b/tests/tests/src/Coercion.mjs new file mode 100644 index 0000000000..09865533c0 --- /dev/null +++ b/tests/tests/src/Coercion.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function foo(x) { + return x; +} + +let x = 1; + +let xx = 1; + +export { + x, + xx, + foo, +} +/* No side effect */ diff --git a/tests/tests/src/DerivingAccessorsCurried.js b/tests/tests/src/DerivingAccessorsCurried.js deleted file mode 100644 index 49a7d6079e..0000000000 --- a/tests/tests/src/DerivingAccessorsCurried.js +++ /dev/null @@ -1,56 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function myField(param) { - return param.myField; -} - -function num(param_0) { - return { - TAG: "Num", - _0: param_0 - }; -} - -function doubleNum(param_0, param_1) { - return { - TAG: "DoubleNum", - _0: param_0, - _1: param_1 - }; -} - -function compose(a, accessor) { - return accessor(a); -} - -let _composedMyField = 1; - -let _composedNum = { - TAG: "Num", - _0: 1 -}; - -let noParam = "NoParam"; - -let _myFieldAlias = myField; - -let _noParamAlias = "NoParam"; - -let _numAlias = num; - -let _doubleNumAlias = doubleNum; - -exports.myField = myField; -exports.noParam = noParam; -exports.num = num; -exports.doubleNum = doubleNum; -exports._myFieldAlias = _myFieldAlias; -exports._noParamAlias = _noParamAlias; -exports._numAlias = _numAlias; -exports._doubleNumAlias = _doubleNumAlias; -exports.compose = compose; -exports._composedMyField = _composedMyField; -exports._composedNum = _composedNum; -/* No side effect */ diff --git a/tests/tests/src/DerivingAccessorsCurried.mjs b/tests/tests/src/DerivingAccessorsCurried.mjs new file mode 100644 index 0000000000..a816cc5575 --- /dev/null +++ b/tests/tests/src/DerivingAccessorsCurried.mjs @@ -0,0 +1,57 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function myField(param) { + return param.myField; +} + +function num(param_0) { + return { + TAG: "Num", + _0: param_0 + }; +} + +function doubleNum(param_0, param_1) { + return { + TAG: "DoubleNum", + _0: param_0, + _1: param_1 + }; +} + +function compose(a, accessor) { + return accessor(a); +} + +let _composedMyField = 1; + +let _composedNum = { + TAG: "Num", + _0: 1 +}; + +let noParam = "NoParam"; + +let _myFieldAlias = myField; + +let _noParamAlias = "NoParam"; + +let _numAlias = num; + +let _doubleNumAlias = doubleNum; + +export { + myField, + noParam, + num, + doubleNum, + _myFieldAlias, + _noParamAlias, + _numAlias, + _doubleNumAlias, + compose, + _composedMyField, + _composedNum, +} +/* No side effect */ diff --git a/tests/tests/src/DerivingAccessorsUncurried.js b/tests/tests/src/DerivingAccessorsUncurried.js deleted file mode 100644 index 49a7d6079e..0000000000 --- a/tests/tests/src/DerivingAccessorsUncurried.js +++ /dev/null @@ -1,56 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function myField(param) { - return param.myField; -} - -function num(param_0) { - return { - TAG: "Num", - _0: param_0 - }; -} - -function doubleNum(param_0, param_1) { - return { - TAG: "DoubleNum", - _0: param_0, - _1: param_1 - }; -} - -function compose(a, accessor) { - return accessor(a); -} - -let _composedMyField = 1; - -let _composedNum = { - TAG: "Num", - _0: 1 -}; - -let noParam = "NoParam"; - -let _myFieldAlias = myField; - -let _noParamAlias = "NoParam"; - -let _numAlias = num; - -let _doubleNumAlias = doubleNum; - -exports.myField = myField; -exports.noParam = noParam; -exports.num = num; -exports.doubleNum = doubleNum; -exports._myFieldAlias = _myFieldAlias; -exports._noParamAlias = _noParamAlias; -exports._numAlias = _numAlias; -exports._doubleNumAlias = _doubleNumAlias; -exports.compose = compose; -exports._composedMyField = _composedMyField; -exports._composedNum = _composedNum; -/* No side effect */ diff --git a/tests/tests/src/DerivingAccessorsUncurried.mjs b/tests/tests/src/DerivingAccessorsUncurried.mjs new file mode 100644 index 0000000000..a816cc5575 --- /dev/null +++ b/tests/tests/src/DerivingAccessorsUncurried.mjs @@ -0,0 +1,57 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function myField(param) { + return param.myField; +} + +function num(param_0) { + return { + TAG: "Num", + _0: param_0 + }; +} + +function doubleNum(param_0, param_1) { + return { + TAG: "DoubleNum", + _0: param_0, + _1: param_1 + }; +} + +function compose(a, accessor) { + return accessor(a); +} + +let _composedMyField = 1; + +let _composedNum = { + TAG: "Num", + _0: 1 +}; + +let noParam = "NoParam"; + +let _myFieldAlias = myField; + +let _noParamAlias = "NoParam"; + +let _numAlias = num; + +let _doubleNumAlias = doubleNum; + +export { + myField, + noParam, + num, + doubleNum, + _myFieldAlias, + _noParamAlias, + _numAlias, + _doubleNumAlias, + compose, + _composedMyField, + _composedNum, +} +/* No side effect */ diff --git a/tests/tests/src/DictInference.js b/tests/tests/src/DictInference.js deleted file mode 100644 index 24a2e5dc63..0000000000 --- a/tests/tests/src/DictInference.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Js_dict = require("rescript/lib/js/Js_dict.js"); - -let dict = {}; - -dict["someKey1"] = 1; - -dict["someKey2"] = 2; - -let asArray = Js_dict.values(dict); - -exports.dict = dict; -exports.asArray = asArray; -/* Not a pure module */ diff --git a/tests/tests/src/DictInference.mjs b/tests/tests/src/DictInference.mjs new file mode 100644 index 0000000000..cbeae632fc --- /dev/null +++ b/tests/tests/src/DictInference.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Js_dict from "rescript/lib/es6/Js_dict.js"; + +let dict = {}; + +dict["someKey1"] = 1; + +dict["someKey2"] = 2; + +let asArray = Js_dict.values(dict); + +export { + dict, + asArray, +} +/* Not a pure module */ diff --git a/tests/tests/src/DictInternalRepresentation.js b/tests/tests/src/DictInternalRepresentation.js deleted file mode 100644 index 641a311cdb..0000000000 --- a/tests/tests/src/DictInternalRepresentation.js +++ /dev/null @@ -1,28 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let stringDict = { - first: "hello" -}; - -let intDict = { - first: 1 -}; - -function foo() { - let first = stringDict.first; - let first$1 = first !== undefined ? first + "2" : "hello"; - console.log(first$1); - let first$2 = intDict.first; - let second = first$2 !== undefined ? first$2 + 2 | 0 : 1; - console.log(second); - let first$3 = stringDict.first; - let third = first$3 !== undefined ? first$3 + "2" : "hello"; - console.log(third); -} - -exports.stringDict = stringDict; -exports.intDict = intDict; -exports.foo = foo; -/* No side effect */ diff --git a/tests/tests/src/DictInternalRepresentation.mjs b/tests/tests/src/DictInternalRepresentation.mjs new file mode 100644 index 0000000000..062d1755ae --- /dev/null +++ b/tests/tests/src/DictInternalRepresentation.mjs @@ -0,0 +1,29 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let stringDict = { + first: "hello" +}; + +let intDict = { + first: 1 +}; + +function foo() { + let first = stringDict.first; + let first$1 = first !== undefined ? first + "2" : "hello"; + console.log(first$1); + let first$2 = intDict.first; + let second = first$2 !== undefined ? first$2 + 2 | 0 : 1; + console.log(second); + let first$3 = stringDict.first; + let third = first$3 !== undefined ? first$3 + "2" : "hello"; + console.log(third); +} + +export { + stringDict, + intDict, + foo, +} +/* No side effect */ diff --git a/tests/tests/src/DictTests.js b/tests/tests/src/DictTests.js deleted file mode 100644 index 5d9df63325..0000000000 --- a/tests/tests/src/DictTests.js +++ /dev/null @@ -1,63 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let someString = "hello"; - -let createdDict = { - name: "hello", - age: "what", - more: "stuff", - otherStr: someString -}; - -let intDict = { - one: 1, - two: 2, - three: 3 -}; - -function inferDictByPattern(dict) { - let match = dict.one; - if (match === 1) { - let match$1 = dict.three; - if (match$1 === 3) { - let match$2 = dict.four; - if (match$2 === 4) { - dict["five"] = 5; - return; - } - - } - - } - let match$3 = dict.two; - if (match$3 === 1) { - console.log("two"); - } else { - console.log("not one"); - } -} - -function constrainedAsDict(dict) { - let match = dict.one; - if (match === 1) { - console.log("one"); - } else { - console.log("not one"); - } -} - -let PatternMatching = { - inferDictByPattern: inferDictByPattern, - constrainedAsDict: constrainedAsDict -}; - -let three = 3; - -exports.someString = someString; -exports.createdDict = createdDict; -exports.three = three; -exports.intDict = intDict; -exports.PatternMatching = PatternMatching; -/* No side effect */ diff --git a/tests/tests/src/DictTests.mjs b/tests/tests/src/DictTests.mjs new file mode 100644 index 0000000000..703caeb496 --- /dev/null +++ b/tests/tests/src/DictTests.mjs @@ -0,0 +1,64 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let someString = "hello"; + +let createdDict = { + name: "hello", + age: "what", + more: "stuff", + otherStr: someString +}; + +let intDict = { + one: 1, + two: 2, + three: 3 +}; + +function inferDictByPattern(dict) { + let match = dict.one; + if (match === 1) { + let match$1 = dict.three; + if (match$1 === 3) { + let match$2 = dict.four; + if (match$2 === 4) { + dict["five"] = 5; + return; + } + + } + + } + let match$3 = dict.two; + if (match$3 === 1) { + console.log("two"); + } else { + console.log("not one"); + } +} + +function constrainedAsDict(dict) { + let match = dict.one; + if (match === 1) { + console.log("one"); + } else { + console.log("not one"); + } +} + +let PatternMatching = { + inferDictByPattern: inferDictByPattern, + constrainedAsDict: constrainedAsDict +}; + +let three = 3; + +export { + someString, + createdDict, + three, + intDict, + PatternMatching, +} +/* No side effect */ diff --git a/tests/tests/src/DisambiguateOptionalFields.js b/tests/tests/src/DisambiguateOptionalFields.js deleted file mode 100644 index 976d5e9947..0000000000 --- a/tests/tests/src/DisambiguateOptionalFields.js +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f1(v) { - return v.x; -} - -function f2(v) { - return v.x; -} - -let res = 3; - -let v = { - x: 3, - y: 4 -}; - -exports.f1 = f1; -exports.f2 = f2; -exports.v = v; -exports.res = res; -/* No side effect */ diff --git a/tests/tests/src/DisambiguateOptionalFields.mjs b/tests/tests/src/DisambiguateOptionalFields.mjs new file mode 100644 index 0000000000..ac27a889db --- /dev/null +++ b/tests/tests/src/DisambiguateOptionalFields.mjs @@ -0,0 +1,25 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f1(v) { + return v.x; +} + +function f2(v) { + return v.x; +} + +let res = 3; + +let v = { + x: 3, + y: 4 +}; + +export { + f1, + f2, + v, + res, +} +/* No side effect */ diff --git a/tests/tests/src/DotDotDot.js b/tests/tests/src/DotDotDot.js deleted file mode 100644 index 0676103de3..0000000000 --- a/tests/tests/src/DotDotDot.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let MultipleDotDotDots = { - x: { - x: 10, - y: "abc" - } -}; - -let v = { - x: 10, - y: "", - z: "" -}; - -let v2 = { - x: 10, - y: "", - z: "", - v: 1.0, - w: 2.0 -}; - -let x = { - name: "test", - x: "test" -}; - -exports.v = v; -exports.v2 = v2; -exports.x = x; -exports.MultipleDotDotDots = MultipleDotDotDots; -/* No side effect */ diff --git a/tests/tests/src/DotDotDot.mjs b/tests/tests/src/DotDotDot.mjs new file mode 100644 index 0000000000..cd6bc310bc --- /dev/null +++ b/tests/tests/src/DotDotDot.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let MultipleDotDotDots = { + x: { + x: 10, + y: "abc" + } +}; + +let v = { + x: 10, + y: "", + z: "" +}; + +let v2 = { + x: 10, + y: "", + z: "", + v: 1.0, + w: 2.0 +}; + +let x = { + name: "test", + x: "test" +}; + +export { + v, + v2, + x, + MultipleDotDotDots, +} +/* No side effect */ diff --git a/tests/tests/src/EmptyRecord.js b/tests/tests/src/EmptyRecord.js deleted file mode 100644 index 57aa613b2b..0000000000 --- a/tests/tests/src/EmptyRecord.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function construct(b) { - if (b) { - return { - n: 0 - }; - } else { - return {}; - } -} - -let er = {}; - -exports.construct = construct; -exports.er = er; -/* No side effect */ diff --git a/tests/tests/src/EmptyRecord.mjs b/tests/tests/src/EmptyRecord.mjs new file mode 100644 index 0000000000..de9024c1ab --- /dev/null +++ b/tests/tests/src/EmptyRecord.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function construct(b) { + if (b) { + return { + n: 0 + }; + } else { + return {}; + } +} + +let er = {}; + +export { + construct, + er, +} +/* No side effect */ diff --git a/tests/tests/src/ExternalArity.js b/tests/tests/src/ExternalArity.js deleted file mode 100644 index 433cfc052c..0000000000 --- a/tests/tests/src/ExternalArity.js +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let ReactIntl = require("react-intl"); -let JsxRuntime = require("react/jsx-runtime"); - -function f1(x) { - return v(x, x); -} - -function f2(x) { - return v(x, x); -} - -let test1 = foo1(10); - -let test2 = foo2(20); - -let test3 = foo3(undefined, 3); - -let FromTypeConstructor = { - test1: test1, - test2: test2, - test3: test3 -}; - -let React = {}; - -let FormattedMessage = {}; - -JsxRuntime.jsx(ReactIntl.FormattedMessage, { - id: "test", - defaultMessage: "Test" -}); - -let ReactTest = { - React: React, - FormattedMessage: FormattedMessage -}; - -exports.f1 = f1; -exports.f2 = f2; -exports.FromTypeConstructor = FromTypeConstructor; -exports.ReactTest = ReactTest; -/* test1 Not a pure module */ diff --git a/tests/tests/src/ExternalArity.mjs b/tests/tests/src/ExternalArity.mjs new file mode 100644 index 0000000000..1de3ab38f2 --- /dev/null +++ b/tests/tests/src/ExternalArity.mjs @@ -0,0 +1,46 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as ReactIntl from "react-intl"; +import * as JsxRuntime from "react/jsx-runtime"; + +function f1(x) { + return v(x, x); +} + +function f2(x) { + return v(x, x); +} + +let test1 = foo1(10); + +let test2 = foo2(20); + +let test3 = foo3(undefined, 3); + +let FromTypeConstructor = { + test1: test1, + test2: test2, + test3: test3 +}; + +let React = {}; + +let FormattedMessage = {}; + +JsxRuntime.jsx(ReactIntl.FormattedMessage, { + id: "test", + defaultMessage: "Test" +}); + +let ReactTest = { + React: React, + FormattedMessage: FormattedMessage +}; + +export { + f1, + f2, + FromTypeConstructor, + ReactTest, +} +/* test1 Not a pure module */ diff --git a/tests/tests/src/FFI.js b/tests/tests/src/FFI.js deleted file mode 100644 index bdcec5cad2..0000000000 --- a/tests/tests/src/FFI.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let canUseCanvas = (function canUseCanvas() { - return !!document.createElement('canvas').getContext; - }); - -let add = ((x,y)=>x+y); - -exports.canUseCanvas = canUseCanvas; -exports.add = add; -/* No side effect */ diff --git a/tests/tests/src/FFI.mjs b/tests/tests/src/FFI.mjs new file mode 100644 index 0000000000..5d3c2a968a --- /dev/null +++ b/tests/tests/src/FFI.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let canUseCanvas = (function canUseCanvas() { + return !!document.createElement('canvas').getContext; + }); + +let add = ((x,y)=>x+y); + +export { + canUseCanvas, + add, +} +/* No side effect */ diff --git a/tests/tests/src/Import.js b/tests/tests/src/Import.js deleted file mode 100644 index c5ffd55992..0000000000 --- a/tests/tests/src/Import.js +++ /dev/null @@ -1,148 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Js_promise = require("rescript/lib/js/Js_promise.js"); - -async function eachIntAsync(list, f) { - return (await import("rescript/lib/js/Belt_List.js").then(m => m.forEach))(list, f); -} - -function eachIntLazy(list, f) { - return Js_promise.then_(each => Promise.resolve(each(list, f)), import("rescript/lib/js/Belt_List.js").then(m => m.forEach)); -} - -eachIntLazy({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, n => { - console.log("lazy", n); -}); - -eachIntAsync({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}, n => { - console.log("async", n); -}); - -let beltAsModule = await import("rescript/lib/js/Belt_List.js"); - -let M = await import("rescript/lib/js/Belt_List.js"); - -let N0 = await import("rescript/lib/js/Belt_List.js"); - -let O = await import("rescript/lib/js/Belt_List.js"); - -let N1_each = O.forEach; - -let N1 = { - O: O, - each: N1_each -}; - -let N2 = await import("rescript/lib/js/Belt_List.js"); - -let N_each = N2.forEach; - -let N = { - N0: N0, - N1: N1, - N2: N2, - each: N_each -}; - -let M0 = await import("rescript/lib/js/Belt_List.js"); - -let M1 = await import("rescript/lib/js/Belt_List.js"); - -async function f() { - return (await import("rescript/lib/js/Belt_List.js")).forEach; -} - -async function f1() { - return (await import("rescript/lib/js/Belt_List.js")).forEach; -} - -async function f2() { - let M3 = await import("rescript/lib/js/Belt_List.js"); - let M4 = await import("rescript/lib/js/Belt_List.js"); - return [ - M3.forEach, - M4.forEach - ]; -} - -async function f3() { - let M3 = await import("rescript/lib/js/Belt_List.js"); - let M4 = await import("rescript/lib/js/Belt_List.js"); - return [ - M3.forEach, - M4.forEach - ]; -} - -async function f4() { - return (await import("rescript/lib/js/Belt_Array.js")).forEach; -} - -async function f5() { - let A = await import("rescript/lib/js/Belt_Array.js"); - let O = await import("rescript/lib/js/Belt_Option.js"); - return [ - A.forEach, - O.forEach - ]; -} - -async function f6() { - let MS = await import("rescript/lib/js/Belt_MapString.js"); - let A = await import("rescript/lib/js/Belt_Array.js"); - return [ - 0, - MS.forEach, - A.forEach - ]; -} - -async function f7() { - await import("rescript/lib/js/Belt_MapInt.js"); - return 1; -} - -let each = M1.forEach; - -let M2; - -let each2 = O.forEach; - -exports.eachIntAsync = eachIntAsync; -exports.eachIntLazy = eachIntLazy; -exports.beltAsModule = beltAsModule; -exports.M = M; -exports.N = N; -exports.M0 = M0; -exports.M1 = M1; -exports.each = each; -exports.M2 = M2; -exports.each2 = each2; -exports.f = f; -exports.f1 = f1; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -exports.f5 = f5; -exports.f6 = f6; -exports.f7 = f7; -/* Not a pure module */ diff --git a/tests/tests/src/Import.mjs b/tests/tests/src/Import.mjs new file mode 100644 index 0000000000..88bd6e1554 --- /dev/null +++ b/tests/tests/src/Import.mjs @@ -0,0 +1,149 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Js_promise from "rescript/lib/es6/Js_promise.js"; + +async function eachIntAsync(list, f) { + return (await import("rescript/lib/es6/Belt_List.js").then(m => m.forEach))(list, f); +} + +function eachIntLazy(list, f) { + return Js_promise.then_(each => Promise.resolve(each(list, f)), import("rescript/lib/es6/Belt_List.js").then(m => m.forEach)); +} + +eachIntLazy({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}, n => { + console.log("lazy", n); +}); + +eachIntAsync({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}, n => { + console.log("async", n); +}); + +let beltAsModule = await import("rescript/lib/es6/Belt_List.js"); + +let M = await import("rescript/lib/es6/Belt_List.js"); + +let N0 = await import("rescript/lib/es6/Belt_List.js"); + +let O = await import("rescript/lib/es6/Belt_List.js"); + +let N1_each = O.forEach; + +let N1 = { + O: O, + each: N1_each +}; + +let N2 = await import("rescript/lib/es6/Belt_List.js"); + +let N_each = N2.forEach; + +let N = { + N0: N0, + N1: N1, + N2: N2, + each: N_each +}; + +let M0 = await import("rescript/lib/es6/Belt_List.js"); + +let M1 = await import("rescript/lib/es6/Belt_List.js"); + +async function f() { + return (await import("rescript/lib/es6/Belt_List.js")).forEach; +} + +async function f1() { + return (await import("rescript/lib/es6/Belt_List.js")).forEach; +} + +async function f2() { + let M3 = await import("rescript/lib/es6/Belt_List.js"); + let M4 = await import("rescript/lib/es6/Belt_List.js"); + return [ + M3.forEach, + M4.forEach + ]; +} + +async function f3() { + let M3 = await import("rescript/lib/es6/Belt_List.js"); + let M4 = await import("rescript/lib/es6/Belt_List.js"); + return [ + M3.forEach, + M4.forEach + ]; +} + +async function f4() { + return (await import("rescript/lib/es6/Belt_Array.js")).forEach; +} + +async function f5() { + let A = await import("rescript/lib/es6/Belt_Array.js"); + let O = await import("rescript/lib/es6/Belt_Option.js"); + return [ + A.forEach, + O.forEach + ]; +} + +async function f6() { + let MS = await import("rescript/lib/es6/Belt_MapString.js"); + let A = await import("rescript/lib/es6/Belt_Array.js"); + return [ + 0, + MS.forEach, + A.forEach + ]; +} + +async function f7() { + await import("rescript/lib/es6/Belt_MapInt.js"); + return 1; +} + +let each = M1.forEach; + +let M2; + +let each2 = O.forEach; + +export { + eachIntAsync, + eachIntLazy, + beltAsModule, + M, + N, + M0, + M1, + each, + M2, + each2, + f, + f1, + f2, + f3, + f4, + f5, + f6, + f7, +} +/* Not a pure module */ diff --git a/tests/tests_esmodule/src/ImportAttributes.mjs b/tests/tests/src/ImportAttributes.mjs similarity index 100% rename from tests/tests_esmodule/src/ImportAttributes.mjs rename to tests/tests/src/ImportAttributes.mjs diff --git a/tests/tests_esmodule/src/ImportAttributes.res b/tests/tests/src/ImportAttributes.res similarity index 100% rename from tests/tests_esmodule/src/ImportAttributes.res rename to tests/tests/src/ImportAttributes.res diff --git a/tests/tests/src/PartialApplicationNoRuntimeCurry.js b/tests/tests/src/PartialApplicationNoRuntimeCurry.js deleted file mode 100644 index 1a69368f5f..0000000000 --- a/tests/tests/src/PartialApplicationNoRuntimeCurry.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function add(x) { - return (y, z) => (x + y | 0) + z | 0; -} - -function f(u) { - let f$1 = add(u); - return extra => f$1(1, extra); -} - -exports.add = add; -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/PartialApplicationNoRuntimeCurry.mjs b/tests/tests/src/PartialApplicationNoRuntimeCurry.mjs new file mode 100644 index 0000000000..5f6d3c4bbf --- /dev/null +++ b/tests/tests/src/PartialApplicationNoRuntimeCurry.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function add(x) { + return (y, z) => (x + y | 0) + z | 0; +} + +function f(u) { + let f$1 = add(u); + return extra => f$1(1, extra); +} + +export { + add, + f, +} +/* No side effect */ diff --git a/tests/tests/src/RecordCoercion.js b/tests/tests/src/RecordCoercion.js deleted file mode 100644 index e9fa2b9606..0000000000 --- a/tests/tests/src/RecordCoercion.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let TestInlining_a = { - number: 42, - name: "a" -}; - -let TestInlining = { - a: TestInlining_a, - name: "a" -}; - -exports.TestInlining = TestInlining; -/* No side effect */ diff --git a/tests/tests/src/RecordCoercion.mjs b/tests/tests/src/RecordCoercion.mjs new file mode 100644 index 0000000000..5db90d2501 --- /dev/null +++ b/tests/tests/src/RecordCoercion.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let TestInlining_a = { + number: 42, + name: "a" +}; + +let TestInlining = { + a: TestInlining_a, + name: "a" +}; + +export { + TestInlining, +} +/* No side effect */ diff --git a/tests/tests/src/RecordOrObject.js b/tests/tests/src/RecordOrObject.js deleted file mode 100644 index 9735fdfe20..0000000000 --- a/tests/tests/src/RecordOrObject.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let vxy = { - x: 10, - y: "abc" -}; - -let xxi = { - x: 10 -}; - -exports.vxy = vxy; -exports.xxi = xxi; -/* No side effect */ diff --git a/tests/tests/src/RecordOrObject.mjs b/tests/tests/src/RecordOrObject.mjs new file mode 100644 index 0000000000..582f738a42 --- /dev/null +++ b/tests/tests/src/RecordOrObject.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let vxy = { + x: 10, + y: "abc" +}; + +let xxi = { + x: 10 +}; + +export { + vxy, + xxi, +} +/* No side effect */ diff --git a/tests/tests/src/SafePromises.js b/tests/tests/src/SafePromises.js deleted file mode 100644 index b809531c71..0000000000 --- a/tests/tests/src/SafePromises.js +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Js_promise = require("rescript/lib/js/Js_promise.js"); -let Js_promise2 = require("rescript/lib/js/Js_promise2.js"); - -async function nestedPromise(xxx) { - let xx = await xxx; - Js_promise2.then(xx, x => Promise.resolve((console.log("Promise2.then", x), undefined))); - Js_promise2.$$catch(xx, x => { - console.log("Promise2.catch_", x); - return Promise.resolve(0); - }); - Js_promise.then_(x => Promise.resolve((console.log("Promise.then_", x), undefined)), xx); -} - -async function create(x) { - console.log("create", x); - return x; -} - -let xx = create(10); - -let xxx = create(xx); - -nestedPromise(xxx); - -exports.nestedPromise = nestedPromise; -exports.create = create; -exports.xx = xx; -exports.xxx = xxx; -/* xx Not a pure module */ diff --git a/tests/tests/src/SafePromises.mjs b/tests/tests/src/SafePromises.mjs new file mode 100644 index 0000000000..4a38f9e2a8 --- /dev/null +++ b/tests/tests/src/SafePromises.mjs @@ -0,0 +1,33 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Js_promise from "rescript/lib/es6/Js_promise.js"; +import * as Js_promise2 from "rescript/lib/es6/Js_promise2.js"; + +async function nestedPromise(xxx) { + let xx = await xxx; + Js_promise2.then(xx, x => Promise.resolve((console.log("Promise2.then", x), undefined))); + Js_promise2.$$catch(xx, x => { + console.log("Promise2.catch_", x); + return Promise.resolve(0); + }); + Js_promise.then_(x => Promise.resolve((console.log("Promise.then_", x), undefined)), xx); +} + +async function create(x) { + console.log("create", x); + return x; +} + +let xx = create(10); + +let xxx = create(xx); + +nestedPromise(xxx); + +export { + nestedPromise, + create, + xx, + xxx, +} +/* xx Not a pure module */ diff --git a/tests/tests/src/UncurriedAlways.js b/tests/tests/src/UncurriedAlways.js deleted file mode 100644 index 601d3bfe3a..0000000000 --- a/tests/tests/src/UncurriedAlways.js +++ /dev/null @@ -1,268 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function foo(x, y) { - return x + y | 0; -} - -let z = 7; - -function bar(x, y) { - return x + y | 0; -} - -let b = 7; - -let w = 7; - -let a = 7; - -console.log(a); - -[1].map(x => x + 1 | 0); - -function ptl(extra) { - return 10 + extra | 0; -} - -function foo2(x, y) { - return x + y | 0; -} - -function bar2(__x) { - return __x + 3 | 0; -} - -function foo3(x, y, z) { - return (x + y | 0) + z | 0; -} - -function bar3(__x) { - return foo3(__x, 3, 4); -} - -function q(param) { - return null; -} - -function inl() { - -} - -function inl2(x, y) { - return x + y | 0; -} - -function foo$1(x, y, z) { - return [ - x, - y, - z - ]; -} - -function ptl$1(none, extra) { - return [ - none, - "y", - extra - ]; -} - -let a1 = [ - "x", - "y", - "z" -]; - -console.log("a1:", a1); - -let AllLabels = { - foo: foo$1, - ptl: ptl$1, - a1: a1 -}; - -function foo$2(x, y, z, dOpt) { - let d = dOpt !== undefined ? dOpt : "d=0"; - return [ - x, - y, - z, - d - ]; -} - -function ptl$2(none, extra, extra$1) { - return foo$2(none, "y", extra, extra$1); -} - -let b1 = ptl$2("x", "z", undefined); - -console.log("b1:", b1); - -let b2 = ptl$2("x", "z", "d<-100"); - -console.log("b2:", b2); - -let OptAtEnd = { - foo: foo$2, - ptl: ptl$2, - b1: b1, - b2: b2 -}; - -function foo$3(d1Opt, x, d2Opt, y, d3Opt, z, d4Opt, w, d5Opt) { - let d1 = d1Opt !== undefined ? d1Opt : "d1=0"; - let d2 = d2Opt !== undefined ? d2Opt : "d2=0"; - let d3 = d3Opt !== undefined ? d3Opt : "d3=0"; - let d4 = d4Opt !== undefined ? d4Opt : "d4=0"; - let d5 = d5Opt !== undefined ? d5Opt : "d5=0"; - return [ - d1, - x, - d2, - y, - d3, - z, - d4, - w, - d5 - ]; -} - -function ptl$3(none, none$1, none$2, none$3, none$4, none$5, extra) { - return foo$3(none, none$1, none$2, "y", none$3, none$4, none$5, "w", extra); -} - -let c1 = ptl$3(undefined, "x", undefined, undefined, "z", undefined, undefined); - -console.log("c1:", c1); - -let c2 = ptl$3("d1<-100", "x", undefined, undefined, "z", undefined, undefined); - -console.log("c2:", c2); - -let c3 = ptl$3(undefined, "x", "d2<-200", undefined, "z", "d4<-400", undefined); - -console.log("c3:", c3); - -let OptMixed = { - foo: foo$3, - ptl: ptl$3, - c1: c1, - c2: c2, - c3: c3 -}; - -function fn(cb) { - return cb(); -} - -console.log({ - NAME: "foo", - VAL: undefined -}); - -function fn1(a, b, param) { - return a() + b | 0; -} - -function a$1(__x) { - return 3; -} - -function f3(x, y, z) { - console.log(x); - return (x + y | 0) + z | 0; -} - -function fx(extra, extra$1) { - return f3(1, extra, extra$1); -} - -function fy(none, extra) { - return f3(none, 1, extra); -} - -function fz(none, none$1) { - return f3(none, none$1, 1); -} - -let fxyz = f3(1, 1, 1); - -let PartialApplication = { - f3: f3, - fx: fx, - fy: fy, - fz: fz, - fxyz: fxyz -}; - -function hello1(y, f) { - return f(y); -} - -function hello2(y, f) { - return f(y); -} - -let ReverseApplication = { - hello1: hello1, - hello2: hello2 -}; - -function f(a, b, c) { - return [ - b(a), - c(a) - ]; -} - -function f2(a, b, c, d, e) { - let __tuple_internal_obj = a(b); - let param_0 = c(__tuple_internal_obj, d); - let param_1 = d(__tuple_internal_obj, 1, 2); - let param_2 = e(__tuple_internal_obj); - return (param_0 + param_1 | 0) + param_2 | 0; -} - -function f3$1(foo, x) { - return foo(x); -} - -function f4(x, f) { - return f(x, 3); -} - -let Pipe = { - f: f, - f2: f2, - f3: f3$1, - f4: f4 -}; - -exports.foo = foo; -exports.z = z; -exports.bar = bar; -exports.b = b; -exports.w = w; -exports.ptl = ptl; -exports.foo2 = foo2; -exports.bar2 = bar2; -exports.foo3 = foo3; -exports.bar3 = bar3; -exports.q = q; -exports.inl = inl; -exports.inl2 = inl2; -exports.AllLabels = AllLabels; -exports.OptAtEnd = OptAtEnd; -exports.OptMixed = OptMixed; -exports.fn = fn; -exports.fn1 = fn1; -exports.a = a$1; -exports.PartialApplication = PartialApplication; -exports.ReverseApplication = ReverseApplication; -exports.Pipe = Pipe; -/* Not a pure module */ diff --git a/tests/tests/src/UncurriedAlways.mjs b/tests/tests/src/UncurriedAlways.mjs new file mode 100644 index 0000000000..ca17405188 --- /dev/null +++ b/tests/tests/src/UncurriedAlways.mjs @@ -0,0 +1,269 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function foo(x, y) { + return x + y | 0; +} + +let z = 7; + +function bar(x, y) { + return x + y | 0; +} + +let b = 7; + +let w = 7; + +let a = 7; + +console.log(a); + +[1].map(x => x + 1 | 0); + +function ptl(extra) { + return 10 + extra | 0; +} + +function foo2(x, y) { + return x + y | 0; +} + +function bar2(__x) { + return __x + 3 | 0; +} + +function foo3(x, y, z) { + return (x + y | 0) + z | 0; +} + +function bar3(__x) { + return foo3(__x, 3, 4); +} + +function q(param) { + return null; +} + +function inl() { + +} + +function inl2(x, y) { + return x + y | 0; +} + +function foo$1(x, y, z) { + return [ + x, + y, + z + ]; +} + +function ptl$1(none, extra) { + return [ + none, + "y", + extra + ]; +} + +let a1 = [ + "x", + "y", + "z" +]; + +console.log("a1:", a1); + +let AllLabels = { + foo: foo$1, + ptl: ptl$1, + a1: a1 +}; + +function foo$2(x, y, z, dOpt) { + let d = dOpt !== undefined ? dOpt : "d=0"; + return [ + x, + y, + z, + d + ]; +} + +function ptl$2(none, extra, extra$1) { + return foo$2(none, "y", extra, extra$1); +} + +let b1 = ptl$2("x", "z", undefined); + +console.log("b1:", b1); + +let b2 = ptl$2("x", "z", "d<-100"); + +console.log("b2:", b2); + +let OptAtEnd = { + foo: foo$2, + ptl: ptl$2, + b1: b1, + b2: b2 +}; + +function foo$3(d1Opt, x, d2Opt, y, d3Opt, z, d4Opt, w, d5Opt) { + let d1 = d1Opt !== undefined ? d1Opt : "d1=0"; + let d2 = d2Opt !== undefined ? d2Opt : "d2=0"; + let d3 = d3Opt !== undefined ? d3Opt : "d3=0"; + let d4 = d4Opt !== undefined ? d4Opt : "d4=0"; + let d5 = d5Opt !== undefined ? d5Opt : "d5=0"; + return [ + d1, + x, + d2, + y, + d3, + z, + d4, + w, + d5 + ]; +} + +function ptl$3(none, none$1, none$2, none$3, none$4, none$5, extra) { + return foo$3(none, none$1, none$2, "y", none$3, none$4, none$5, "w", extra); +} + +let c1 = ptl$3(undefined, "x", undefined, undefined, "z", undefined, undefined); + +console.log("c1:", c1); + +let c2 = ptl$3("d1<-100", "x", undefined, undefined, "z", undefined, undefined); + +console.log("c2:", c2); + +let c3 = ptl$3(undefined, "x", "d2<-200", undefined, "z", "d4<-400", undefined); + +console.log("c3:", c3); + +let OptMixed = { + foo: foo$3, + ptl: ptl$3, + c1: c1, + c2: c2, + c3: c3 +}; + +function fn(cb) { + return cb(); +} + +console.log({ + NAME: "foo", + VAL: undefined +}); + +function fn1(a, b, param) { + return a() + b | 0; +} + +function a$1(__x) { + return 3; +} + +function f3(x, y, z) { + console.log(x); + return (x + y | 0) + z | 0; +} + +function fx(extra, extra$1) { + return f3(1, extra, extra$1); +} + +function fy(none, extra) { + return f3(none, 1, extra); +} + +function fz(none, none$1) { + return f3(none, none$1, 1); +} + +let fxyz = f3(1, 1, 1); + +let PartialApplication = { + f3: f3, + fx: fx, + fy: fy, + fz: fz, + fxyz: fxyz +}; + +function hello1(y, f) { + return f(y); +} + +function hello2(y, f) { + return f(y); +} + +let ReverseApplication = { + hello1: hello1, + hello2: hello2 +}; + +function f(a, b, c) { + return [ + b(a), + c(a) + ]; +} + +function f2(a, b, c, d, e) { + let __tuple_internal_obj = a(b); + let param_0 = c(__tuple_internal_obj, d); + let param_1 = d(__tuple_internal_obj, 1, 2); + let param_2 = e(__tuple_internal_obj); + return (param_0 + param_1 | 0) + param_2 | 0; +} + +function f3$1(foo, x) { + return foo(x); +} + +function f4(x, f) { + return f(x, 3); +} + +let Pipe = { + f: f, + f2: f2, + f3: f3$1, + f4: f4 +}; + +export { + foo, + z, + bar, + b, + w, + ptl, + foo2, + bar2, + foo3, + bar3, + q, + inl, + inl2, + AllLabels, + OptAtEnd, + OptMixed, + fn, + fn1, + a$1 as a, + PartialApplication, + ReverseApplication, + Pipe, +} +/* Not a pure module */ diff --git a/tests/tests/src/UncurriedExternals.js b/tests/tests/src/UncurriedExternals.js deleted file mode 100644 index c90461e203..0000000000 --- a/tests/tests/src/UncurriedExternals.js +++ /dev/null @@ -1,75 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let React = require("react"); - -function dd() { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -} - -let h = sum(1.0, 2.0); - -let M = { - sum: (prim0, prim1) => sum(prim0, prim1) -}; - -let hh = M.sum(1.0, 2.0); - -function tg(arr) { - return arr[0]; -} - -let tc = Object.assign({}, "abc"); - -let te = { - RE_EXN_ID: "Not_found" -}; - -let tcr = {}; - -function tsiC(c) { - c.increment = function (amount) { - let me = this ; - console.log(me); - }; -} - -function tsiU(c) { - c.increment = function (amount) { - let me = this ; - console.log(me); - }; -} - -let match = React.useState(() => 3); - -let StandardNotation_get = match[0]; - -let StandardNotation_set = match[1]; - -let StandardNotation = { - dd: dd, - h: h, - M: M, - hh: hh, - tg: tg, - tc: tc, - te: te, - tcr: tcr, - tsiC: tsiC, - tsiU: tsiU, - get: StandardNotation_get, - set: StandardNotation_set -}; - -function methodWithAsync() { - let $$this = this ; - return async arg => $$this + arg | 0; -} - -exports.StandardNotation = StandardNotation; -exports.methodWithAsync = methodWithAsync; -/* h Not a pure module */ diff --git a/tests/tests/src/UncurriedExternals.mjs b/tests/tests/src/UncurriedExternals.mjs new file mode 100644 index 0000000000..a50b793b71 --- /dev/null +++ b/tests/tests/src/UncurriedExternals.mjs @@ -0,0 +1,76 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as React from "react"; + +function dd() { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; +} + +let h = sum(1.0, 2.0); + +let M = { + sum: (prim0, prim1) => sum(prim0, prim1) +}; + +let hh = M.sum(1.0, 2.0); + +function tg(arr) { + return arr[0]; +} + +let tc = Object.assign({}, "abc"); + +let te = { + RE_EXN_ID: "Not_found" +}; + +let tcr = {}; + +function tsiC(c) { + c.increment = function (amount) { + let me = this ; + console.log(me); + }; +} + +function tsiU(c) { + c.increment = function (amount) { + let me = this ; + console.log(me); + }; +} + +let match = React.useState(() => 3); + +let StandardNotation_get = match[0]; + +let StandardNotation_set = match[1]; + +let StandardNotation = { + dd: dd, + h: h, + M: M, + hh: hh, + tg: tg, + tc: tc, + te: te, + tcr: tcr, + tsiC: tsiC, + tsiU: tsiU, + get: StandardNotation_get, + set: StandardNotation_set +}; + +function methodWithAsync() { + let $$this = this ; + return async arg => $$this + arg | 0; +} + +export { + StandardNotation, + methodWithAsync, +} +/* h Not a pure module */ diff --git a/tests/tests/src/UncurriedPervasives.js b/tests/tests/src/UncurriedPervasives.js deleted file mode 100644 index 9bb777e72f..0000000000 --- a/tests/tests/src/UncurriedPervasives.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function n(prim) { - -} - -exports.n = n; -/* No side effect */ diff --git a/tests/tests/src/UncurriedPervasives.mjs b/tests/tests/src/UncurriedPervasives.mjs new file mode 100644 index 0000000000..bb2a137e5b --- /dev/null +++ b/tests/tests/src/UncurriedPervasives.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function n(prim) { + +} + +export { + n, +} +/* No side effect */ diff --git a/tests/tests/src/UntaggedVariants.js b/tests/tests/src/UntaggedVariants.js deleted file mode 100644 index c819b5b3c7..0000000000 --- a/tests/tests/src/UntaggedVariants.js +++ /dev/null @@ -1,654 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Js_dict = require("rescript/lib/js/Js_dict.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -function classify(x) { - if (x === "A" && typeof x !== "number") { - return "A"; - } else if (typeof x === "number") { - return "An integer"; - } else { - return "A string" + x; - } -} - -function classify2(x) { - if (typeof x === "string") { - return "A string" + x; - } else { - return "A float"; - } -} - -function cls(x) { - if (typeof x !== "object") { - if (x === "One") { - return "one"; - } else { - return "two"; - } - } else { - return "object" + x.y; - } -} - -let ListWithTuples = {}; - -let ListWithObjects = {}; - -function tuplesToObjects(l) { - if (Array.isArray(l)) { - return { - hd: l[0], - tl: tuplesToObjects(l[1]) - }; - } else { - return null; - } -} - -let l1 = [ - 1, - [ - 2, - [ - 3, - undefined - ] - ] -]; - -let l2 = tuplesToObjects(l1); - -console.log("l1", l1); - -console.log("l2", l2); - -function isTrue(x) { - if (typeof x !== "object") { - return true; - } else { - return x.flag; - } -} - -let Truthy = { - isTrue: isTrue -}; - -function classify$1(x) { - if (x === null || typeof x !== "object") { - if (x === null) { - return "null"; - } else { - return "undefined"; - } - } else { - return "object" + x.name; - } -} - -let TwoObjects = { - classify: classify$1 -}; - -function classify$2(x) { - if (x === "A" || x === "B") { - if (x === "A") { - return "a"; - } else { - return "b"; - } - } - console.log(x); - return "Unknown"; -} - -let Unknown = { - classify: classify$2 -}; - -function classify$3(x) { - if (typeof x !== "object" && typeof x !== "number" && (x === "C" || x === "B" || x === "A" || x === "D")) { - switch (x) { - case "A" : - return "a"; - case "B" : - return "b"; - case "C" : - return "c"; - case "D" : - return "d"; - } - } else { - switch (typeof x) { - case "string" : - return "string"; - case "number" : - return "int"; - case "object" : - return "Object" + x.name; - } - } -} - -let MultipleBlocks = { - classify: classify$3 -}; - -function classify$4(x) { - switch (typeof x) { - case "string" : - return "string"; - case "number" : - return "int"; - case "object" : - return "Object" + x.name; - } -} - -let OnlyBlocks = { - classify: classify$4 -}; - -function classify$5(x) { - if (Array.isArray(x)) { - return "array"; - } - switch (typeof x) { - case "string" : - return "string"; - case "number" : - return "int"; - case "object" : - return "Object" + x.name; - } -} - -let WithArray = { - classify: classify$5 -}; - -function classify$6(x) { - if (!Array.isArray(x) && (x === null || typeof x !== "object") && typeof x !== "number" && typeof x !== "string") { - switch (x) { - case false : - return "JSONFalse"; - case true : - return "JSONTrue"; - case null : - return "JSONNull"; - } - } else { - if (Array.isArray(x)) { - return { - TAG: "JSONArray", - _0: x - }; - } - switch (typeof x) { - case "string" : - return { - TAG: "JSONString", - _0: x - }; - case "number" : - return { - TAG: "JSONNumber", - _0: x - }; - case "object" : - return { - TAG: "JSONObject", - _0: x - }; - } - } -} - -let Json = { - classify: classify$6 -}; - -function check(s, y) { - if (!Array.isArray(s)) { - return 42; - } - let x = s[0]; - if (!Array.isArray(x)) { - return 42; - } - let tmp = s[1]; - if (Array.isArray(tmp) || x === y) { - return 42; - } else { - return 41; - } -} - -let TrickyNested = { - check: check -}; - -function checkEnum(e) { - if (!(e === "Two" || e === "One" || e === "Three")) { - return "Something else..." + e; - } - switch (e) { - case "One" : - return "One!"; - case "Two" : - return "Two"; - case "Three" : - return "Threeeee"; - } -} - -let OverlapString = { - checkEnum: checkEnum -}; - -function checkEnum$1(e) { - if (!(e === "Two" || e === 1.0 || e === "Three")) { - return "Something else..."; - } - switch (e) { - case 1.0 : - return "One!"; - case "Two" : - return "Two"; - case "Three" : - return "Threeeee"; - } -} - -let OverlapNumber = { - checkEnum: checkEnum$1 -}; - -function checkEnum$2(e) { - if (!(e === null || typeof e !== "object")) { - return "Object..."; - } - switch (e) { - case null : - return "One!"; - case "Two" : - return "Two"; - case "Three" : - return "Threeeee"; - } -} - -let OverlapObject = { - checkEnum: checkEnum$2 -}; - -function classify$7(v) { - if (Array.isArray(v)) { - return Primitive_array.get(v, 0); - } else { - return v.x; - } -} - -let RecordIsObject = { - classify: classify$7 -}; - -function classify$8(v) { - if (typeof v === "object" && !Array.isArray(v)) { - return v.x; - } else { - return Primitive_array.get(v, 0); - } -} - -let ArrayAndObject = { - classify: classify$8 -}; - -function testHasNull(x) { - return x; -} - -function testHasUndefined(x) { - return Primitive_option.some(x); -} - -function untaggedWithOptionPayload(x) { - return Primitive_option.some(x); -} - -function untaggedWithIntPayload(x) { - return x; -} - -function untaggedInlineNoOptions(x) { - return x; -} - -function untaggedInlineUnaryWihtExplicitOption(x) { - return Primitive_option.some(x); -} - -function untaggedInlineUnaryWihtImplicitOption(x) { - return Primitive_option.some(x); -} - -function untaggedInlineMultinaryOption(x) { - return x; -} - -let OptionUnboxingHeuristic = { - testHasNull: testHasNull, - testHasUndefined: testHasUndefined, - untaggedWithOptionPayload: untaggedWithOptionPayload, - untaggedWithIntPayload: untaggedWithIntPayload, - untaggedInlineNoOptions: untaggedInlineNoOptions, - untaggedInlineUnaryWihtExplicitOption: untaggedInlineUnaryWihtExplicitOption, - untaggedInlineUnaryWihtImplicitOption: untaggedInlineUnaryWihtImplicitOption, - untaggedInlineMultinaryOption: untaggedInlineMultinaryOption -}; - -function classify$9(v) { - if (Array.isArray(v)) { - return Primitive_array.get(v, 0); - } - switch (typeof v) { - case "object" : - return v.x; - case "function" : - return v(3); - } -} - -let ff = x => x + 1 | 0; - -let TestFunctionCase = { - classify: classify$9, - ff: ff -}; - -let someJson = '[{"name": "Haan"}, {"name": "Mr"}, false]'; - -function check$1(s) { - if (!Array.isArray(s) && (s === null || typeof s !== "object") && typeof s !== "number" && typeof s !== "string") { - console.log("Nope..."); - return; - } - if (Array.isArray(s)) { - if (s.length !== 3) { - console.log("Nope..."); - return; - } - let match = s[0]; - if (match === true) { - let match$1 = s[1]; - if (match$1 === false) { - let match$2 = s[2]; - if (!Array.isArray(match$2) && (match$2 === null || typeof match$2 !== "object") && typeof match$2 !== "number" && typeof match$2 !== "string") { - console.log("Nope..."); - return; - } - if (Array.isArray(match$2)) { - if (match$2.length !== 2) { - console.log("Nope..."); - return; - } - let match$3 = match$2[0]; - if (!Array.isArray(match$3) && (match$3 === null || typeof match$3 !== "object") && typeof match$3 !== "number" && typeof match$3 !== "string") { - console.log("Nope..."); - return; - } - if (typeof match$3 === "string" && match$3 === "My name is") { - let match$4 = match$2[1]; - if (!Array.isArray(match$4) && (match$4 === null || typeof match$4 !== "object") && typeof match$4 !== "number" && typeof match$4 !== "string") { - console.log("Nope..."); - return; - } - if (typeof match$4 === "number") { - if (match$4 !== 10) { - console.log("Nope..."); - } else { - console.log("yup"); - } - return; - } - console.log("Nope..."); - return; - } else { - console.log("Nope..."); - return; - } - } else { - console.log("Nope..."); - return; - } - } else { - console.log("Nope..."); - return; - } - } else { - console.log("Nope..."); - return; - } - } else { - console.log("Nope..."); - return; - } -} - -let ComplexPattern = { - someJson: someJson, - check: check$1 -}; - -async function getUserName(u) { - if (u instanceof Promise) { - return (await u).name; - } - switch (typeof u) { - case "object" : - return u.name; - case "string" : - return u; - } -} - -async function awaitUser(u) { - if (u instanceof Promise) { - return (await u).name; - } - switch (typeof u) { - case "object" : - case "string" : - return "dummy"; - } -} - -let PromiseSync = { - getUserName: getUserName, - awaitUser: awaitUser -}; - -async function classify$10(a) { - if (typeof a !== "object" && !(a instanceof Promise) && (a === "test" || a === 12) && !Array.isArray(a)) { - if (a === "test") { - console.log("testing"); - return; - } - console.log(12); - return; - } else { - if (Array.isArray(a)) { - console.log(Belt_Array.joinWith(a, "-", x => x)); - return; - } - if (a instanceof Promise) { - console.log(await a); - return; - } - switch (typeof a) { - case "string" : - console.log(a); - return; - case "object" : - console.log(a.userName); - return; - } - } -} - -let Arr = { - classify: classify$10 -}; - -async function classifyAll(t) { - if (Array.isArray(t)) { - console.log(Belt_Array.joinWith(t, "-", x => x)); - return; - } - if (t instanceof Promise) { - console.log(await t); - return; - } - if (t instanceof Date) { - console.log(t.toString()); - return; - } - if (t instanceof RegExp) { - console.log(t.test("test")); - return; - } - if (t instanceof File) { - console.log(t.name); - return; - } - if (t instanceof Blob) { - console.log(t.size); - return; - } - switch (typeof t) { - case "string" : - console.log(t); - return; - case "object" : - console.log(t.userName); - return; - } -} - -let AllInstanceofTypes = { - classifyAll: classifyAll -}; - -function test(t) { - switch (typeof t) { - case "object" : - return Js_dict.get(t, "Hello"); - case "string" : - return t; - case "function" : - return t(); - } -} - -let Aliased = { - test: test -}; - -let OnlyOne = { - onlyOne: "OnlyOne" -}; - -function should_not_merge(x) { - if (Array.isArray(x)) { - return "do not merge"; - } - if (x instanceof Date) { - return "do not merge"; - } - switch (typeof x) { - case "boolean" : - return "boolean"; - case "object" : - return "do not merge"; - } -} - -function can_merge(x) { - if (Array.isArray(x)) { - return "do not merge"; - } - if (x instanceof Date) { - return "do not merge"; - } - switch (typeof x) { - case "boolean" : - case "object" : - return "merge"; - } -} - -let MergeCases = { - should_not_merge: should_not_merge, - can_merge: can_merge -}; - -let $$Array; - -let i = 42; - -let i2 = 42.5; - -let s = "abc"; - -let s2 = "abc"; - -let w = { - x: 10, - y: "" -}; - -exports.$$Array = $$Array; -exports.i = i; -exports.i2 = i2; -exports.s = s; -exports.s2 = s2; -exports.classify = classify; -exports.classify2 = classify2; -exports.w = w; -exports.cls = cls; -exports.ListWithTuples = ListWithTuples; -exports.ListWithObjects = ListWithObjects; -exports.tuplesToObjects = tuplesToObjects; -exports.l1 = l1; -exports.l2 = l2; -exports.Truthy = Truthy; -exports.TwoObjects = TwoObjects; -exports.Unknown = Unknown; -exports.MultipleBlocks = MultipleBlocks; -exports.OnlyBlocks = OnlyBlocks; -exports.WithArray = WithArray; -exports.Json = Json; -exports.TrickyNested = TrickyNested; -exports.OverlapString = OverlapString; -exports.OverlapNumber = OverlapNumber; -exports.OverlapObject = OverlapObject; -exports.RecordIsObject = RecordIsObject; -exports.ArrayAndObject = ArrayAndObject; -exports.OptionUnboxingHeuristic = OptionUnboxingHeuristic; -exports.TestFunctionCase = TestFunctionCase; -exports.ComplexPattern = ComplexPattern; -exports.PromiseSync = PromiseSync; -exports.Arr = Arr; -exports.AllInstanceofTypes = AllInstanceofTypes; -exports.Aliased = Aliased; -exports.OnlyOne = OnlyOne; -exports.MergeCases = MergeCases; -/* l2 Not a pure module */ diff --git a/tests/tests/src/UntaggedVariants.mjs b/tests/tests/src/UntaggedVariants.mjs new file mode 100644 index 0000000000..6f59067b7b --- /dev/null +++ b/tests/tests/src/UntaggedVariants.mjs @@ -0,0 +1,655 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Js_dict from "rescript/lib/es6/Js_dict.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +function classify(x) { + if (x === "A" && typeof x !== "number") { + return "A"; + } else if (typeof x === "number") { + return "An integer"; + } else { + return "A string" + x; + } +} + +function classify2(x) { + if (typeof x === "string") { + return "A string" + x; + } else { + return "A float"; + } +} + +function cls(x) { + if (typeof x !== "object") { + if (x === "One") { + return "one"; + } else { + return "two"; + } + } else { + return "object" + x.y; + } +} + +let ListWithTuples = {}; + +let ListWithObjects = {}; + +function tuplesToObjects(l) { + if (Array.isArray(l)) { + return { + hd: l[0], + tl: tuplesToObjects(l[1]) + }; + } else { + return null; + } +} + +let l1 = [ + 1, + [ + 2, + [ + 3, + undefined + ] + ] +]; + +let l2 = tuplesToObjects(l1); + +console.log("l1", l1); + +console.log("l2", l2); + +function isTrue(x) { + if (typeof x !== "object") { + return true; + } else { + return x.flag; + } +} + +let Truthy = { + isTrue: isTrue +}; + +function classify$1(x) { + if (x === null || typeof x !== "object") { + if (x === null) { + return "null"; + } else { + return "undefined"; + } + } else { + return "object" + x.name; + } +} + +let TwoObjects = { + classify: classify$1 +}; + +function classify$2(x) { + if (x === "A" || x === "B") { + if (x === "A") { + return "a"; + } else { + return "b"; + } + } + console.log(x); + return "Unknown"; +} + +let Unknown = { + classify: classify$2 +}; + +function classify$3(x) { + if (typeof x !== "object" && typeof x !== "number" && (x === "C" || x === "B" || x === "A" || x === "D")) { + switch (x) { + case "A" : + return "a"; + case "B" : + return "b"; + case "C" : + return "c"; + case "D" : + return "d"; + } + } else { + switch (typeof x) { + case "string" : + return "string"; + case "number" : + return "int"; + case "object" : + return "Object" + x.name; + } + } +} + +let MultipleBlocks = { + classify: classify$3 +}; + +function classify$4(x) { + switch (typeof x) { + case "string" : + return "string"; + case "number" : + return "int"; + case "object" : + return "Object" + x.name; + } +} + +let OnlyBlocks = { + classify: classify$4 +}; + +function classify$5(x) { + if (Array.isArray(x)) { + return "array"; + } + switch (typeof x) { + case "string" : + return "string"; + case "number" : + return "int"; + case "object" : + return "Object" + x.name; + } +} + +let WithArray = { + classify: classify$5 +}; + +function classify$6(x) { + if (!Array.isArray(x) && (x === null || typeof x !== "object") && typeof x !== "number" && typeof x !== "string") { + switch (x) { + case false : + return "JSONFalse"; + case true : + return "JSONTrue"; + case null : + return "JSONNull"; + } + } else { + if (Array.isArray(x)) { + return { + TAG: "JSONArray", + _0: x + }; + } + switch (typeof x) { + case "string" : + return { + TAG: "JSONString", + _0: x + }; + case "number" : + return { + TAG: "JSONNumber", + _0: x + }; + case "object" : + return { + TAG: "JSONObject", + _0: x + }; + } + } +} + +let Json = { + classify: classify$6 +}; + +function check(s, y) { + if (!Array.isArray(s)) { + return 42; + } + let x = s[0]; + if (!Array.isArray(x)) { + return 42; + } + let tmp = s[1]; + if (Array.isArray(tmp) || x === y) { + return 42; + } else { + return 41; + } +} + +let TrickyNested = { + check: check +}; + +function checkEnum(e) { + if (!(e === "Two" || e === "One" || e === "Three")) { + return "Something else..." + e; + } + switch (e) { + case "One" : + return "One!"; + case "Two" : + return "Two"; + case "Three" : + return "Threeeee"; + } +} + +let OverlapString = { + checkEnum: checkEnum +}; + +function checkEnum$1(e) { + if (!(e === "Two" || e === 1.0 || e === "Three")) { + return "Something else..."; + } + switch (e) { + case 1.0 : + return "One!"; + case "Two" : + return "Two"; + case "Three" : + return "Threeeee"; + } +} + +let OverlapNumber = { + checkEnum: checkEnum$1 +}; + +function checkEnum$2(e) { + if (!(e === null || typeof e !== "object")) { + return "Object..."; + } + switch (e) { + case null : + return "One!"; + case "Two" : + return "Two"; + case "Three" : + return "Threeeee"; + } +} + +let OverlapObject = { + checkEnum: checkEnum$2 +}; + +function classify$7(v) { + if (Array.isArray(v)) { + return Primitive_array.get(v, 0); + } else { + return v.x; + } +} + +let RecordIsObject = { + classify: classify$7 +}; + +function classify$8(v) { + if (typeof v === "object" && !Array.isArray(v)) { + return v.x; + } else { + return Primitive_array.get(v, 0); + } +} + +let ArrayAndObject = { + classify: classify$8 +}; + +function testHasNull(x) { + return x; +} + +function testHasUndefined(x) { + return Primitive_option.some(x); +} + +function untaggedWithOptionPayload(x) { + return Primitive_option.some(x); +} + +function untaggedWithIntPayload(x) { + return x; +} + +function untaggedInlineNoOptions(x) { + return x; +} + +function untaggedInlineUnaryWihtExplicitOption(x) { + return Primitive_option.some(x); +} + +function untaggedInlineUnaryWihtImplicitOption(x) { + return Primitive_option.some(x); +} + +function untaggedInlineMultinaryOption(x) { + return x; +} + +let OptionUnboxingHeuristic = { + testHasNull: testHasNull, + testHasUndefined: testHasUndefined, + untaggedWithOptionPayload: untaggedWithOptionPayload, + untaggedWithIntPayload: untaggedWithIntPayload, + untaggedInlineNoOptions: untaggedInlineNoOptions, + untaggedInlineUnaryWihtExplicitOption: untaggedInlineUnaryWihtExplicitOption, + untaggedInlineUnaryWihtImplicitOption: untaggedInlineUnaryWihtImplicitOption, + untaggedInlineMultinaryOption: untaggedInlineMultinaryOption +}; + +function classify$9(v) { + if (Array.isArray(v)) { + return Primitive_array.get(v, 0); + } + switch (typeof v) { + case "object" : + return v.x; + case "function" : + return v(3); + } +} + +let ff = x => x + 1 | 0; + +let TestFunctionCase = { + classify: classify$9, + ff: ff +}; + +let someJson = '[{"name": "Haan"}, {"name": "Mr"}, false]'; + +function check$1(s) { + if (!Array.isArray(s) && (s === null || typeof s !== "object") && typeof s !== "number" && typeof s !== "string") { + console.log("Nope..."); + return; + } + if (Array.isArray(s)) { + if (s.length !== 3) { + console.log("Nope..."); + return; + } + let match = s[0]; + if (match === true) { + let match$1 = s[1]; + if (match$1 === false) { + let match$2 = s[2]; + if (!Array.isArray(match$2) && (match$2 === null || typeof match$2 !== "object") && typeof match$2 !== "number" && typeof match$2 !== "string") { + console.log("Nope..."); + return; + } + if (Array.isArray(match$2)) { + if (match$2.length !== 2) { + console.log("Nope..."); + return; + } + let match$3 = match$2[0]; + if (!Array.isArray(match$3) && (match$3 === null || typeof match$3 !== "object") && typeof match$3 !== "number" && typeof match$3 !== "string") { + console.log("Nope..."); + return; + } + if (typeof match$3 === "string" && match$3 === "My name is") { + let match$4 = match$2[1]; + if (!Array.isArray(match$4) && (match$4 === null || typeof match$4 !== "object") && typeof match$4 !== "number" && typeof match$4 !== "string") { + console.log("Nope..."); + return; + } + if (typeof match$4 === "number") { + if (match$4 !== 10) { + console.log("Nope..."); + } else { + console.log("yup"); + } + return; + } + console.log("Nope..."); + return; + } else { + console.log("Nope..."); + return; + } + } else { + console.log("Nope..."); + return; + } + } else { + console.log("Nope..."); + return; + } + } else { + console.log("Nope..."); + return; + } + } else { + console.log("Nope..."); + return; + } +} + +let ComplexPattern = { + someJson: someJson, + check: check$1 +}; + +async function getUserName(u) { + if (u instanceof Promise) { + return (await u).name; + } + switch (typeof u) { + case "object" : + return u.name; + case "string" : + return u; + } +} + +async function awaitUser(u) { + if (u instanceof Promise) { + return (await u).name; + } + switch (typeof u) { + case "object" : + case "string" : + return "dummy"; + } +} + +let PromiseSync = { + getUserName: getUserName, + awaitUser: awaitUser +}; + +async function classify$10(a) { + if (typeof a !== "object" && !(a instanceof Promise) && (a === "test" || a === 12) && !Array.isArray(a)) { + if (a === "test") { + console.log("testing"); + return; + } + console.log(12); + return; + } else { + if (Array.isArray(a)) { + console.log(Belt_Array.joinWith(a, "-", x => x)); + return; + } + if (a instanceof Promise) { + console.log(await a); + return; + } + switch (typeof a) { + case "string" : + console.log(a); + return; + case "object" : + console.log(a.userName); + return; + } + } +} + +let Arr = { + classify: classify$10 +}; + +async function classifyAll(t) { + if (Array.isArray(t)) { + console.log(Belt_Array.joinWith(t, "-", x => x)); + return; + } + if (t instanceof Promise) { + console.log(await t); + return; + } + if (t instanceof Date) { + console.log(t.toString()); + return; + } + if (t instanceof RegExp) { + console.log(t.test("test")); + return; + } + if (t instanceof File) { + console.log(t.name); + return; + } + if (t instanceof Blob) { + console.log(t.size); + return; + } + switch (typeof t) { + case "string" : + console.log(t); + return; + case "object" : + console.log(t.userName); + return; + } +} + +let AllInstanceofTypes = { + classifyAll: classifyAll +}; + +function test(t) { + switch (typeof t) { + case "object" : + return Js_dict.get(t, "Hello"); + case "string" : + return t; + case "function" : + return t(); + } +} + +let Aliased = { + test: test +}; + +let OnlyOne = { + onlyOne: "OnlyOne" +}; + +function should_not_merge(x) { + if (Array.isArray(x)) { + return "do not merge"; + } + if (x instanceof Date) { + return "do not merge"; + } + switch (typeof x) { + case "boolean" : + return "boolean"; + case "object" : + return "do not merge"; + } +} + +function can_merge(x) { + if (Array.isArray(x)) { + return "do not merge"; + } + if (x instanceof Date) { + return "do not merge"; + } + switch (typeof x) { + case "boolean" : + case "object" : + return "merge"; + } +} + +let MergeCases = { + should_not_merge: should_not_merge, + can_merge: can_merge +}; + +let $$Array; + +let i = 42; + +let i2 = 42.5; + +let s = "abc"; + +let s2 = "abc"; + +let w = { + x: 10, + y: "" +}; + +export { + $$Array, + i, + i2, + s, + s2, + classify, + classify2, + w, + cls, + ListWithTuples, + ListWithObjects, + tuplesToObjects, + l1, + l2, + Truthy, + TwoObjects, + Unknown, + MultipleBlocks, + OnlyBlocks, + WithArray, + Json, + TrickyNested, + OverlapString, + OverlapNumber, + OverlapObject, + RecordIsObject, + ArrayAndObject, + OptionUnboxingHeuristic, + TestFunctionCase, + ComplexPattern, + PromiseSync, + Arr, + AllInstanceofTypes, + Aliased, + OnlyOne, + MergeCases, +} +/* l2 Not a pure module */ diff --git a/tests/tests/src/VariantCoercion.js b/tests/tests/src/VariantCoercion.js deleted file mode 100644 index 5913561e11..0000000000 --- a/tests/tests/src/VariantCoercion.js +++ /dev/null @@ -1,136 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let x = { - kind: "One", - age: 1 -}; - -let CoerceVariants = { - a: 1.1, - b: 1.1, - x: x, - y: x -}; - -let a = "hello"; - -let c = 100; - -let CoerceWithPayload = { - a: a, - aa: "First", - b: a, - bb: "First", - c: c, - cc: 2, - d: c, - dd: 2 -}; - -let a$1 = "hello"; - -let aa = "First"; - -let c$1 = "Hi"; - -let CoerceFromStringToVariant = { - a: a$1, - aa: aa, - b: a$1, - bb: aa, - c: c$1, - cc: c$1 -}; - -let CoerceFromIntToVariant = { - a: 100, - aa: 1, - b: 100, - bb: 1, - c: 120, - cc: 120 -}; - -let CoerceFromFloatToVariant = { - a: 100, - aa: 1, - b: 100, - bb: 1, - c: 120, - cc: 120 -}; - -let CoerceFromBigintToVariant = { - a: 100n, - aa: 1n, - b: 100n, - bb: 1n, - c: 120n, - cc: 120n -}; - -let CoerceFromPolyvariantToVariant = { - simple: "One", - simpleP: "One", - withAs: "One", - withAsP: "One", - withMoreVariantConstructors: "One", - withMoreVariantConstructorsP: "One", - withUnboxedCatchAll: "One", - withUnboxedCatchAllP: "One" -}; - -function f1() { - return "b"; -} - -function f2() { - return "b"; -} - -for (let x$1 = 1; x$1 <= 2; ++x$1) { - console.log(x$1); -} - -let y = "one".length; - -let z = 1.5 + 2.0 + 1.5; - -let CoerceVariantBinaryOp = { - x: 2, - v: 2, - f1: f1, - f2: f2, - y: y, - z: z -}; - -let a$2 = "Three"; - -let b = "Three"; - -let i = 1; - -let d = 1; - -let ii = 1.1; - -let dd = 1.1; - -exports.a = a$2; -exports.b = b; -exports.i = i; -exports.d = d; -exports.ii = ii; -exports.dd = dd; -exports.CoerceVariants = CoerceVariants; -exports.CoerceWithPayload = CoerceWithPayload; -exports.CoerceFromStringToVariant = CoerceFromStringToVariant; -exports.CoerceFromIntToVariant = CoerceFromIntToVariant; -exports.CoerceFromFloatToVariant = CoerceFromFloatToVariant; -exports.CoerceFromBigintToVariant = CoerceFromBigintToVariant; -exports.CoerceFromPolyvariantToVariant = CoerceFromPolyvariantToVariant; -exports.CoerceVariantBinaryOp = CoerceVariantBinaryOp; -/* Not a pure module */ diff --git a/tests/tests/src/VariantCoercion.mjs b/tests/tests/src/VariantCoercion.mjs new file mode 100644 index 0000000000..dbd38a8b86 --- /dev/null +++ b/tests/tests/src/VariantCoercion.mjs @@ -0,0 +1,137 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let x = { + kind: "One", + age: 1 +}; + +let CoerceVariants = { + a: 1.1, + b: 1.1, + x: x, + y: x +}; + +let a = "hello"; + +let c = 100; + +let CoerceWithPayload = { + a: a, + aa: "First", + b: a, + bb: "First", + c: c, + cc: 2, + d: c, + dd: 2 +}; + +let a$1 = "hello"; + +let aa = "First"; + +let c$1 = "Hi"; + +let CoerceFromStringToVariant = { + a: a$1, + aa: aa, + b: a$1, + bb: aa, + c: c$1, + cc: c$1 +}; + +let CoerceFromIntToVariant = { + a: 100, + aa: 1, + b: 100, + bb: 1, + c: 120, + cc: 120 +}; + +let CoerceFromFloatToVariant = { + a: 100, + aa: 1, + b: 100, + bb: 1, + c: 120, + cc: 120 +}; + +let CoerceFromBigintToVariant = { + a: 100n, + aa: 1n, + b: 100n, + bb: 1n, + c: 120n, + cc: 120n +}; + +let CoerceFromPolyvariantToVariant = { + simple: "One", + simpleP: "One", + withAs: "One", + withAsP: "One", + withMoreVariantConstructors: "One", + withMoreVariantConstructorsP: "One", + withUnboxedCatchAll: "One", + withUnboxedCatchAllP: "One" +}; + +function f1() { + return "b"; +} + +function f2() { + return "b"; +} + +for (let x$1 = 1; x$1 <= 2; ++x$1) { + console.log(x$1); +} + +let y = "one".length; + +let z = 1.5 + 2.0 + 1.5; + +let CoerceVariantBinaryOp = { + x: 2, + v: 2, + f1: f1, + f2: f2, + y: y, + z: z +}; + +let a$2 = "Three"; + +let b = "Three"; + +let i = 1; + +let d = 1; + +let ii = 1.1; + +let dd = 1.1; + +export { + a$2 as a, + b, + i, + d, + ii, + dd, + CoerceVariants, + CoerceWithPayload, + CoerceFromStringToVariant, + CoerceFromIntToVariant, + CoerceFromFloatToVariant, + CoerceFromBigintToVariant, + CoerceFromPolyvariantToVariant, + CoerceVariantBinaryOp, +} +/* Not a pure module */ diff --git a/tests/tests/src/VariantPatternMatchingSpreads.js b/tests/tests/src/VariantPatternMatchingSpreads.js deleted file mode 100644 index 6416532a50..0000000000 --- a/tests/tests/src/VariantPatternMatchingSpreads.js +++ /dev/null @@ -1,102 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function doWithA(a) { - switch (a) { - case "One" : - console.log("aaa"); - return; - case "Two" : - console.log("twwwoooo"); - return; - case "Three" : - console.log("threeeee"); - return; - } -} - -function doWithB(b) { - if (b === "One") { - console.log("aaa"); - return; - } - console.log("twwwoooo"); -} - -function lookup(b) { - switch (b) { - case "Four" : - console.log("four"); - return; - case "Five" : - console.log("five"); - return; - default: - return doWithA(b); - } -} - -function lookup2(d) { - switch (d) { - case "Four" : - case "Five" : - return doWithB(d); - case "Six" : - case "Seven" : - console.log("Got rest of d"); - return; - default: - return doWithA(d); - } -} - -function lookupOpt(b) { - if (b !== undefined) { - switch (b) { - case "Four" : - console.log("four"); - return; - case "Five" : - console.log("five"); - return; - default: - return doWithA(b); - } - } else { - console.log("None"); - return; - } -} - -let Foo = {}; - -function doWithZ(z) { - if (z === "First") { - console.log("First"); - return; - } - console.log("Second"); -} - -function lookup3(d) { - switch (d) { - case "First" : - case "Second" : - console.log(d); - return; - case "Third" : - console.log("Third"); - return; - } -} - -exports.doWithA = doWithA; -exports.doWithB = doWithB; -exports.lookup = lookup; -exports.lookup2 = lookup2; -exports.lookupOpt = lookupOpt; -exports.Foo = Foo; -exports.doWithZ = doWithZ; -exports.lookup3 = lookup3; -/* No side effect */ diff --git a/tests/tests/src/VariantPatternMatchingSpreads.mjs b/tests/tests/src/VariantPatternMatchingSpreads.mjs new file mode 100644 index 0000000000..1f067413bb --- /dev/null +++ b/tests/tests/src/VariantPatternMatchingSpreads.mjs @@ -0,0 +1,103 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function doWithA(a) { + switch (a) { + case "One" : + console.log("aaa"); + return; + case "Two" : + console.log("twwwoooo"); + return; + case "Three" : + console.log("threeeee"); + return; + } +} + +function doWithB(b) { + if (b === "One") { + console.log("aaa"); + return; + } + console.log("twwwoooo"); +} + +function lookup(b) { + switch (b) { + case "Four" : + console.log("four"); + return; + case "Five" : + console.log("five"); + return; + default: + return doWithA(b); + } +} + +function lookup2(d) { + switch (d) { + case "Four" : + case "Five" : + return doWithB(d); + case "Six" : + case "Seven" : + console.log("Got rest of d"); + return; + default: + return doWithA(d); + } +} + +function lookupOpt(b) { + if (b !== undefined) { + switch (b) { + case "Four" : + console.log("four"); + return; + case "Five" : + console.log("five"); + return; + default: + return doWithA(b); + } + } else { + console.log("None"); + return; + } +} + +let Foo = {}; + +function doWithZ(z) { + if (z === "First") { + console.log("First"); + return; + } + console.log("Second"); +} + +function lookup3(d) { + switch (d) { + case "First" : + case "Second" : + console.log(d); + return; + case "Third" : + console.log("Third"); + return; + } +} + +export { + doWithA, + doWithB, + lookup, + lookup2, + lookupOpt, + Foo, + doWithZ, + lookup3, +} +/* No side effect */ diff --git a/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.js b/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.js deleted file mode 100644 index 1bbdd55c51..0000000000 --- a/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.js +++ /dev/null @@ -1,74 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function doWithA(a) { - if (typeof a !== "object") { - if (a === "One") { - console.log("aaa"); - return; - } - console.log("threeeee"); - return; - } else { - console.log("twwwoooo"); - return; - } -} - -function doWithB(b) { - if (typeof b !== "object") { - if (b === "One") { - console.log("aaa"); - return; - } - console.log("twwwoooo"); - return; - } else { - console.log("twwwoooo"); - return; - } -} - -function lookup(b) { - if (typeof b === "object") { - return doWithA(b); - } - switch (b) { - case "Four" : - console.log("four"); - return; - case "Five" : - console.log("five"); - return; - default: - return doWithA(b); - } -} - -function lookup2(d) { - if (typeof d !== "object") { - switch (d) { - case "Four" : - case "Five" : - return doWithB(d); - case "Six" : - console.log("Got rest of d"); - return; - default: - return doWithA(d); - } - } else { - if (d.TAG !== "Seven") { - return doWithA(d); - } - console.log("Got rest of d"); - return; - } -} - -exports.doWithA = doWithA; -exports.doWithB = doWithB; -exports.lookup = lookup; -exports.lookup2 = lookup2; -/* No side effect */ diff --git a/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.mjs b/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.mjs new file mode 100644 index 0000000000..af99457bd3 --- /dev/null +++ b/tests/tests/src/VariantPatternMatchingSpreadsWithPayloads.mjs @@ -0,0 +1,75 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function doWithA(a) { + if (typeof a !== "object") { + if (a === "One") { + console.log("aaa"); + return; + } + console.log("threeeee"); + return; + } else { + console.log("twwwoooo"); + return; + } +} + +function doWithB(b) { + if (typeof b !== "object") { + if (b === "One") { + console.log("aaa"); + return; + } + console.log("twwwoooo"); + return; + } else { + console.log("twwwoooo"); + return; + } +} + +function lookup(b) { + if (typeof b === "object") { + return doWithA(b); + } + switch (b) { + case "Four" : + console.log("four"); + return; + case "Five" : + console.log("five"); + return; + default: + return doWithA(b); + } +} + +function lookup2(d) { + if (typeof d !== "object") { + switch (d) { + case "Four" : + case "Five" : + return doWithB(d); + case "Six" : + console.log("Got rest of d"); + return; + default: + return doWithA(d); + } + } else { + if (d.TAG !== "Seven") { + return doWithA(d); + } + console.log("Got rest of d"); + return; + } +} + +export { + doWithA, + doWithB, + lookup, + lookup2, +} +/* No side effect */ diff --git a/tests/tests/src/VariantSpreads.js b/tests/tests/src/VariantSpreads.js deleted file mode 100644 index b76df895a7..0000000000 --- a/tests/tests/src/VariantSpreads.js +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let S = {}; - -let b1 = "Two"; - -let b2 = { - TAG: "One", - _0: true, - _1: "Bar" -}; - -let c = { - TAG: "Five", - _0: 2 -}; - -let ddd = "Six"; - -let q = { - TAG: "One", - name: "hello" -}; - -exports.S = S; -exports.b1 = b1; -exports.b2 = b2; -exports.c = c; -exports.ddd = ddd; -exports.q = q; -/* No side effect */ diff --git a/tests/tests/src/VariantSpreads.mjs b/tests/tests/src/VariantSpreads.mjs new file mode 100644 index 0000000000..de211881e1 --- /dev/null +++ b/tests/tests/src/VariantSpreads.mjs @@ -0,0 +1,34 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let S = {}; + +let b1 = "Two"; + +let b2 = { + TAG: "One", + _0: true, + _1: "Bar" +}; + +let c = { + TAG: "Five", + _0: 2 +}; + +let ddd = "Six"; + +let q = { + TAG: "One", + name: "hello" +}; + +export { + S, + b1, + b2, + c, + ddd, + q, +} +/* No side effect */ diff --git a/tests/tests/src/a.js b/tests/tests/src/a.js deleted file mode 100644 index 1eb4cada7a..0000000000 --- a/tests/tests/src/a.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function Make(U) { - return { - v: U.compare - }; -} - -exports.Make = Make; -/* No side effect */ diff --git a/tests/tests/src/a.mjs b/tests/tests/src/a.mjs new file mode 100644 index 0000000000..1e4a08ff78 --- /dev/null +++ b/tests/tests/src/a.mjs @@ -0,0 +1,13 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function Make(U) { + return { + v: U.compare + }; +} + +export { + Make, +} +/* No side effect */ diff --git a/tests/tests/src/a_recursive_type.js b/tests/tests/src/a_recursive_type.js deleted file mode 100644 index 7727b37026..0000000000 --- a/tests/tests/src/a_recursive_type.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function g(x) { - return x._0(x); -} - -let loop = g({ - TAG: "A", - _0: g -}); - -let non_terminate = g({ - TAG: "A", - _0: g -}); - -let xx = {}; - -xx.xx = xx; - -exports.loop = loop; -exports.non_terminate = non_terminate; -/* loop Not a pure module */ diff --git a/tests/tests/src/a_recursive_type.mjs b/tests/tests/src/a_recursive_type.mjs new file mode 100644 index 0000000000..e4fd7b89ea --- /dev/null +++ b/tests/tests/src/a_recursive_type.mjs @@ -0,0 +1,26 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function g(x) { + return x._0(x); +} + +let loop = g({ + TAG: "A", + _0: g +}); + +let non_terminate = g({ + TAG: "A", + _0: g +}); + +let xx = {}; + +xx.xx = xx; + +export { + loop, + non_terminate, +} +/* loop Not a pure module */ diff --git a/tests/tests/src/a_scope_bug.js b/tests/tests/src/a_scope_bug.js deleted file mode 100644 index 0e43a28a04..0000000000 --- a/tests/tests/src/a_scope_bug.js +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function odd(_z) { - while (true) { - let z = _z; - let even = Math.imul(z, z); - let a = (even + 4 | 0) + even | 0; - console.log(a.toString()); - _z = 32; - continue; - }; -} - -let even = odd; - -exports.odd = odd; -exports.even = even; -/* No side effect */ diff --git a/tests/tests/src/a_scope_bug.mjs b/tests/tests/src/a_scope_bug.mjs new file mode 100644 index 0000000000..157799023c --- /dev/null +++ b/tests/tests/src/a_scope_bug.mjs @@ -0,0 +1,21 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function odd(_z) { + while (true) { + let z = _z; + let even = Math.imul(z, z); + let a = (even + 4 | 0) + even | 0; + console.log(a.toString()); + _z = 32; + continue; + }; +} + +let even = odd; + +export { + odd, + even, +} +/* No side effect */ diff --git a/tests/tests/src/abstract_type.js b/tests/tests/src/abstract_type.mjs similarity index 100% rename from tests/tests/src/abstract_type.js rename to tests/tests/src/abstract_type.mjs diff --git a/tests/tests/src/acyc/a0_a1.js b/tests/tests/src/acyc/a0_a1.js deleted file mode 100644 index e49a9a2be3..0000000000 --- a/tests/tests/src/acyc/a0_a1.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = 3; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/acyc/a0_a1.mjs b/tests/tests/src/acyc/a0_a1.mjs new file mode 100644 index 0000000000..cf0b79fe71 --- /dev/null +++ b/tests/tests/src/acyc/a0_a1.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = 3; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/acyc/a1_a2.js b/tests/tests/src/acyc/a1_a2.js deleted file mode 100644 index 9b230e3fea..0000000000 --- a/tests/tests/src/acyc/a1_a2.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let A0_a1 = require("./a0_a1.js"); - -let v = A0_a1.v; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/acyc/a1_a2.mjs b/tests/tests/src/acyc/a1_a2.mjs new file mode 100644 index 0000000000..79263a7207 --- /dev/null +++ b/tests/tests/src/acyc/a1_a2.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as A0_a1 from "./a0_a1.mjs"; + +let v = A0_a1.v; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/acyc/a2_a3.js b/tests/tests/src/acyc/a2_a3.js deleted file mode 100644 index e3e41ff5af..0000000000 --- a/tests/tests/src/acyc/a2_a3.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let A1_a2 = require("./a1_a2.js"); - -let v = A1_a2.v; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/acyc/a2_a3.mjs b/tests/tests/src/acyc/a2_a3.mjs new file mode 100644 index 0000000000..3df0bd6ed5 --- /dev/null +++ b/tests/tests/src/acyc/a2_a3.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as A1_a2 from "./a1_a2.mjs"; + +let v = A1_a2.v; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/acyc/a3_a4.js b/tests/tests/src/acyc/a3_a4.js deleted file mode 100644 index c638a7135e..0000000000 --- a/tests/tests/src/acyc/a3_a4.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let A2_a3 = require("./a2_a3.js"); - -let v = A2_a3.v; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/acyc/a3_a4.mjs b/tests/tests/src/acyc/a3_a4.mjs new file mode 100644 index 0000000000..118120bc7b --- /dev/null +++ b/tests/tests/src/acyc/a3_a4.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as A2_a3 from "./a2_a3.mjs"; + +let v = A2_a3.v; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/acyc/a4_a5.js b/tests/tests/src/acyc/a4_a5.js deleted file mode 100644 index 894b72a8b3..0000000000 --- a/tests/tests/src/acyc/a4_a5.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let A3_a4 = require("./a3_a4.js"); - -console.log(A3_a4.v); - -let v = A3_a4.v; - -exports.v = v; -/* Not a pure module */ diff --git a/tests/tests/src/acyc/a4_a5.mjs b/tests/tests/src/acyc/a4_a5.mjs new file mode 100644 index 0000000000..b118ae0db2 --- /dev/null +++ b/tests/tests/src/acyc/a4_a5.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as A3_a4 from "./a3_a4.mjs"; + +console.log(A3_a4.v); + +let v = A3_a4.v; + +export { + v, +} +/* Not a pure module */ diff --git a/tests/tests/src/acyc/x.js b/tests/tests/src/acyc/x.js deleted file mode 100644 index 38508a0f7e..0000000000 --- a/tests/tests/src/acyc/x.js +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let A0_a1 = { - v: 3 -}; - -let A1_a2 = { - v: 3 -}; - -let A2_a3 = { - v: 3 -}; - -let A3_a4 = { - v: 3 -}; - -console.log(3); - -let A4_a5 = { - v: 3 -}; - -exports.A0_a1 = A0_a1; -exports.A1_a2 = A1_a2; -exports.A2_a3 = A2_a3; -exports.A3_a4 = A3_a4; -exports.A4_a5 = A4_a5; -/* Not a pure module */ diff --git a/tests/tests/src/acyc/x.mjs b/tests/tests/src/acyc/x.mjs new file mode 100644 index 0000000000..d9727ac5ad --- /dev/null +++ b/tests/tests/src/acyc/x.mjs @@ -0,0 +1,33 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let A0_a1 = { + v: 3 +}; + +let A1_a2 = { + v: 3 +}; + +let A2_a3 = { + v: 3 +}; + +let A3_a4 = { + v: 3 +}; + +console.log(3); + +let A4_a5 = { + v: 3 +}; + +export { + A0_a1, + A1_a2, + A2_a3, + A3_a4, + A4_a5, +} +/* Not a pure module */ diff --git a/tests/tests/src/adt_optimize_test.js b/tests/tests/src/adt_optimize_test.js deleted file mode 100644 index ee9aab3edd..0000000000 --- a/tests/tests/src/adt_optimize_test.js +++ /dev/null @@ -1,208 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - switch (x) { - case "A" : - return 1; - case "B" : - return 2; - case "C" : - return 3; - } -} - -function f_0(x) { - switch (x) { - case "A" : - return -1; - case "B" : - return 0; - case "C" : - return 1; - } -} - -function f2(x) { - if (x >= 3) { - return "T003"; - } - switch (x) { - case 0 : - return "T000"; - case 1 : - return "T001"; - case 2 : - return "T002"; - } -} - -function f3(x) { - switch (x) { - case "X0" : - return "Y0"; - case "X1" : - return "Y1"; - case "X2" : - return "Y2"; - case "X3" : - return "Y3"; - case "X4" : - return "Y4"; - } -} - -function f4(x) { - return 3; -} - -function f5(x) { - if (typeof x !== "object") { - switch (x) { - case "A" : - return 1; - case "B" : - return 3; - case "F" : - return 4; - } - } else { - switch (x.TAG) { - case "C" : - case "D" : - return 1; - case "E" : - return 2; - } - } -} - -function f6(x) { - if (typeof x === "object") { - return 1; - } - switch (x) { - case "A" : - case "B" : - return 0; - case "F" : - return 2; - } -} - -function f7(x) { - if (typeof x !== "object") { - switch (x) { - case "A" : - return 1; - case "B" : - return 2; - case "F" : - return -1; - } - } else { - switch (x.TAG) { - case "C" : - return 3; - case "D" : - return 4; - case "E" : - return -1; - } - } -} - -function f8(x) { - if (typeof x !== "object") { - switch (x) { - case "T60" : - case "T61" : - return 1; - default: - return 3; - } - } else { - switch (x.TAG) { - case "T64" : - case "T65" : - return 2; - default: - return 3; - } - } -} - -function f9(x) { - if (typeof x !== "object") { - if (x === "T63") { - return 3; - } else { - return 1; - } - } - switch (x.TAG) { - case "T64" : - case "T65" : - return 2; - case "T66" : - case "T68" : - return 3; - } -} - -function f10(x) { - if (typeof x !== "object") { - switch (x) { - case "T60" : - return 0; - case "T61" : - return 2; - case "T62" : - return 4; - case "T63" : - return 1; - } - } else { - switch (x.TAG) { - case "T64" : - case "T65" : - return 2; - case "T66" : - case "T68" : - return 3; - } - } -} - -function f11(x) { - if (typeof x !== "object") { - return 2; - } - if (x.TAG === "D") { - return 1; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "adt_optimize_test.res", - 202, - 9 - ], - Error: new Error() - }; -} - -exports.f = f; -exports.f_0 = f_0; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -exports.f5 = f5; -exports.f6 = f6; -exports.f7 = f7; -exports.f8 = f8; -exports.f9 = f9; -exports.f10 = f10; -exports.f11 = f11; -/* No side effect */ diff --git a/tests/tests/src/adt_optimize_test.mjs b/tests/tests/src/adt_optimize_test.mjs new file mode 100644 index 0000000000..59784e1c18 --- /dev/null +++ b/tests/tests/src/adt_optimize_test.mjs @@ -0,0 +1,209 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + switch (x) { + case "A" : + return 1; + case "B" : + return 2; + case "C" : + return 3; + } +} + +function f_0(x) { + switch (x) { + case "A" : + return -1; + case "B" : + return 0; + case "C" : + return 1; + } +} + +function f2(x) { + if (x >= 3) { + return "T003"; + } + switch (x) { + case 0 : + return "T000"; + case 1 : + return "T001"; + case 2 : + return "T002"; + } +} + +function f3(x) { + switch (x) { + case "X0" : + return "Y0"; + case "X1" : + return "Y1"; + case "X2" : + return "Y2"; + case "X3" : + return "Y3"; + case "X4" : + return "Y4"; + } +} + +function f4(x) { + return 3; +} + +function f5(x) { + if (typeof x !== "object") { + switch (x) { + case "A" : + return 1; + case "B" : + return 3; + case "F" : + return 4; + } + } else { + switch (x.TAG) { + case "C" : + case "D" : + return 1; + case "E" : + return 2; + } + } +} + +function f6(x) { + if (typeof x === "object") { + return 1; + } + switch (x) { + case "A" : + case "B" : + return 0; + case "F" : + return 2; + } +} + +function f7(x) { + if (typeof x !== "object") { + switch (x) { + case "A" : + return 1; + case "B" : + return 2; + case "F" : + return -1; + } + } else { + switch (x.TAG) { + case "C" : + return 3; + case "D" : + return 4; + case "E" : + return -1; + } + } +} + +function f8(x) { + if (typeof x !== "object") { + switch (x) { + case "T60" : + case "T61" : + return 1; + default: + return 3; + } + } else { + switch (x.TAG) { + case "T64" : + case "T65" : + return 2; + default: + return 3; + } + } +} + +function f9(x) { + if (typeof x !== "object") { + if (x === "T63") { + return 3; + } else { + return 1; + } + } + switch (x.TAG) { + case "T64" : + case "T65" : + return 2; + case "T66" : + case "T68" : + return 3; + } +} + +function f10(x) { + if (typeof x !== "object") { + switch (x) { + case "T60" : + return 0; + case "T61" : + return 2; + case "T62" : + return 4; + case "T63" : + return 1; + } + } else { + switch (x.TAG) { + case "T64" : + case "T65" : + return 2; + case "T66" : + case "T68" : + return 3; + } + } +} + +function f11(x) { + if (typeof x !== "object") { + return 2; + } + if (x.TAG === "D") { + return 1; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "adt_optimize_test.res", + 202, + 9 + ], + Error: new Error() + }; +} + +export { + f, + f_0, + f2, + f3, + f4, + f5, + f6, + f7, + f8, + f9, + f10, + f11, +} +/* No side effect */ diff --git a/tests/tests/src/alias_default_value_test.js b/tests/tests/src/alias_default_value_test.js deleted file mode 100644 index 7d09bad077..0000000000 --- a/tests/tests/src/alias_default_value_test.js +++ /dev/null @@ -1,77 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function Alias_default_value_test$C0(props) { - let __b = props.b; - let __a = props.a; - let a = __a !== undefined ? __a : 2; - let b = __b !== undefined ? __b : (a << 1); - return a + b | 0; -} - -let C0 = { - make: Alias_default_value_test$C0 -}; - -function Alias_default_value_test$C1(props) { - let __bar = props.foo; - if (__bar !== undefined) { - return __bar; - } else { - return ""; - } -} - -let C1 = { - make: Alias_default_value_test$C1 -}; - -function Alias_default_value_test$C2(props) { - let __a = props.a; - let __bar = props.foo; - let bar = __bar !== undefined ? __bar : ""; - let a = __a !== undefined ? __a : bar; - return bar + a + props.b; -} - -let C2 = { - make: Alias_default_value_test$C2 -}; - -function Alias_default_value_test$C3(props) { - let __text = props.text; - if (__text !== undefined) { - return __text; - } else { - return "Test"; - } -} - -let C3 = { - make: Alias_default_value_test$C3 -}; - -function Alias_default_value_test$C4(props) { - return props.a; -} - -let C4 = { - make: Alias_default_value_test$C4 -}; - -function Alias_default_value_test$C6(props) { - return props.comp.xx; -} - -let C6 = { - make: Alias_default_value_test$C6 -}; - -exports.C0 = C0; -exports.C1 = C1; -exports.C2 = C2; -exports.C3 = C3; -exports.C4 = C4; -exports.C6 = C6; -/* No side effect */ diff --git a/tests/tests/src/alias_default_value_test.mjs b/tests/tests/src/alias_default_value_test.mjs new file mode 100644 index 0000000000..ba7e994132 --- /dev/null +++ b/tests/tests/src/alias_default_value_test.mjs @@ -0,0 +1,78 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function Alias_default_value_test$C0(props) { + let __b = props.b; + let __a = props.a; + let a = __a !== undefined ? __a : 2; + let b = __b !== undefined ? __b : (a << 1); + return a + b | 0; +} + +let C0 = { + make: Alias_default_value_test$C0 +}; + +function Alias_default_value_test$C1(props) { + let __bar = props.foo; + if (__bar !== undefined) { + return __bar; + } else { + return ""; + } +} + +let C1 = { + make: Alias_default_value_test$C1 +}; + +function Alias_default_value_test$C2(props) { + let __a = props.a; + let __bar = props.foo; + let bar = __bar !== undefined ? __bar : ""; + let a = __a !== undefined ? __a : bar; + return bar + a + props.b; +} + +let C2 = { + make: Alias_default_value_test$C2 +}; + +function Alias_default_value_test$C3(props) { + let __text = props.text; + if (__text !== undefined) { + return __text; + } else { + return "Test"; + } +} + +let C3 = { + make: Alias_default_value_test$C3 +}; + +function Alias_default_value_test$C4(props) { + return props.a; +} + +let C4 = { + make: Alias_default_value_test$C4 +}; + +function Alias_default_value_test$C6(props) { + return props.comp.xx; +} + +let C6 = { + make: Alias_default_value_test$C6 +}; + +export { + C0, + C1, + C2, + C3, + C4, + C6, +} +/* No side effect */ diff --git a/tests/tests/src/alias_test.js b/tests/tests/src/alias_test.js deleted file mode 100644 index 8ceff5cb6c..0000000000 --- a/tests/tests/src/alias_test.js +++ /dev/null @@ -1,31 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let a10 = "hello world"; - -let a20 = a10 + "not"; - -let v = a20.codePointAt(0) === /* 'h' */104 ? 1 : 2; - -let a21 = a20 + a20; - -let a22 = "test " + (a21 + "hello"); - -function ff() { - return "cool " + a22; -} - -let a23 = ff(); - -let a15 = a10; - -let b15 = 111; - -exports.a15 = a15; -exports.b15 = b15; -exports.a21 = a21; -exports.v = v; -exports.a23 = a23; -exports.ff = ff; -/* v Not a pure module */ diff --git a/tests/tests/src/alias_test.mjs b/tests/tests/src/alias_test.mjs new file mode 100644 index 0000000000..0b97f7bb6c --- /dev/null +++ b/tests/tests/src/alias_test.mjs @@ -0,0 +1,32 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let a10 = "hello world"; + +let a20 = a10 + "not"; + +let v = a20.codePointAt(0) === /* 'h' */104 ? 1 : 2; + +let a21 = a20 + a20; + +let a22 = "test " + (a21 + "hello"); + +function ff() { + return "cool " + a22; +} + +let a23 = ff(); + +let a15 = a10; + +let b15 = 111; + +export { + a15, + b15, + a21, + v, + a23, + ff, +} +/* v Not a pure module */ diff --git a/tests/tests/src/and_or_tailcall_test.js b/tests/tests/src/and_or_tailcall_test.js deleted file mode 100644 index 19a442c44f..0000000000 --- a/tests/tests/src/and_or_tailcall_test.js +++ /dev/null @@ -1,65 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function f(b, x, _n) { - while (true) { - let n = _n; - if (n > 100000) { - return false; - } - if (!b) { - return false; - } - _n = n + 1 | 0; - continue; - }; -} - -function or_f(b, x, _n) { - while (true) { - let n = _n; - if (n > 100000) { - return false; - } - if (b) { - return true; - } - _n = n + 1 | 0; - continue; - }; -} - -let suites_0 = [ - "and_tail", - param => ({ - TAG: "Eq", - _0: false, - _1: f(true, 1, 0) - }) -]; - -let suites_1 = { - hd: [ - "or_tail", - param => ({ - TAG: "Eq", - _0: false, - _1: or_f(false, 1, 0) - }) - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("And_or_tailcall_test", suites); - -exports.f = f; -exports.or_f = or_f; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/and_or_tailcall_test.mjs b/tests/tests/src/and_or_tailcall_test.mjs new file mode 100644 index 0000000000..aa180944ad --- /dev/null +++ b/tests/tests/src/and_or_tailcall_test.mjs @@ -0,0 +1,66 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function f(b, x, _n) { + while (true) { + let n = _n; + if (n > 100000) { + return false; + } + if (!b) { + return false; + } + _n = n + 1 | 0; + continue; + }; +} + +function or_f(b, x, _n) { + while (true) { + let n = _n; + if (n > 100000) { + return false; + } + if (b) { + return true; + } + _n = n + 1 | 0; + continue; + }; +} + +let suites_0 = [ + "and_tail", + param => ({ + TAG: "Eq", + _0: false, + _1: f(true, 1, 0) + }) +]; + +let suites_1 = { + hd: [ + "or_tail", + param => ({ + TAG: "Eq", + _0: false, + _1: or_f(false, 1, 0) + }) + ], + tl: /* [] */0 +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("And_or_tailcall_test", suites); + +export { + f, + or_f, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/ari_regress_test.js b/tests/tests/src/ari_regress_test.js deleted file mode 100644 index 20043923ee..0000000000 --- a/tests/tests/src/ari_regress_test.js +++ /dev/null @@ -1,74 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let g = 7; - -let h = { - contents: 0 -}; - -function g1(x, y) { - let u = x + y | 0; - h.contents = h.contents + 1 | 0; - return (xx, yy) => (xx + yy | 0) + u | 0; -} - -let u = 8; - -let x = u + 6 | 0; - -function v(__x) { - return g1(3, 4)(6, __x); -} - -let suites_0 = [ - "curry", - param => ({ - TAG: "Eq", - _0: g, - _1: 7 - }) -]; - -let suites_1 = { - hd: [ - "curry2", - param => ({ - TAG: "Eq", - _0: 14, - _1: (v(1), v(1)) - }) - ], - tl: { - hd: [ - "curry3", - param => ({ - TAG: "Eq", - _0: x, - _1: 14 - }) - ], - tl: { - hd: [ - "File \"ari_regress_test.res\", line 35, characters 5-12", - param => ({ - TAG: "Eq", - _0: h.contents, - _1: 2 - }) - ], - tl: /* [] */0 - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Ari_regress_test", suites); - -/* Not a pure module */ diff --git a/tests/tests/src/ari_regress_test.mjs b/tests/tests/src/ari_regress_test.mjs new file mode 100644 index 0000000000..d8cec46c27 --- /dev/null +++ b/tests/tests/src/ari_regress_test.mjs @@ -0,0 +1,73 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let g = 7; + +let h = { + contents: 0 +}; + +function g1(x, y) { + let u = x + y | 0; + h.contents = h.contents + 1 | 0; + return (xx, yy) => (xx + yy | 0) + u | 0; +} + +let u = 8; + +let x = u + 6 | 0; + +function v(__x) { + return g1(3, 4)(6, __x); +} + +let suites_0 = [ + "curry", + param => ({ + TAG: "Eq", + _0: g, + _1: 7 + }) +]; + +let suites_1 = { + hd: [ + "curry2", + param => ({ + TAG: "Eq", + _0: 14, + _1: (v(1), v(1)) + }) + ], + tl: { + hd: [ + "curry3", + param => ({ + TAG: "Eq", + _0: x, + _1: 14 + }) + ], + tl: { + hd: [ + "File \"ari_regress_test.res\", line 35, characters 5-12", + param => ({ + TAG: "Eq", + _0: h.contents, + _1: 2 + }) + ], + tl: /* [] */0 + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Ari_regress_test", suites); + +/* Not a pure module */ diff --git a/tests/tests/src/arith_syntax.js b/tests/tests/src/arith_syntax.js deleted file mode 100644 index 64ed0baced..0000000000 --- a/tests/tests/src/arith_syntax.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function str(e) { - switch (e.TAG) { - case "Numeral" : - return e._0.toString(); - case "Plus" : - return str(e._0) + ("+" + str(e._1)); - case "Minus" : - return str(e._0) + ("-" + str(e._1)); - case "Times" : - return str(e._0) + ("*" + str(e._1)); - case "Divide" : - return str(e._0) + ("/" + str(e._1)); - case "Negate" : - return "-" + str(e._0); - case "Variable" : - return e._0; - } -} - -exports.str = str; -/* No side effect */ diff --git a/tests/tests/src/arith_syntax.mjs b/tests/tests/src/arith_syntax.mjs new file mode 100644 index 0000000000..4ee789e812 --- /dev/null +++ b/tests/tests/src/arith_syntax.mjs @@ -0,0 +1,26 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function str(e) { + switch (e.TAG) { + case "Numeral" : + return e._0.toString(); + case "Plus" : + return str(e._0) + ("+" + str(e._1)); + case "Minus" : + return str(e._0) + ("-" + str(e._1)); + case "Times" : + return str(e._0) + ("*" + str(e._1)); + case "Divide" : + return str(e._0) + ("/" + str(e._1)); + case "Negate" : + return "-" + str(e._0); + case "Variable" : + return e._0; + } +} + +export { + str, +} +/* No side effect */ diff --git a/tests/tests/src/arity.js b/tests/tests/src/arity.js deleted file mode 100644 index c102b0bb09..0000000000 --- a/tests/tests/src/arity.js +++ /dev/null @@ -1,40 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function u(f, a, b) { - console.log(f(a, b)); - console.log(f(a, b)); -} - -function u2(f, a, b) { - console.log(f(a, b)); - console.log(f(a, b)); -} - -function f(x, y) { - return x + y | 0; -} - -function add(prim0, prim1) { - return prim0 + prim1 | 0; -} - -function h(u) { - let m = u.hi; - return m(1, 2); -} - -let nested = { - x: { - y: 3 - } -}; - -exports.u = u; -exports.u2 = u2; -exports.f = f; -exports.add = add; -exports.h = h; -exports.nested = nested; -/* No side effect */ diff --git a/tests/tests/src/arity.mjs b/tests/tests/src/arity.mjs new file mode 100644 index 0000000000..3545d46d5d --- /dev/null +++ b/tests/tests/src/arity.mjs @@ -0,0 +1,41 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function u(f, a, b) { + console.log(f(a, b)); + console.log(f(a, b)); +} + +function u2(f, a, b) { + console.log(f(a, b)); + console.log(f(a, b)); +} + +function f(x, y) { + return x + y | 0; +} + +function add(prim0, prim1) { + return prim0 + prim1 | 0; +} + +function h(u) { + let m = u.hi; + return m(1, 2); +} + +let nested = { + x: { + y: 3 + } +}; + +export { + u, + u2, + f, + add, + h, + nested, +} +/* No side effect */ diff --git a/tests/tests/src/arity_deopt.js b/tests/tests/src/arity_deopt.js deleted file mode 100644 index 2ee8396746..0000000000 --- a/tests/tests/src/arity_deopt.js +++ /dev/null @@ -1,62 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f0(x, y, z) { - return (x + y | 0) + z | 0; -} - -function f1(x) { - return (y, z) => (x + y | 0) + z | 0; -} - -function f2(x, y) { - return z => (x + y | 0) + z | 0; -} - -function f3(x) { - return (y, z) => (x + y | 0) + z | 0; -} - -eq("File \"arity_deopt.res\", line 50, characters 11-18", 6, 6); - -eq("File \"arity_deopt.res\", line 51, characters 11-18", 6, 6); - -eq("File \"arity_deopt.res\", line 52, characters 11-18", 6, 6); - -eq("File \"arity_deopt.res\", line 53, characters 11-18", 6, 6); - -Mt.from_pair_suites("Arity_deopt", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f0 = f0; -exports.f1 = f1; -exports.f2 = f2; -exports.f3 = f3; -/* Not a pure module */ diff --git a/tests/tests/src/arity_deopt.mjs b/tests/tests/src/arity_deopt.mjs new file mode 100644 index 0000000000..e12d7b1ffe --- /dev/null +++ b/tests/tests/src/arity_deopt.mjs @@ -0,0 +1,63 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f0(x, y, z) { + return (x + y | 0) + z | 0; +} + +function f1(x) { + return (y, z) => (x + y | 0) + z | 0; +} + +function f2(x, y) { + return z => (x + y | 0) + z | 0; +} + +function f3(x) { + return (y, z) => (x + y | 0) + z | 0; +} + +eq("File \"arity_deopt.res\", line 50, characters 11-18", 6, 6); + +eq("File \"arity_deopt.res\", line 51, characters 11-18", 6, 6); + +eq("File \"arity_deopt.res\", line 52, characters 11-18", 6, 6); + +eq("File \"arity_deopt.res\", line 53, characters 11-18", 6, 6); + +Mt.from_pair_suites("Arity_deopt", suites.contents); + +export { + suites, + test_id, + eq, + f0, + f1, + f2, + f3, +} +/* Not a pure module */ diff --git a/tests/tests/src/arity_infer.js b/tests/tests/src/arity_infer.js deleted file mode 100644 index 0e7fd13815..0000000000 --- a/tests/tests/src/arity_infer.js +++ /dev/null @@ -1,53 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f0(x) { - let tmp; - if (x > 3) { - tmp = x => x + 1 | 0; - } else { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - return tmp(3); -} - -function f1(x) { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - return undefined(x); -} - -function f3(x) { - let tmp; - switch (x) { - case 0 : - tmp = x => x + 1 | 0; - break; - case 1 : - tmp = x => x + 2 | 0; - break; - case 2 : - tmp = x => x + 3 | 0; - break; - case 3 : - tmp = x => x + 4 | 0; - break; - default: - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - return tmp(3); -} - -exports.f0 = f0; -exports.f1 = f1; -exports.f3 = f3; -/* No side effect */ diff --git a/tests/tests/src/arity_infer.mjs b/tests/tests/src/arity_infer.mjs new file mode 100644 index 0000000000..d009cbf9ae --- /dev/null +++ b/tests/tests/src/arity_infer.mjs @@ -0,0 +1,54 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f0(x) { + let tmp; + if (x > 3) { + tmp = x => x + 1 | 0; + } else { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + return tmp(3); +} + +function f1(x) { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + return undefined(x); +} + +function f3(x) { + let tmp; + switch (x) { + case 0 : + tmp = x => x + 1 | 0; + break; + case 1 : + tmp = x => x + 2 | 0; + break; + case 2 : + tmp = x => x + 3 | 0; + break; + case 3 : + tmp = x => x + 4 | 0; + break; + default: + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + return tmp(3); +} + +export { + f0, + f1, + f3, +} +/* No side effect */ diff --git a/tests/tests/src/array_data_util.js b/tests/tests/src/array_data_util.js deleted file mode 100644 index cb6db4f707..0000000000 --- a/tests/tests/src/array_data_util.js +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -function range(i, j) { - return Belt_Array.makeBy((j - i | 0) + 1 | 0, k => k + i | 0); -} - -function randomRange(i, j) { - let v = Belt_Array.makeBy((j - i | 0) + 1 | 0, k => k + i | 0); - Belt_Array.shuffleInPlace(v); - return v; -} - -let A; - -exports.A = A; -exports.range = range; -exports.randomRange = randomRange; -/* No side effect */ diff --git a/tests/tests/src/array_data_util.mjs b/tests/tests/src/array_data_util.mjs new file mode 100644 index 0000000000..fed7896a91 --- /dev/null +++ b/tests/tests/src/array_data_util.mjs @@ -0,0 +1,22 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +function range(i, j) { + return Belt_Array.makeBy((j - i | 0) + 1 | 0, k => k + i | 0); +} + +function randomRange(i, j) { + let v = Belt_Array.makeBy((j - i | 0) + 1 | 0, k => k + i | 0); + Belt_Array.shuffleInPlace(v); + return v; +} + +let A; + +export { + A, + range, + randomRange, +} +/* No side effect */ diff --git a/tests/tests/src/array_safe_get.js b/tests/tests/src/array_safe_get.js deleted file mode 100644 index 1f08bf078c..0000000000 --- a/tests/tests/src/array_safe_get.js +++ /dev/null @@ -1,31 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let x = [ - 1, - 2 -]; - -let y; - -try { - y = Primitive_array.get(x, 3); -} catch (raw_msg) { - let msg = Primitive_exceptions.internalToException(raw_msg); - if (msg.RE_EXN_ID === "Invalid_argument") { - console.log(msg._1); - y = 0; - } else { - throw msg; - } -} - -let $$Array; - -exports.$$Array = $$Array; -exports.x = x; -exports.y = y; -/* y Not a pure module */ diff --git a/tests/tests/src/array_safe_get.mjs b/tests/tests/src/array_safe_get.mjs new file mode 100644 index 0000000000..7ddd6113b7 --- /dev/null +++ b/tests/tests/src/array_safe_get.mjs @@ -0,0 +1,32 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let x = [ + 1, + 2 +]; + +let y; + +try { + y = Primitive_array.get(x, 3); +} catch (raw_msg) { + let msg = Primitive_exceptions.internalToException(raw_msg); + if (msg.RE_EXN_ID === "Invalid_argument") { + console.log(msg._1); + y = 0; + } else { + throw msg; + } +} + +let $$Array; + +export { + $$Array, + x, + y, +} +/* y Not a pure module */ diff --git a/tests/tests/src/array_subtle_test.js b/tests/tests/src/array_subtle_test.js deleted file mode 100644 index c8d11befb2..0000000000 --- a/tests/tests/src/array_subtle_test.js +++ /dev/null @@ -1,143 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, param) { - let y = param[1]; - let x = param[0]; - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let v = [ - 1, - 2, - 3, - 3 -]; - -eq("File \"array_subtle_test.res\", line 16, characters 12-19", [ - 4, - v.length -]); - -eq("File \"array_subtle_test.res\", line 19, characters 5-12", [ - 5, - v.push(3) -]); - -eq("File \"array_subtle_test.res\", line 20, characters 5-12", [ - 5, - v.length -]); - -eq("File \"array_subtle_test.res\", line 21, characters 5-12", [ - 5, - v.length -]); - -eq("File \"array_subtle_test.res\", line 25, characters 5-12", [ - 3, - Primitive_array.get(v, 2) -]); - -Primitive_array.set(v, 2, 4); - -eq("File \"array_subtle_test.res\", line 27, characters 5-12", [ - 4, - Primitive_array.get(v, 2) -]); - -while (v.length > 0) { - v.pop(); -}; - -eq("File \"array_subtle_test.res\", line 34, characters 5-12", [ - 0, - v.length -]); - -function f(v) { - let x = v.pop(); - if (x !== undefined) { - console.log("hi"); - } else { - console.log("hi2"); - } - console.log((v.pop(), undefined)); -} - -function fff(x) { - return true; -} - -function fff2(x) { - if (x.length >= 10) { - console.log("hi"); - return; - } - -} - -function fff3(x) { - return 1; -} - -function fff4(x) { - if (x.length !== 0) { - return 1; - } else { - return 2; - } -} - -eq("File \"array_subtle_test.res\", line 66, characters 3-10", [ - fff3([]), - 1 -]); - -eq("File \"array_subtle_test.res\", line 67, characters 3-10", [ - fff4([]), - 2 -]); - -eq("File \"array_subtle_test.res\", line 68, characters 3-10", [ - fff4([1]), - 1 -]); - -Mt.from_pair_suites("Array_subtle_test", suites.contents); - -let $$Array; - -exports.$$Array = $$Array; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.f = f; -exports.fff = fff; -exports.fff2 = fff2; -exports.fff3 = fff3; -exports.fff4 = fff4; -/* Not a pure module */ diff --git a/tests/tests/src/array_subtle_test.mjs b/tests/tests/src/array_subtle_test.mjs new file mode 100644 index 0000000000..233c0680ee --- /dev/null +++ b/tests/tests/src/array_subtle_test.mjs @@ -0,0 +1,144 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, param) { + let y = param[1]; + let x = param[0]; + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let v = [ + 1, + 2, + 3, + 3 +]; + +eq("File \"array_subtle_test.res\", line 16, characters 12-19", [ + 4, + v.length +]); + +eq("File \"array_subtle_test.res\", line 19, characters 5-12", [ + 5, + v.push(3) +]); + +eq("File \"array_subtle_test.res\", line 20, characters 5-12", [ + 5, + v.length +]); + +eq("File \"array_subtle_test.res\", line 21, characters 5-12", [ + 5, + v.length +]); + +eq("File \"array_subtle_test.res\", line 25, characters 5-12", [ + 3, + Primitive_array.get(v, 2) +]); + +Primitive_array.set(v, 2, 4); + +eq("File \"array_subtle_test.res\", line 27, characters 5-12", [ + 4, + Primitive_array.get(v, 2) +]); + +while (v.length > 0) { + v.pop(); +}; + +eq("File \"array_subtle_test.res\", line 34, characters 5-12", [ + 0, + v.length +]); + +function f(v) { + let x = v.pop(); + if (x !== undefined) { + console.log("hi"); + } else { + console.log("hi2"); + } + console.log((v.pop(), undefined)); +} + +function fff(x) { + return true; +} + +function fff2(x) { + if (x.length >= 10) { + console.log("hi"); + return; + } + +} + +function fff3(x) { + return 1; +} + +function fff4(x) { + if (x.length !== 0) { + return 1; + } else { + return 2; + } +} + +eq("File \"array_subtle_test.res\", line 66, characters 3-10", [ + fff3([]), + 1 +]); + +eq("File \"array_subtle_test.res\", line 67, characters 3-10", [ + fff4([]), + 2 +]); + +eq("File \"array_subtle_test.res\", line 68, characters 3-10", [ + fff4([1]), + 1 +]); + +Mt.from_pair_suites("Array_subtle_test", suites.contents); + +let $$Array; + +export { + $$Array, + suites, + test_id, + eq, + v, + f, + fff, + fff2, + fff3, + fff4, +} +/* Not a pure module */ diff --git a/tests/tests/src/as_inline_record_test.js b/tests/tests/src/as_inline_record_test.js deleted file mode 100644 index 7a320bb8bf..0000000000 --- a/tests/tests/src/as_inline_record_test.js +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function getName(t) { - return t.renamed; -} - -function getName$p(t) { - return t.renamed; -} - -function getAge(t) { - return t.age; -} - -function getAge$p(t) { - return t.age; -} - -let user = { - TAG: "User", - renamed: "Corentin", - age: 35 -}; - -exports.user = user; -exports.getName = getName; -exports.getName$p = getName$p; -exports.getAge = getAge; -exports.getAge$p = getAge$p; -/* No side effect */ diff --git a/tests/tests/src/as_inline_record_test.mjs b/tests/tests/src/as_inline_record_test.mjs new file mode 100644 index 0000000000..bde885a70e --- /dev/null +++ b/tests/tests/src/as_inline_record_test.mjs @@ -0,0 +1,33 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function getName(t) { + return t.renamed; +} + +function getName$p(t) { + return t.renamed; +} + +function getAge(t) { + return t.age; +} + +function getAge$p(t) { + return t.age; +} + +let user = { + TAG: "User", + renamed: "Corentin", + age: 35 +}; + +export { + user, + getName, + getName$p, + getAge, + getAge$p, +} +/* No side effect */ diff --git a/tests/tests/src/ast_abstract_test.js b/tests/tests/src/ast_abstract_test.js deleted file mode 100644 index cda63897b2..0000000000 --- a/tests/tests/src/ast_abstract_test.js +++ /dev/null @@ -1,96 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_util = require("rescript/lib/js/Primitive_util.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function tToJs(param) { - return { - x: param.x, - y: param.y, - z: param.z - }; -} - -function tFromJs(param) { - return { - x: param.x, - y: param.y, - z: param.z - }; -} - -let v0 = { - x: 3, - y: false, - z: false -}; - -let v1 = { - x: 3, - y: false, - z: "" -}; - -let _map = {"a":"a","b":"b","c":"c"}; - -function xToJs(param) { - return param; -} - -function xFromJs(param) { - return Primitive_util.raiseWhenNotFound(_map[param]); -} - -function idx(v) { - eq("File \"ast_abstract_test.res\", line 29, characters 18-25", xFromJs(v), v); -} - -idx("a"); - -idx("b"); - -idx("c"); - -Mt.from_pair_suites("Ast_abstract_test", suites.contents); - -let x0 = "a"; - -let x1 = "b"; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.tToJs = tToJs; -exports.tFromJs = tFromJs; -exports.v0 = v0; -exports.v1 = v1; -exports.xToJs = xToJs; -exports.xFromJs = xFromJs; -exports.idx = idx; -exports.x0 = x0; -exports.x1 = x1; -/* Not a pure module */ diff --git a/tests/tests/src/ast_abstract_test.mjs b/tests/tests/src/ast_abstract_test.mjs new file mode 100644 index 0000000000..4044c5b37f --- /dev/null +++ b/tests/tests/src/ast_abstract_test.mjs @@ -0,0 +1,97 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_util from "rescript/lib/es6/Primitive_util.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function tToJs(param) { + return { + x: param.x, + y: param.y, + z: param.z + }; +} + +function tFromJs(param) { + return { + x: param.x, + y: param.y, + z: param.z + }; +} + +let v0 = { + x: 3, + y: false, + z: false +}; + +let v1 = { + x: 3, + y: false, + z: "" +}; + +let _map = {"a":"a","b":"b","c":"c"}; + +function xToJs(param) { + return param; +} + +function xFromJs(param) { + return Primitive_util.raiseWhenNotFound(_map[param]); +} + +function idx(v) { + eq("File \"ast_abstract_test.res\", line 29, characters 18-25", xFromJs(v), v); +} + +idx("a"); + +idx("b"); + +idx("c"); + +Mt.from_pair_suites("Ast_abstract_test", suites.contents); + +let x0 = "a"; + +let x1 = "b"; + +export { + suites, + test_id, + eq, + tToJs, + tFromJs, + v0, + v1, + xToJs, + xFromJs, + idx, + x0, + x1, +} +/* Not a pure module */ diff --git a/tests/tests/src/ast_mapper_unused_warning_test.js b/tests/tests/src/ast_mapper_unused_warning_test.mjs similarity index 100% rename from tests/tests/src/ast_mapper_unused_warning_test.js rename to tests/tests/src/ast_mapper_unused_warning_test.mjs diff --git a/tests/tests/src/async_await.js b/tests/tests/src/async_await.js deleted file mode 100644 index 670f6a7869..0000000000 --- a/tests/tests/src/async_await.js +++ /dev/null @@ -1,46 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function next(n) { - return n + 1 | 0; -} - -async function useNext() { - return 4; -} - -function Make(I) { - let get = async key => await I.get(key); - return { - get: get - }; -} - -async function topFoo() { - return 1; -} - -let arr = [ - 1, - 2, - 3 -]; - -let toplevelAwait = await topFoo(); - -let toplevelAwait2 = arr[await topFoo()]; - -async function f(value) { - return await Promise.resolve(1); -} - -exports.next = next; -exports.useNext = useNext; -exports.Make = Make; -exports.topFoo = topFoo; -exports.arr = arr; -exports.toplevelAwait = toplevelAwait; -exports.toplevelAwait2 = toplevelAwait2; -exports.f = f; -/* toplevelAwait Not a pure module */ diff --git a/tests/tests/src/async_await.mjs b/tests/tests/src/async_await.mjs new file mode 100644 index 0000000000..1511a66cf3 --- /dev/null +++ b/tests/tests/src/async_await.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function next(n) { + return n + 1 | 0; +} + +async function useNext() { + return 4; +} + +function Make(I) { + let get = async key => await I.get(key); + return { + get: get + }; +} + +async function topFoo() { + return 1; +} + +let arr = [ + 1, + 2, + 3 +]; + +let toplevelAwait = await topFoo(); + +let toplevelAwait2 = arr[await topFoo()]; + +async function f(value) { + return await Promise.resolve(1); +} + +export { + next, + useNext, + Make, + topFoo, + arr, + toplevelAwait, + toplevelAwait2, + f, +} +/* toplevelAwait Not a pure module */ diff --git a/tests/tests/src/async_inline.js b/tests/tests/src/async_inline.js deleted file mode 100644 index 247e22bdff..0000000000 --- a/tests/tests/src/async_inline.js +++ /dev/null @@ -1,95 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let React = require("react"); - -async function willBeInlined() { - return 3; -} - -let inlined = willBeInlined(); - -function wrapSomethingAsync() { - (async param => { - let test = await Promise.resolve("Test"); - console.log(test); - })(777); -} - -function wrapSomethingAsync2() { - (async () => { - let test = await Promise.resolve("Test"); - console.log(test); - })(); -} - -async function doSomethingAsync(someAsyncFunction) { - return await someAsyncFunction(); -} - -let broken = doSomethingAsync; - -let M = { - broken: broken -}; - -async function broken$1(someAsyncFunction) { - return await someAsyncFunction(); -} - -let broken$2 = broken$1; - -function curriedId(x) { - return x; -} - -async function curriedIdAsync(x) { - return x; -} - -function uncurriedId(x) { - return x; -} - -async function uncurriedIdAsync(x) { - return x; -} - -let tci = 3; - -let tcia = curriedIdAsync(3); - -let tui = 3; - -let tuia = uncurriedIdAsync(3); - -function nested1() { - return async y => await y; -} - -async function nested2() { - return async y => await y; -} - -function onSubmit() { - return React.useCallback(async b => await b); -} - -exports.willBeInlined = willBeInlined; -exports.inlined = inlined; -exports.wrapSomethingAsync = wrapSomethingAsync; -exports.wrapSomethingAsync2 = wrapSomethingAsync2; -exports.M = M; -exports.broken = broken$2; -exports.curriedId = curriedId; -exports.curriedIdAsync = curriedIdAsync; -exports.uncurriedId = uncurriedId; -exports.uncurriedIdAsync = uncurriedIdAsync; -exports.tci = tci; -exports.tcia = tcia; -exports.tui = tui; -exports.tuia = tuia; -exports.nested1 = nested1; -exports.nested2 = nested2; -exports.onSubmit = onSubmit; -/* inlined Not a pure module */ diff --git a/tests/tests/src/async_inline.mjs b/tests/tests/src/async_inline.mjs new file mode 100644 index 0000000000..e5d8b12954 --- /dev/null +++ b/tests/tests/src/async_inline.mjs @@ -0,0 +1,96 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as React from "react"; + +async function willBeInlined() { + return 3; +} + +let inlined = willBeInlined(); + +function wrapSomethingAsync() { + (async param => { + let test = await Promise.resolve("Test"); + console.log(test); + })(777); +} + +function wrapSomethingAsync2() { + (async () => { + let test = await Promise.resolve("Test"); + console.log(test); + })(); +} + +async function doSomethingAsync(someAsyncFunction) { + return await someAsyncFunction(); +} + +let broken = doSomethingAsync; + +let M = { + broken: broken +}; + +async function broken$1(someAsyncFunction) { + return await someAsyncFunction(); +} + +let broken$2 = broken$1; + +function curriedId(x) { + return x; +} + +async function curriedIdAsync(x) { + return x; +} + +function uncurriedId(x) { + return x; +} + +async function uncurriedIdAsync(x) { + return x; +} + +let tci = 3; + +let tcia = curriedIdAsync(3); + +let tui = 3; + +let tuia = uncurriedIdAsync(3); + +function nested1() { + return async y => await y; +} + +async function nested2() { + return async y => await y; +} + +function onSubmit() { + return React.useCallback(async b => await b); +} + +export { + willBeInlined, + inlined, + wrapSomethingAsync, + wrapSomethingAsync2, + M, + broken$2 as broken, + curriedId, + curriedIdAsync, + uncurriedId, + uncurriedIdAsync, + tci, + tcia, + tui, + tuia, + nested1, + nested2, + onSubmit, +} +/* inlined Not a pure module */ diff --git a/tests/tests/src/async_inside_loop.js b/tests/tests/src/async_inside_loop.js deleted file mode 100644 index 889065bf7e..0000000000 --- a/tests/tests/src/async_inside_loop.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -async function topLevelAsyncFunction() { - for (let innerScopeVal = 0; innerScopeVal <= 3; ++innerScopeVal) { - let asyncClosureAccessingScopedVal = async () => { - console.log("Accessing scoped var inside loop", innerScopeVal); - return await Promise.resolve(); - }; - await asyncClosureAccessingScopedVal(); - } -} - -topLevelAsyncFunction(); - -exports.topLevelAsyncFunction = topLevelAsyncFunction; -/* Not a pure module */ diff --git a/tests/tests/src/async_inside_loop.mjs b/tests/tests/src/async_inside_loop.mjs new file mode 100644 index 0000000000..36298ce7d3 --- /dev/null +++ b/tests/tests/src/async_inside_loop.mjs @@ -0,0 +1,19 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +async function topLevelAsyncFunction() { + for (let innerScopeVal = 0; innerScopeVal <= 3; ++innerScopeVal) { + let asyncClosureAccessingScopedVal = async () => { + console.log("Accessing scoped var inside loop", innerScopeVal); + return await Promise.resolve(); + }; + await asyncClosureAccessingScopedVal(); + } +} + +topLevelAsyncFunction(); + +export { + topLevelAsyncFunction, +} +/* Not a pure module */ diff --git a/tests/tests/src/attr_test.js b/tests/tests/src/attr_test.js deleted file mode 100644 index 646d4e7de1..0000000000 --- a/tests/tests/src/attr_test.js +++ /dev/null @@ -1,28 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function u(x, y) { - return x + y | 0; -} - -let h = 3; - -function max2(x, y) { - return x + y; -} - -let hh = 1 + 2; - -function f(x) { - des(x, () => { - console.log("hei"); - }); -} - -exports.u = u; -exports.h = h; -exports.max2 = max2; -exports.hh = hh; -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/attr_test.mjs b/tests/tests/src/attr_test.mjs new file mode 100644 index 0000000000..d839ca7232 --- /dev/null +++ b/tests/tests/src/attr_test.mjs @@ -0,0 +1,29 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function u(x, y) { + return x + y | 0; +} + +let h = 3; + +function max2(x, y) { + return x + y; +} + +let hh = 1 + 2; + +function f(x) { + des(x, () => { + console.log("hei"); + }); +} + +export { + u, + h, + max2, + hh, + f, +} +/* No side effect */ diff --git a/tests/tests/src/b.js b/tests/tests/src/b.js deleted file mode 100644 index 350cd0e7d9..0000000000 --- a/tests/tests/src/b.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(point) { - let y = point.y; - let x = point.x; - return Math.pow(x * x + y * y, 2); -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/b.mjs b/tests/tests/src/b.mjs new file mode 100644 index 0000000000..1738e2ec25 --- /dev/null +++ b/tests/tests/src/b.mjs @@ -0,0 +1,13 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(point) { + let y = point.y; + let x = point.x; + return Math.pow(x * x + y * y, 2); +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/bal_set_mini.js b/tests/tests/src/bal_set_mini.js deleted file mode 100644 index 3e5ebbf698..0000000000 --- a/tests/tests/src/bal_set_mini.js +++ /dev/null @@ -1,201 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function height(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._3; - } -} - -function create(l, v, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: v, - _2: r, - _3: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, v, r) { - let hl = height(l); - let hr = height(r); - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return "Empty"; - } - let lr = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, create(lr, v, r)); - } else if (typeof lr !== "object") { - return "Empty"; - } else { - return create(create(ll, lv, lr._0), lr._1, create(lr._2, v, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: v, - _2: r, - _3: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return "Empty"; - } - let rr = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, v, rl), rv, rr); - } else if (typeof rl !== "object") { - return "Empty"; - } else { - return create(create(l, v, rl._0), rl._1, create(rl._2, rv, rr)); - } -} - -function compare_int(x, y) { - if (x > y) { - return 1; - } else if (x === y) { - return 0; - } else { - return -1; - } -} - -function add(x, x_) { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: "Empty", - _3: 1 - }; - } - let r = x_._2; - let v = x_._1; - let l = x_._0; - let c = compare_int(x, v); - if (c === 0) { - return x_; - } else if (c < 0) { - return bal(add(x, l), v, r); - } else { - return bal(l, v, add(x, r)); - } -} - -function min_elt(_def, _x) { - while (true) { - let x = _x; - let def = _def; - if (typeof x !== "object") { - return def; - } - let l = x._0; - if (typeof l !== "object") { - return x._1; - } - _x = l; - _def = x._1; - continue; - }; -} - -function remove_min_elt(l, v, r) { - if (typeof l !== "object") { - return r; - } else { - return bal(remove_min_elt(l._0, l._1, l._2), v, r); - } -} - -function internal_merge(l, r) { - if (typeof l !== "object") { - return r; - } - if (typeof r !== "object") { - return l; - } - let rv = r._1; - return bal(l, min_elt(rv, r), remove_min_elt(r._0, rv, r._2)); -} - -function remove(x, tree) { - if (typeof tree !== "object") { - return "Empty"; - } - let r = tree._2; - let v = tree._1; - let l = tree._0; - let c = compare_int(x, v); - if (c === 0) { - return internal_merge(l, r); - } else if (c < 0) { - return bal(remove(x, l), v, r); - } else { - return bal(l, v, remove(x, r)); - } -} - -function mem(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - return false; - } - let c = compare_int(x, x_._1); - if (c === 0) { - return true; - } - _x_ = c < 0 ? x_._0 : x_._2; - continue; - }; -} - -let v = "Empty"; - -for (let i = 0; i <= 100000; ++i) { - v = add(i, v); -} - -for (let i$1 = 0; i$1 <= 100000; ++i$1) { - if (!mem(i$1, v)) { - console.log("impossible"); - } - -} - -for (let i$2 = 0; i$2 <= 100000; ++i$2) { - v = remove(i$2, v); -} - -let match = v; - -if (typeof match === "object") { - console.log("impossible"); -} - -exports.height = height; -exports.create = create; -exports.bal = bal; -exports.compare_int = compare_int; -exports.add = add; -exports.min_elt = min_elt; -exports.remove_min_elt = remove_min_elt; -exports.internal_merge = internal_merge; -exports.remove = remove; -exports.mem = mem; -/* Not a pure module */ diff --git a/tests/tests/src/bal_set_mini.mjs b/tests/tests/src/bal_set_mini.mjs new file mode 100644 index 0000000000..11e12c7ba3 --- /dev/null +++ b/tests/tests/src/bal_set_mini.mjs @@ -0,0 +1,202 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function height(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._3; + } +} + +function create(l, v, r) { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: v, + _2: r, + _3: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function bal(l, v, r) { + let hl = height(l); + let hr = height(r); + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return "Empty"; + } + let lr = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, create(lr, v, r)); + } else if (typeof lr !== "object") { + return "Empty"; + } else { + return create(create(ll, lv, lr._0), lr._1, create(lr._2, v, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: v, + _2: r, + _3: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return "Empty"; + } + let rr = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, v, rl), rv, rr); + } else if (typeof rl !== "object") { + return "Empty"; + } else { + return create(create(l, v, rl._0), rl._1, create(rl._2, rv, rr)); + } +} + +function compare_int(x, y) { + if (x > y) { + return 1; + } else if (x === y) { + return 0; + } else { + return -1; + } +} + +function add(x, x_) { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: "Empty", + _3: 1 + }; + } + let r = x_._2; + let v = x_._1; + let l = x_._0; + let c = compare_int(x, v); + if (c === 0) { + return x_; + } else if (c < 0) { + return bal(add(x, l), v, r); + } else { + return bal(l, v, add(x, r)); + } +} + +function min_elt(_def, _x) { + while (true) { + let x = _x; + let def = _def; + if (typeof x !== "object") { + return def; + } + let l = x._0; + if (typeof l !== "object") { + return x._1; + } + _x = l; + _def = x._1; + continue; + }; +} + +function remove_min_elt(l, v, r) { + if (typeof l !== "object") { + return r; + } else { + return bal(remove_min_elt(l._0, l._1, l._2), v, r); + } +} + +function internal_merge(l, r) { + if (typeof l !== "object") { + return r; + } + if (typeof r !== "object") { + return l; + } + let rv = r._1; + return bal(l, min_elt(rv, r), remove_min_elt(r._0, rv, r._2)); +} + +function remove(x, tree) { + if (typeof tree !== "object") { + return "Empty"; + } + let r = tree._2; + let v = tree._1; + let l = tree._0; + let c = compare_int(x, v); + if (c === 0) { + return internal_merge(l, r); + } else if (c < 0) { + return bal(remove(x, l), v, r); + } else { + return bal(l, v, remove(x, r)); + } +} + +function mem(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + return false; + } + let c = compare_int(x, x_._1); + if (c === 0) { + return true; + } + _x_ = c < 0 ? x_._0 : x_._2; + continue; + }; +} + +let v = "Empty"; + +for (let i = 0; i <= 100000; ++i) { + v = add(i, v); +} + +for (let i$1 = 0; i$1 <= 100000; ++i$1) { + if (!mem(i$1, v)) { + console.log("impossible"); + } + +} + +for (let i$2 = 0; i$2 <= 100000; ++i$2) { + v = remove(i$2, v); +} + +let match = v; + +if (typeof match === "object") { + console.log("impossible"); +} + +export { + height, + create, + bal, + compare_int, + add, + min_elt, + remove_min_elt, + internal_merge, + remove, + mem, +} +/* Not a pure module */ diff --git a/tests/tests/src/bb.js b/tests/tests/src/bb.js deleted file mode 100644 index 18f51ea211..0000000000 --- a/tests/tests/src/bb.js +++ /dev/null @@ -1,83 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - if (x === "b") { - return "b"; - } else if (x === "c") { - return "c"; - } else { - return "a"; - } -} - -function ff(x) { - switch (x) { - case "a" : - return "a"; - case "b" : - return "b"; - case "c" : - return "c"; - default: - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bb.res", - 13, - 9 - ], - Error: new Error() - }; - } -} - -function test(x) { - let match; - switch (x) { - case "a" : - match = "a"; - break; - case "b" : - match = "b"; - break; - case "c" : - match = "c"; - break; - default: - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bb.res", - 21, - 9 - ], - Error: new Error() - }; - } - if (match === "b") { - return "b"; - } else if (match === "c") { - return "c"; - } else { - return "a"; - } -} - -let test_poly = "a"; - -let c = f("a"); - -let d = f("b"); - -let e = f("c"); - -exports.f = f; -exports.ff = ff; -exports.test = test; -exports.test_poly = test_poly; -exports.c = c; -exports.d = d; -exports.e = e; -/* c Not a pure module */ diff --git a/tests/tests/src/bb.mjs b/tests/tests/src/bb.mjs new file mode 100644 index 0000000000..e2f8c65852 --- /dev/null +++ b/tests/tests/src/bb.mjs @@ -0,0 +1,84 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + if (x === "b") { + return "b"; + } else if (x === "c") { + return "c"; + } else { + return "a"; + } +} + +function ff(x) { + switch (x) { + case "a" : + return "a"; + case "b" : + return "b"; + case "c" : + return "c"; + default: + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 13, + 9 + ], + Error: new Error() + }; + } +} + +function test(x) { + let match; + switch (x) { + case "a" : + match = "a"; + break; + case "b" : + match = "b"; + break; + case "c" : + match = "c"; + break; + default: + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bb.res", + 21, + 9 + ], + Error: new Error() + }; + } + if (match === "b") { + return "b"; + } else if (match === "c") { + return "c"; + } else { + return "a"; + } +} + +let test_poly = "a"; + +let c = f("a"); + +let d = f("b"); + +let e = f("c"); + +export { + f, + ff, + test, + test_poly, + c, + d, + e, +} +/* c Not a pure module */ diff --git a/tests/tests/src/bdd.js b/tests/tests/src/bdd.js deleted file mode 100644 index 60d94b46e7..0000000000 --- a/tests/tests/src/bdd.js +++ /dev/null @@ -1,462 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); - -function $$eval(_bdd, vars) { - while (true) { - let bdd = _bdd; - if (typeof bdd !== "object") { - if (bdd === "One") { - return true; - } else { - return false; - } - } - if (Primitive_array.get(vars, bdd._1)) { - _bdd = bdd._3; - continue; - } - _bdd = bdd._0; - continue; - }; -} - -function getId(bdd) { - if (typeof bdd !== "object") { - if (bdd === "One") { - return 1; - } else { - return 0; - } - } else { - return bdd._2; - } -} - -let nodeC = { - contents: 1 -}; - -let sz_1 = { - contents: 8191 -}; - -let htab = { - contents: Belt_Array.make(sz_1.contents + 1 | 0, /* [] */0) -}; - -let n_items = { - contents: 0 -}; - -function hashVal(x, y, v) { - return ((x << 1) + y | 0) + (v << 2) | 0; -} - -function resize(newSize) { - let arr = htab.contents; - let newSz_1 = newSize - 1 | 0; - let newArr = Belt_Array.make(newSize, /* [] */0); - let copyBucket = _bucket => { - while (true) { - let bucket = _bucket; - if (!bucket) { - return; - } - let n = bucket.hd; - if (typeof n !== "object") { - if (n === "One") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 62, - 13 - ], - Error: new Error() - }; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 62, - 13 - ], - Error: new Error() - }; - } else { - let ind = hashVal(getId(n._0), getId(n._3), n._1) & newSz_1; - Primitive_array.set(newArr, ind, { - hd: n, - tl: Primitive_array.get(newArr, ind) - }); - _bucket = bucket.tl; - continue; - } - }; - }; - for (let n = 0, n_finish = sz_1.contents; n <= n_finish; ++n) { - copyBucket(Primitive_array.get(arr, n)); - } - htab.contents = newArr; - sz_1.contents = newSz_1; -} - -function insert(idl, idh, v, ind, bucket, newNode) { - if (n_items.contents <= sz_1.contents) { - Primitive_array.set(htab.contents, ind, { - hd: newNode, - tl: bucket - }); - n_items.contents = n_items.contents + 1 | 0; - return; - } - resize((sz_1.contents + sz_1.contents | 0) + 2 | 0); - let ind$1 = hashVal(idl, idh, v) & sz_1.contents; - Primitive_array.set(htab.contents, ind$1, { - hd: newNode, - tl: Primitive_array.get(htab.contents, ind$1) - }); -} - -function resetUnique() { - sz_1.contents = 8191; - htab.contents = Belt_Array.make(sz_1.contents + 1 | 0, /* [] */0); - n_items.contents = 0; - nodeC.contents = 1; -} - -function mkNode(low, v, high) { - let idl = getId(low); - let idh = getId(high); - if (idl === idh) { - return low; - } - let ind = hashVal(idl, idh, v) & sz_1.contents; - let bucket = Primitive_array.get(htab.contents, ind); - let _b = bucket; - while (true) { - let b = _b; - if (b) { - let n = b.hd; - if (typeof n !== "object") { - if (n === "One") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 123, - 15 - ], - Error: new Error() - }; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 123, - 15 - ], - Error: new Error() - }; - } else { - if (v === n._1 && idl === getId(n._0) && idh === getId(n._3)) { - return n; - } - _b = b.tl; - continue; - } - } else { - let n_2 = (nodeC.contents = nodeC.contents + 1 | 0, nodeC.contents); - let n$1 = { - TAG: "Node", - _0: low, - _1: v, - _2: n_2, - _3: high - }; - insert(getId(low), getId(high), v, ind, bucket, n$1); - return n$1; - } - }; -} - -function cmpVar(x, y) { - if (x < y) { - return "LESS"; - } else if (x > y) { - return "GREATER"; - } else { - return "EQUAL"; - } -} - -function mkVar(x) { - return mkNode("Zero", x, "One"); -} - -let andslot1 = Belt_Array.make(1999, 0); - -let andslot2 = Belt_Array.make(1999, 0); - -let andslot3 = Belt_Array.make(1999, "Zero"); - -let xorslot1 = Belt_Array.make(1999, 0); - -let xorslot2 = Belt_Array.make(1999, 0); - -let xorslot3 = Belt_Array.make(1999, "Zero"); - -let notslot1 = Belt_Array.make(1999, 0); - -let notslot2 = Belt_Array.make(1999, "One"); - -function hash(x, y) { - return ((x << 1) + y | 0) % 1999; -} - -function not(n) { - if (typeof n !== "object") { - if (n === "One") { - return "Zero"; - } else { - return "One"; - } - } - let id = n._2; - let h = id % 1999; - if (id === Primitive_array.get(notslot1, h)) { - return Primitive_array.get(notslot2, h); - } - let f = mkNode(not(n._0), n._1, not(n._3)); - Primitive_array.set(notslot1, h, id); - Primitive_array.set(notslot2, h, f); - return f; -} - -function and2(n1, n2) { - if (typeof n1 !== "object") { - if (n1 === "One") { - return n2; - } else { - return "Zero"; - } - } - let r1 = n1._3; - let i1 = n1._2; - let v1 = n1._1; - let l1 = n1._0; - if (typeof n2 !== "object") { - if (n2 === "One") { - return n1; - } else { - return "Zero"; - } - } - let r2 = n2._3; - let i2 = n2._2; - let v2 = n2._1; - let l2 = n2._0; - let h = hash(i1, i2); - if (i1 === Primitive_array.get(andslot1, h) && i2 === Primitive_array.get(andslot2, h)) { - return Primitive_array.get(andslot3, h); - } - let match = cmpVar(v1, v2); - let f; - switch (match) { - case "LESS" : - f = mkNode(and2(l1, n2), v1, and2(r1, n2)); - break; - case "EQUAL" : - f = mkNode(and2(l1, l2), v1, and2(r1, r2)); - break; - case "GREATER" : - f = mkNode(and2(n1, l2), v2, and2(n1, r2)); - break; - } - Primitive_array.set(andslot1, h, i1); - Primitive_array.set(andslot2, h, i2); - Primitive_array.set(andslot3, h, f); - return f; -} - -function xor(n1, n2) { - if (typeof n1 !== "object") { - if (n1 === "One") { - return not(n2); - } else { - return n2; - } - } - let r1 = n1._3; - let i1 = n1._2; - let v1 = n1._1; - let l1 = n1._0; - if (typeof n2 !== "object") { - if (n2 === "One") { - return not(n1); - } else { - return n1; - } - } - let r2 = n2._3; - let i2 = n2._2; - let v2 = n2._1; - let l2 = n2._0; - let h = hash(i1, i2); - if (i1 === Primitive_array.get(andslot1, h) && i2 === Primitive_array.get(andslot2, h)) { - return Primitive_array.get(andslot3, h); - } - let match = cmpVar(v1, v2); - let f; - switch (match) { - case "LESS" : - f = mkNode(xor(l1, n2), v1, xor(r1, n2)); - break; - case "EQUAL" : - f = mkNode(xor(l1, l2), v1, xor(r1, r2)); - break; - case "GREATER" : - f = mkNode(xor(n1, l2), v2, xor(n1, r2)); - break; - } - Primitive_array.set(andslot1, h, i1); - Primitive_array.set(andslot2, h, i2); - Primitive_array.set(andslot3, h, f); - return f; -} - -function hwb(n) { - let h = (i, j) => { - if (i === j) { - return mkNode("Zero", i, "One"); - } else { - return xor(and2(not(mkNode("Zero", j, "One")), h(i, j - 1 | 0)), and2(mkNode("Zero", j, "One"), g(i, j - 1 | 0))); - } - }; - let g = (i, j) => { - if (i === j) { - return mkNode("Zero", i, "One"); - } else { - return xor(and2(not(mkNode("Zero", i, "One")), h(i + 1 | 0, j)), and2(mkNode("Zero", i, "One"), g(i + 1 | 0, j))); - } - }; - return h(0, n - 1 | 0); -} - -let seed = { - contents: 0 -}; - -function random() { - seed.contents = Math.imul(seed.contents, 25173) + 17431 | 0; - return (seed.contents & 1) > 0; -} - -function random_vars(n) { - let vars = Belt_Array.make(n, false); - for (let i = 0; i < n; ++i) { - Primitive_array.set(vars, i, random()); - } - return vars; -} - -function bool_equal(a, b) { - if (a) { - if (b) { - return true; - } else { - return false; - } - } else if (b) { - return false; - } else { - return true; - } -} - -function test_hwb(bdd, vars) { - let ntrue = 0; - for (let i = 0, i_finish = vars.length; i < i_finish; ++i) { - if (Primitive_array.get(vars, i)) { - ntrue = ntrue + 1 | 0; - } - - } - return bool_equal($$eval(bdd, vars), ntrue > 0 ? Primitive_array.get(vars, ntrue - 1 | 0) : false); -} - -function main() { - let bdd = hwb(22); - let succeeded = true; - for (let i = 1; i <= 100; ++i) { - succeeded = succeeded && test_hwb(bdd, random_vars(22)); - } - if (succeeded) { - return; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bdd.res", - 304, - 2 - ], - Error: new Error() - }; -} - -main(); - -let $$Array; - -let initSize_1 = 8191; - -let zero = "Zero"; - -let one = "One"; - -let cacheSize = 1999; - -exports.$$Array = $$Array; -exports.$$eval = $$eval; -exports.getId = getId; -exports.initSize_1 = initSize_1; -exports.nodeC = nodeC; -exports.sz_1 = sz_1; -exports.htab = htab; -exports.n_items = n_items; -exports.hashVal = hashVal; -exports.resize = resize; -exports.insert = insert; -exports.resetUnique = resetUnique; -exports.mkNode = mkNode; -exports.cmpVar = cmpVar; -exports.zero = zero; -exports.one = one; -exports.mkVar = mkVar; -exports.cacheSize = cacheSize; -exports.andslot1 = andslot1; -exports.andslot2 = andslot2; -exports.andslot3 = andslot3; -exports.xorslot1 = xorslot1; -exports.xorslot2 = xorslot2; -exports.xorslot3 = xorslot3; -exports.notslot1 = notslot1; -exports.notslot2 = notslot2; -exports.hash = hash; -exports.not = not; -exports.and2 = and2; -exports.xor = xor; -exports.hwb = hwb; -exports.seed = seed; -exports.random = random; -exports.random_vars = random_vars; -exports.bool_equal = bool_equal; -exports.test_hwb = test_hwb; -exports.main = main; -/* htab Not a pure module */ diff --git a/tests/tests/src/bdd.mjs b/tests/tests/src/bdd.mjs new file mode 100644 index 0000000000..7f9dfe1b01 --- /dev/null +++ b/tests/tests/src/bdd.mjs @@ -0,0 +1,463 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; + +function $$eval(_bdd, vars) { + while (true) { + let bdd = _bdd; + if (typeof bdd !== "object") { + if (bdd === "One") { + return true; + } else { + return false; + } + } + if (Primitive_array.get(vars, bdd._1)) { + _bdd = bdd._3; + continue; + } + _bdd = bdd._0; + continue; + }; +} + +function getId(bdd) { + if (typeof bdd !== "object") { + if (bdd === "One") { + return 1; + } else { + return 0; + } + } else { + return bdd._2; + } +} + +let nodeC = { + contents: 1 +}; + +let sz_1 = { + contents: 8191 +}; + +let htab = { + contents: Belt_Array.make(sz_1.contents + 1 | 0, /* [] */0) +}; + +let n_items = { + contents: 0 +}; + +function hashVal(x, y, v) { + return ((x << 1) + y | 0) + (v << 2) | 0; +} + +function resize(newSize) { + let arr = htab.contents; + let newSz_1 = newSize - 1 | 0; + let newArr = Belt_Array.make(newSize, /* [] */0); + let copyBucket = _bucket => { + while (true) { + let bucket = _bucket; + if (!bucket) { + return; + } + let n = bucket.hd; + if (typeof n !== "object") { + if (n === "One") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 62, + 13 + ], + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 62, + 13 + ], + Error: new Error() + }; + } else { + let ind = hashVal(getId(n._0), getId(n._3), n._1) & newSz_1; + Primitive_array.set(newArr, ind, { + hd: n, + tl: Primitive_array.get(newArr, ind) + }); + _bucket = bucket.tl; + continue; + } + }; + }; + for (let n = 0, n_finish = sz_1.contents; n <= n_finish; ++n) { + copyBucket(Primitive_array.get(arr, n)); + } + htab.contents = newArr; + sz_1.contents = newSz_1; +} + +function insert(idl, idh, v, ind, bucket, newNode) { + if (n_items.contents <= sz_1.contents) { + Primitive_array.set(htab.contents, ind, { + hd: newNode, + tl: bucket + }); + n_items.contents = n_items.contents + 1 | 0; + return; + } + resize((sz_1.contents + sz_1.contents | 0) + 2 | 0); + let ind$1 = hashVal(idl, idh, v) & sz_1.contents; + Primitive_array.set(htab.contents, ind$1, { + hd: newNode, + tl: Primitive_array.get(htab.contents, ind$1) + }); +} + +function resetUnique() { + sz_1.contents = 8191; + htab.contents = Belt_Array.make(sz_1.contents + 1 | 0, /* [] */0); + n_items.contents = 0; + nodeC.contents = 1; +} + +function mkNode(low, v, high) { + let idl = getId(low); + let idh = getId(high); + if (idl === idh) { + return low; + } + let ind = hashVal(idl, idh, v) & sz_1.contents; + let bucket = Primitive_array.get(htab.contents, ind); + let _b = bucket; + while (true) { + let b = _b; + if (b) { + let n = b.hd; + if (typeof n !== "object") { + if (n === "One") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 123, + 15 + ], + Error: new Error() + }; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 123, + 15 + ], + Error: new Error() + }; + } else { + if (v === n._1 && idl === getId(n._0) && idh === getId(n._3)) { + return n; + } + _b = b.tl; + continue; + } + } else { + let n_2 = (nodeC.contents = nodeC.contents + 1 | 0, nodeC.contents); + let n$1 = { + TAG: "Node", + _0: low, + _1: v, + _2: n_2, + _3: high + }; + insert(getId(low), getId(high), v, ind, bucket, n$1); + return n$1; + } + }; +} + +function cmpVar(x, y) { + if (x < y) { + return "LESS"; + } else if (x > y) { + return "GREATER"; + } else { + return "EQUAL"; + } +} + +function mkVar(x) { + return mkNode("Zero", x, "One"); +} + +let andslot1 = Belt_Array.make(1999, 0); + +let andslot2 = Belt_Array.make(1999, 0); + +let andslot3 = Belt_Array.make(1999, "Zero"); + +let xorslot1 = Belt_Array.make(1999, 0); + +let xorslot2 = Belt_Array.make(1999, 0); + +let xorslot3 = Belt_Array.make(1999, "Zero"); + +let notslot1 = Belt_Array.make(1999, 0); + +let notslot2 = Belt_Array.make(1999, "One"); + +function hash(x, y) { + return ((x << 1) + y | 0) % 1999; +} + +function not(n) { + if (typeof n !== "object") { + if (n === "One") { + return "Zero"; + } else { + return "One"; + } + } + let id = n._2; + let h = id % 1999; + if (id === Primitive_array.get(notslot1, h)) { + return Primitive_array.get(notslot2, h); + } + let f = mkNode(not(n._0), n._1, not(n._3)); + Primitive_array.set(notslot1, h, id); + Primitive_array.set(notslot2, h, f); + return f; +} + +function and2(n1, n2) { + if (typeof n1 !== "object") { + if (n1 === "One") { + return n2; + } else { + return "Zero"; + } + } + let r1 = n1._3; + let i1 = n1._2; + let v1 = n1._1; + let l1 = n1._0; + if (typeof n2 !== "object") { + if (n2 === "One") { + return n1; + } else { + return "Zero"; + } + } + let r2 = n2._3; + let i2 = n2._2; + let v2 = n2._1; + let l2 = n2._0; + let h = hash(i1, i2); + if (i1 === Primitive_array.get(andslot1, h) && i2 === Primitive_array.get(andslot2, h)) { + return Primitive_array.get(andslot3, h); + } + let match = cmpVar(v1, v2); + let f; + switch (match) { + case "LESS" : + f = mkNode(and2(l1, n2), v1, and2(r1, n2)); + break; + case "EQUAL" : + f = mkNode(and2(l1, l2), v1, and2(r1, r2)); + break; + case "GREATER" : + f = mkNode(and2(n1, l2), v2, and2(n1, r2)); + break; + } + Primitive_array.set(andslot1, h, i1); + Primitive_array.set(andslot2, h, i2); + Primitive_array.set(andslot3, h, f); + return f; +} + +function xor(n1, n2) { + if (typeof n1 !== "object") { + if (n1 === "One") { + return not(n2); + } else { + return n2; + } + } + let r1 = n1._3; + let i1 = n1._2; + let v1 = n1._1; + let l1 = n1._0; + if (typeof n2 !== "object") { + if (n2 === "One") { + return not(n1); + } else { + return n1; + } + } + let r2 = n2._3; + let i2 = n2._2; + let v2 = n2._1; + let l2 = n2._0; + let h = hash(i1, i2); + if (i1 === Primitive_array.get(andslot1, h) && i2 === Primitive_array.get(andslot2, h)) { + return Primitive_array.get(andslot3, h); + } + let match = cmpVar(v1, v2); + let f; + switch (match) { + case "LESS" : + f = mkNode(xor(l1, n2), v1, xor(r1, n2)); + break; + case "EQUAL" : + f = mkNode(xor(l1, l2), v1, xor(r1, r2)); + break; + case "GREATER" : + f = mkNode(xor(n1, l2), v2, xor(n1, r2)); + break; + } + Primitive_array.set(andslot1, h, i1); + Primitive_array.set(andslot2, h, i2); + Primitive_array.set(andslot3, h, f); + return f; +} + +function hwb(n) { + let h = (i, j) => { + if (i === j) { + return mkNode("Zero", i, "One"); + } else { + return xor(and2(not(mkNode("Zero", j, "One")), h(i, j - 1 | 0)), and2(mkNode("Zero", j, "One"), g(i, j - 1 | 0))); + } + }; + let g = (i, j) => { + if (i === j) { + return mkNode("Zero", i, "One"); + } else { + return xor(and2(not(mkNode("Zero", i, "One")), h(i + 1 | 0, j)), and2(mkNode("Zero", i, "One"), g(i + 1 | 0, j))); + } + }; + return h(0, n - 1 | 0); +} + +let seed = { + contents: 0 +}; + +function random() { + seed.contents = Math.imul(seed.contents, 25173) + 17431 | 0; + return (seed.contents & 1) > 0; +} + +function random_vars(n) { + let vars = Belt_Array.make(n, false); + for (let i = 0; i < n; ++i) { + Primitive_array.set(vars, i, random()); + } + return vars; +} + +function bool_equal(a, b) { + if (a) { + if (b) { + return true; + } else { + return false; + } + } else if (b) { + return false; + } else { + return true; + } +} + +function test_hwb(bdd, vars) { + let ntrue = 0; + for (let i = 0, i_finish = vars.length; i < i_finish; ++i) { + if (Primitive_array.get(vars, i)) { + ntrue = ntrue + 1 | 0; + } + + } + return bool_equal($$eval(bdd, vars), ntrue > 0 ? Primitive_array.get(vars, ntrue - 1 | 0) : false); +} + +function main() { + let bdd = hwb(22); + let succeeded = true; + for (let i = 1; i <= 100; ++i) { + succeeded = succeeded && test_hwb(bdd, random_vars(22)); + } + if (succeeded) { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bdd.res", + 304, + 2 + ], + Error: new Error() + }; +} + +main(); + +let $$Array; + +let initSize_1 = 8191; + +let zero = "Zero"; + +let one = "One"; + +let cacheSize = 1999; + +export { + $$Array, + $$eval, + getId, + initSize_1, + nodeC, + sz_1, + htab, + n_items, + hashVal, + resize, + insert, + resetUnique, + mkNode, + cmpVar, + zero, + one, + mkVar, + cacheSize, + andslot1, + andslot2, + andslot3, + xorslot1, + xorslot2, + xorslot3, + notslot1, + notslot2, + hash, + not, + and2, + xor, + hwb, + seed, + random, + random_vars, + bool_equal, + test_hwb, + main, +} +/* htab Not a pure module */ diff --git a/tests/tests/src/belt_float_test.js b/tests/tests/src/belt_float_test.js deleted file mode 100644 index 867b8a2f45..0000000000 --- a/tests/tests/src/belt_float_test.js +++ /dev/null @@ -1,46 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_Float = require("rescript/lib/js/Belt_Float.js"); -let Test_utils = require("./test_utils.js"); - -Mocha.describe("Belt_float_test", () => { - Mocha.test("fromInt", () => { - Test_utils.eq("File \"belt_float_test.res\", line 8, characters 7-14", 1, 1.0); - Test_utils.eq("File \"belt_float_test.res\", line 9, characters 7-14", -1, -1.0); - }); - Mocha.test("toInt", () => { - Test_utils.eq("File \"belt_float_test.res\", line 13, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_float_test.res\", line 14, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_float_test.res\", line 15, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_float_test.res\", line 16, characters 7-14", -1, -1); - Test_utils.eq("File \"belt_float_test.res\", line 17, characters 7-14", -1, -1); - Test_utils.eq("File \"belt_float_test.res\", line 18, characters 7-14", -1, -1); - }); - Mocha.test("fromString", () => { - Test_utils.eq("File \"belt_float_test.res\", line 22, characters 7-14", Belt_Float.fromString("1"), 1.0); - Test_utils.eq("File \"belt_float_test.res\", line 23, characters 7-14", Belt_Float.fromString("-1"), -1.0); - Test_utils.eq("File \"belt_float_test.res\", line 24, characters 7-14", Belt_Float.fromString("1.7"), 1.7); - Test_utils.eq("File \"belt_float_test.res\", line 25, characters 7-14", Belt_Float.fromString("-1.0"), -1.0); - Test_utils.eq("File \"belt_float_test.res\", line 26, characters 7-14", Belt_Float.fromString("-1.5"), -1.5); - Test_utils.eq("File \"belt_float_test.res\", line 27, characters 7-14", Belt_Float.fromString("-1.7"), -1.7); - Test_utils.eq("File \"belt_float_test.res\", line 28, characters 7-14", Belt_Float.fromString("not a float"), undefined); - }); - Mocha.test("toString", () => { - Test_utils.eq("File \"belt_float_test.res\", line 32, characters 7-14", String(1.0), "1"); - Test_utils.eq("File \"belt_float_test.res\", line 33, characters 7-14", String(-1.0), "-1"); - Test_utils.eq("File \"belt_float_test.res\", line 34, characters 7-14", String(-1.5), "-1.5"); - }); - Mocha.test("operators", () => { - Test_utils.eq("File \"belt_float_test.res\", line 39, characters 7-14", 2.0 + 3.0, 5.0); - Test_utils.eq("File \"belt_float_test.res\", line 40, characters 7-14", 2.0 - 3.0, -1.0); - Test_utils.eq("File \"belt_float_test.res\", line 41, characters 7-14", 2.0 * 3.0, 6.0); - Test_utils.eq("File \"belt_float_test.res\", line 42, characters 7-14", 3.0 / 2.0, 1.5); - }); -}); - -let F; - -exports.F = F; -/* Not a pure module */ diff --git a/tests/tests/src/belt_float_test.mjs b/tests/tests/src/belt_float_test.mjs new file mode 100644 index 0000000000..b778b92cd0 --- /dev/null +++ b/tests/tests/src/belt_float_test.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_Float from "rescript/lib/es6/Belt_Float.js"; +import * as Test_utils from "./test_utils.mjs"; + +Mocha.describe("Belt_float_test", () => { + Mocha.test("fromInt", () => { + Test_utils.eq("File \"belt_float_test.res\", line 8, characters 7-14", 1, 1.0); + Test_utils.eq("File \"belt_float_test.res\", line 9, characters 7-14", -1, -1.0); + }); + Mocha.test("toInt", () => { + Test_utils.eq("File \"belt_float_test.res\", line 13, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_float_test.res\", line 14, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_float_test.res\", line 15, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_float_test.res\", line 16, characters 7-14", -1, -1); + Test_utils.eq("File \"belt_float_test.res\", line 17, characters 7-14", -1, -1); + Test_utils.eq("File \"belt_float_test.res\", line 18, characters 7-14", -1, -1); + }); + Mocha.test("fromString", () => { + Test_utils.eq("File \"belt_float_test.res\", line 22, characters 7-14", Belt_Float.fromString("1"), 1.0); + Test_utils.eq("File \"belt_float_test.res\", line 23, characters 7-14", Belt_Float.fromString("-1"), -1.0); + Test_utils.eq("File \"belt_float_test.res\", line 24, characters 7-14", Belt_Float.fromString("1.7"), 1.7); + Test_utils.eq("File \"belt_float_test.res\", line 25, characters 7-14", Belt_Float.fromString("-1.0"), -1.0); + Test_utils.eq("File \"belt_float_test.res\", line 26, characters 7-14", Belt_Float.fromString("-1.5"), -1.5); + Test_utils.eq("File \"belt_float_test.res\", line 27, characters 7-14", Belt_Float.fromString("-1.7"), -1.7); + Test_utils.eq("File \"belt_float_test.res\", line 28, characters 7-14", Belt_Float.fromString("not a float"), undefined); + }); + Mocha.test("toString", () => { + Test_utils.eq("File \"belt_float_test.res\", line 32, characters 7-14", String(1.0), "1"); + Test_utils.eq("File \"belt_float_test.res\", line 33, characters 7-14", String(-1.0), "-1"); + Test_utils.eq("File \"belt_float_test.res\", line 34, characters 7-14", String(-1.5), "-1.5"); + }); + Mocha.test("operators", () => { + Test_utils.eq("File \"belt_float_test.res\", line 39, characters 7-14", 2.0 + 3.0, 5.0); + Test_utils.eq("File \"belt_float_test.res\", line 40, characters 7-14", 2.0 - 3.0, -1.0); + Test_utils.eq("File \"belt_float_test.res\", line 41, characters 7-14", 2.0 * 3.0, 6.0); + Test_utils.eq("File \"belt_float_test.res\", line 42, characters 7-14", 3.0 / 2.0, 1.5); + }); +}); + +let F; + +export { + F, +} +/* Not a pure module */ diff --git a/tests/tests/src/belt_hashmap_test.js b/tests/tests/src/belt_hashmap_test.js deleted file mode 100644 index 7feb63329e..0000000000 --- a/tests/tests/src/belt_hashmap_test.js +++ /dev/null @@ -1,96 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Test_utils = require("./test_utils.js"); -let Belt_HashMap = require("rescript/lib/js/Belt_HashMap.js"); -let Ocaml_Hashtbl = require("./ocaml_compat/Ocaml_Hashtbl.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Belt_SortArray = require("rescript/lib/js/Belt_SortArray.js"); -let Array_data_util = require("./array_data_util.js"); - -function intEq(x, y) { - return x === y; -} - -let intHash = Ocaml_Hashtbl.hash; - -let cmp = Primitive_int.compare; - -let Y = Belt_Id.hashable(intHash, intEq); - -let empty = Belt_HashMap.make(30, Y); - -Mocha.describe("Belt_hashmap_test", () => { - Mocha.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); - Test_utils.eq("File \"belt_hashmap_test.res\", line 22, characters 7-14", Belt_HashMap.size(xx), 91); - Test_utils.eq("File \"belt_hashmap_test.res\", line 23, characters 7-14", Belt_SortArray.stableSortBy(Belt_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); - }); - Mocha.test("mergeMany", () => { - Belt_HashMap.mergeMany(empty, [ - [ - 1, - 1 - ], - [ - 2, - 3 - ], - [ - 3, - 3 - ], - [ - 2, - 2 - ] - ]); - Test_utils.eq("File \"belt_hashmap_test.res\", line 28, characters 7-14", Belt_HashMap.get(empty, 2), 2); - Test_utils.eq("File \"belt_hashmap_test.res\", line 29, characters 7-14", Belt_HashMap.size(empty), 3); - }); - Mocha.test("remove", () => { - let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - let v = Belt_HashMap.make(40, Y); - Belt_HashMap.mergeMany(v, Belt_Array.zip(u, u)); - Test_utils.eq("File \"belt_hashmap_test.res\", line 36, characters 7-14", Belt_HashMap.size(v), 100001); - for (let i = 0; i <= 1000; ++i) { - Belt_HashMap.remove(v, i); - } - Test_utils.eq("File \"belt_hashmap_test.res\", line 40, characters 7-14", Belt_HashMap.size(v), 99000); - for (let i$1 = 0; i$1 <= 2000; ++i$1) { - Belt_HashMap.remove(v, i$1); - } - Test_utils.eq("File \"belt_hashmap_test.res\", line 44, characters 7-14", Belt_HashMap.size(v), 98000); - Test_utils.ok("File \"belt_hashmap_test.res\", line 45, characters 7-14", Belt_Array.every(Array_data_util.range(2001, 100000), x => Belt_HashMap.has(v, x))); - }); -}); - -let Hashtbl; - -let N; - -let S; - -let I; - -let A; - -let So; - -exports.Hashtbl = Hashtbl; -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; -/* Y Not a pure module */ diff --git a/tests/tests/src/belt_hashmap_test.mjs b/tests/tests/src/belt_hashmap_test.mjs new file mode 100644 index 0000000000..b1bb5c829f --- /dev/null +++ b/tests/tests/src/belt_hashmap_test.mjs @@ -0,0 +1,97 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Test_utils from "./test_utils.mjs"; +import * as Belt_HashMap from "rescript/lib/es6/Belt_HashMap.js"; +import * as Ocaml_Hashtbl from "./ocaml_compat/Ocaml_Hashtbl.mjs"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Belt_SortArray from "rescript/lib/es6/Belt_SortArray.js"; +import * as Array_data_util from "./array_data_util.mjs"; + +function intEq(x, y) { + return x === y; +} + +let intHash = Ocaml_Hashtbl.hash; + +let cmp = Primitive_int.compare; + +let Y = Belt_Id.hashable(intHash, intEq); + +let empty = Belt_HashMap.make(30, Y); + +Mocha.describe("Belt_hashmap_test", () => { + Mocha.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); + Test_utils.eq("File \"belt_hashmap_test.res\", line 22, characters 7-14", Belt_HashMap.size(xx), 91); + Test_utils.eq("File \"belt_hashmap_test.res\", line 23, characters 7-14", Belt_SortArray.stableSortBy(Belt_HashMap.keysToArray(xx), cmp), Array_data_util.range(30, 120)); + }); + Mocha.test("mergeMany", () => { + Belt_HashMap.mergeMany(empty, [ + [ + 1, + 1 + ], + [ + 2, + 3 + ], + [ + 3, + 3 + ], + [ + 2, + 2 + ] + ]); + Test_utils.eq("File \"belt_hashmap_test.res\", line 28, characters 7-14", Belt_HashMap.get(empty, 2), 2); + Test_utils.eq("File \"belt_hashmap_test.res\", line 29, characters 7-14", Belt_HashMap.size(empty), 3); + }); + Mocha.test("remove", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); + let v = Belt_HashMap.make(40, Y); + Belt_HashMap.mergeMany(v, Belt_Array.zip(u, u)); + Test_utils.eq("File \"belt_hashmap_test.res\", line 36, characters 7-14", Belt_HashMap.size(v), 100001); + for (let i = 0; i <= 1000; ++i) { + Belt_HashMap.remove(v, i); + } + Test_utils.eq("File \"belt_hashmap_test.res\", line 40, characters 7-14", Belt_HashMap.size(v), 99000); + for (let i$1 = 0; i$1 <= 2000; ++i$1) { + Belt_HashMap.remove(v, i$1); + } + Test_utils.eq("File \"belt_hashmap_test.res\", line 44, characters 7-14", Belt_HashMap.size(v), 98000); + Test_utils.ok("File \"belt_hashmap_test.res\", line 45, characters 7-14", Belt_Array.every(Array_data_util.range(2001, 100000), x => Belt_HashMap.has(v, x))); + }); +}); + +let Hashtbl; + +let N; + +let S; + +let I; + +let A; + +let So; + +export { + Hashtbl, + N, + S, + I, + A, + So, + intEq, + intHash, + cmp, + Y, + empty, +} +/* Y Not a pure module */ diff --git a/tests/tests/src/belt_hashset_int_test.js b/tests/tests/src/belt_hashset_int_test.js deleted file mode 100644 index f5caf5ae9c..0000000000 --- a/tests/tests/src/belt_hashset_int_test.js +++ /dev/null @@ -1,90 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Test_utils = require("./test_utils.js"); -let Belt_SetInt = require("rescript/lib/js/Belt_SetInt.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_HashSetInt = require("rescript/lib/js/Belt_HashSetInt.js"); -let Belt_SortArrayInt = require("rescript/lib/js/Belt_SortArrayInt.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; -} - -Mocha.describe("Belt_hashset_int_test", () => { - Mocha.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); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 22, characters 7-14", Belt_HashSetInt.size(v), 91); - let xs = Belt_SetInt.toArray(Belt_SetInt.fromArray(Belt_HashSetInt.toArray(v))); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 24, characters 7-14", xs, Array_data_util.range(30, 120)); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 26, characters 7-14", Belt_HashSetInt.reduce(v, 0, add), 6825); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 27, characters 7-14", sum2(v), 6825); - }); - Mocha.test("mergeMany", () => { - let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - let v = Belt_HashSetInt.make(40); - Belt_HashSetInt.mergeMany(v, u); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 34, characters 7-14", Belt_HashSetInt.size(v), 100001); - for (let i = 0; i <= 1000; ++i) { - Belt_HashSetInt.remove(v, i); - } - Test_utils.eq("File \"belt_hashset_int_test.res\", line 38, characters 7-14", Belt_HashSetInt.size(v), 99000); - for (let i$1 = 0; i$1 <= 2000; ++i$1) { - Belt_HashSetInt.remove(v, i$1); - } - Test_utils.eq("File \"belt_hashset_int_test.res\", line 42, characters 7-14", Belt_HashSetInt.size(v), 98000); - }); - Mocha.test("stableSortInPlace", () => { - let u0 = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 100000)); - let u1 = Belt_HashSetInt.copy(u0); - Test_utils.eq("File \"belt_hashset_int_test.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); - Test_utils.eq("File \"belt_hashset_int_test.res\", line 59, characters 7-14", v0, v1); - }); - Mocha.test("getBucketHistogram", () => { - let h = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 1000000)); - let histo = Belt_HashSetInt.getBucketHistogram(h); - Test_utils.ok("File \"belt_hashset_int_test.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/tests/tests/src/belt_hashset_int_test.mjs b/tests/tests/src/belt_hashset_int_test.mjs new file mode 100644 index 0000000000..123c6be403 --- /dev/null +++ b/tests/tests/src/belt_hashset_int_test.mjs @@ -0,0 +1,91 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Test_utils from "./test_utils.mjs"; +import * as Belt_SetInt from "rescript/lib/es6/Belt_SetInt.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Belt_HashSetInt from "rescript/lib/es6/Belt_HashSetInt.js"; +import * as Belt_SortArrayInt from "rescript/lib/es6/Belt_SortArrayInt.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; +} + +Mocha.describe("Belt_hashset_int_test", () => { + Mocha.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); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 22, characters 7-14", Belt_HashSetInt.size(v), 91); + let xs = Belt_SetInt.toArray(Belt_SetInt.fromArray(Belt_HashSetInt.toArray(v))); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 24, characters 7-14", xs, Array_data_util.range(30, 120)); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 26, characters 7-14", Belt_HashSetInt.reduce(v, 0, add), 6825); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 27, characters 7-14", sum2(v), 6825); + }); + Mocha.test("mergeMany", () => { + let u = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); + let v = Belt_HashSetInt.make(40); + Belt_HashSetInt.mergeMany(v, u); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 34, characters 7-14", Belt_HashSetInt.size(v), 100001); + for (let i = 0; i <= 1000; ++i) { + Belt_HashSetInt.remove(v, i); + } + Test_utils.eq("File \"belt_hashset_int_test.res\", line 38, characters 7-14", Belt_HashSetInt.size(v), 99000); + for (let i$1 = 0; i$1 <= 2000; ++i$1) { + Belt_HashSetInt.remove(v, i$1); + } + Test_utils.eq("File \"belt_hashset_int_test.res\", line 42, characters 7-14", Belt_HashSetInt.size(v), 98000); + }); + Mocha.test("stableSortInPlace", () => { + let u0 = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 100000)); + let u1 = Belt_HashSetInt.copy(u0); + Test_utils.eq("File \"belt_hashset_int_test.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); + Test_utils.eq("File \"belt_hashset_int_test.res\", line 59, characters 7-14", v0, v1); + }); + Mocha.test("getBucketHistogram", () => { + let h = Belt_HashSetInt.fromArray(Array_data_util.randomRange(0, 1000000)); + let histo = Belt_HashSetInt.getBucketHistogram(h); + Test_utils.ok("File \"belt_hashset_int_test.res\", line 65, characters 7-14", histo.length <= 10); + }); +}); + +let N; + +let S; + +let I; + +let A; + +let SI; + +export { + N, + S, + I, + A, + SI, + add, + sum2, +} +/* Not a pure module */ diff --git a/tests/tests/src/belt_int_test.js b/tests/tests/src/belt_int_test.js deleted file mode 100644 index 590207344d..0000000000 --- a/tests/tests/src/belt_int_test.js +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_Int = require("rescript/lib/js/Belt_Int.js"); -let Test_utils = require("./test_utils.js"); - -Mocha.describe("Belt_int_test", () => { - Mocha.test("toFloat", () => { - Test_utils.eq("File \"belt_int_test.res\", line 8, characters 7-14", 1, 1.0); - Test_utils.eq("File \"belt_int_test.res\", line 9, characters 7-14", -1, -1.0); - }); - Mocha.test("fromFloat", () => { - Test_utils.eq("File \"belt_int_test.res\", line 13, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_int_test.res\", line 14, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_int_test.res\", line 15, characters 7-14", 1, 1); - Test_utils.eq("File \"belt_int_test.res\", line 16, characters 7-14", -1, -1); - Test_utils.eq("File \"belt_int_test.res\", line 17, characters 7-14", -1, -1); - Test_utils.eq("File \"belt_int_test.res\", line 18, characters 7-14", -1, -1); - }); - Mocha.test("fromString", () => { - Test_utils.eq("File \"belt_int_test.res\", line 22, characters 7-14", Belt_Int.fromString("1"), 1); - Test_utils.eq("File \"belt_int_test.res\", line 23, characters 7-14", Belt_Int.fromString("-1"), -1); - Test_utils.eq("File \"belt_int_test.res\", line 24, characters 7-14", Belt_Int.fromString("1.7"), 1); - Test_utils.eq("File \"belt_int_test.res\", line 25, characters 7-14", Belt_Int.fromString("-1.0"), -1); - Test_utils.eq("File \"belt_int_test.res\", line 26, characters 7-14", Belt_Int.fromString("-1.5"), -1); - Test_utils.eq("File \"belt_int_test.res\", line 27, characters 7-14", Belt_Int.fromString("-1.7"), -1); - Test_utils.eq("File \"belt_int_test.res\", line 28, characters 7-14", Belt_Int.fromString("not an int"), undefined); - }); - Mocha.test("toString", () => { - Test_utils.eq("File \"belt_int_test.res\", line 32, characters 7-14", String(1), "1"); - Test_utils.eq("File \"belt_int_test.res\", line 33, characters 7-14", String(-1), "-1"); - }); - Mocha.test("operators", () => { - Test_utils.eq("File \"belt_int_test.res\", line 39, characters 7-14", 5, 5); - Test_utils.eq("File \"belt_int_test.res\", line 40, characters 7-14", -1, -1); - Test_utils.eq("File \"belt_int_test.res\", line 41, characters 7-14", 6, 6); - Test_utils.eq("File \"belt_int_test.res\", line 42, characters 7-14", 0, 0); - }); -}); - -let I; - -exports.I = I; -/* Not a pure module */ diff --git a/tests/tests/src/belt_int_test.mjs b/tests/tests/src/belt_int_test.mjs new file mode 100644 index 0000000000..1d4d38075f --- /dev/null +++ b/tests/tests/src/belt_int_test.mjs @@ -0,0 +1,46 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_Int from "rescript/lib/es6/Belt_Int.js"; +import * as Test_utils from "./test_utils.mjs"; + +Mocha.describe("Belt_int_test", () => { + Mocha.test("toFloat", () => { + Test_utils.eq("File \"belt_int_test.res\", line 8, characters 7-14", 1, 1.0); + Test_utils.eq("File \"belt_int_test.res\", line 9, characters 7-14", -1, -1.0); + }); + Mocha.test("fromFloat", () => { + Test_utils.eq("File \"belt_int_test.res\", line 13, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_int_test.res\", line 14, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_int_test.res\", line 15, characters 7-14", 1, 1); + Test_utils.eq("File \"belt_int_test.res\", line 16, characters 7-14", -1, -1); + Test_utils.eq("File \"belt_int_test.res\", line 17, characters 7-14", -1, -1); + Test_utils.eq("File \"belt_int_test.res\", line 18, characters 7-14", -1, -1); + }); + Mocha.test("fromString", () => { + Test_utils.eq("File \"belt_int_test.res\", line 22, characters 7-14", Belt_Int.fromString("1"), 1); + Test_utils.eq("File \"belt_int_test.res\", line 23, characters 7-14", Belt_Int.fromString("-1"), -1); + Test_utils.eq("File \"belt_int_test.res\", line 24, characters 7-14", Belt_Int.fromString("1.7"), 1); + Test_utils.eq("File \"belt_int_test.res\", line 25, characters 7-14", Belt_Int.fromString("-1.0"), -1); + Test_utils.eq("File \"belt_int_test.res\", line 26, characters 7-14", Belt_Int.fromString("-1.5"), -1); + Test_utils.eq("File \"belt_int_test.res\", line 27, characters 7-14", Belt_Int.fromString("-1.7"), -1); + Test_utils.eq("File \"belt_int_test.res\", line 28, characters 7-14", Belt_Int.fromString("not an int"), undefined); + }); + Mocha.test("toString", () => { + Test_utils.eq("File \"belt_int_test.res\", line 32, characters 7-14", String(1), "1"); + Test_utils.eq("File \"belt_int_test.res\", line 33, characters 7-14", String(-1), "-1"); + }); + Mocha.test("operators", () => { + Test_utils.eq("File \"belt_int_test.res\", line 39, characters 7-14", 5, 5); + Test_utils.eq("File \"belt_int_test.res\", line 40, characters 7-14", -1, -1); + Test_utils.eq("File \"belt_int_test.res\", line 41, characters 7-14", 6, 6); + Test_utils.eq("File \"belt_int_test.res\", line 42, characters 7-14", 0, 0); + }); +}); + +let I; + +export { + I, +} +/* Not a pure module */ diff --git a/tests/tests/src/belt_internal_test.js b/tests/tests/src/belt_internal_test.js deleted file mode 100644 index c72bcdf600..0000000000 --- a/tests/tests/src/belt_internal_test.js +++ /dev/null @@ -1,31 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function treeHeight(n) { - if (n !== undefined) { - return n.height; - } else { - return 0; - } -} - -function copy(n) { - if (n === undefined) { - return n; - } - let v = n.value; - let h = n.height; - let l = n.left; - let r = n.right; - return { - value: v, - height: h, - left: copy(l), - right: copy(r) - }; -} - -exports.treeHeight = treeHeight; -exports.copy = copy; -/* No side effect */ diff --git a/tests/tests/src/belt_internal_test.mjs b/tests/tests/src/belt_internal_test.mjs new file mode 100644 index 0000000000..c41166be73 --- /dev/null +++ b/tests/tests/src/belt_internal_test.mjs @@ -0,0 +1,32 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function treeHeight(n) { + if (n !== undefined) { + return n.height; + } else { + return 0; + } +} + +function copy(n) { + if (n === undefined) { + return n; + } + let v = n.value; + let h = n.height; + let l = n.left; + let r = n.right; + return { + value: v, + height: h, + left: copy(l), + right: copy(r) + }; +} + +export { + treeHeight, + copy, +} +/* No side effect */ diff --git a/tests/tests/src/belt_list_test.js b/tests/tests/src/belt_list_test.js deleted file mode 100644 index f4a0b423ca..0000000000 --- a/tests/tests/src/belt_list_test.js +++ /dev/null @@ -1,2185 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Test_utils = require("./test_utils.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.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; -} - -Mocha.describe("Belt_list_test", () => { - Mocha.test("makeBy", () => { - let u = Belt_List.makeBy(5, i => Math.imul(i, i)); - let f = i => Test_utils.eq("File \"belt_list_test.res\", line 23, characters 20-27", Belt_List.getExn(u, i), Math.imul(i, i)); - for (let i = 0; i <= 4; ++i) { - f(i); - } - Test_utils.eq("File \"belt_list_test.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 - } - } - } - } - }); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - }); - Mocha.test("flatten", () => { - Test_utils.eq("File \"belt_list_test.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 - } - } - } - } - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 38, characters 7-14", Belt_List.flatten(/* [] */0), /* [] */0); - Test_utils.eq("File \"belt_list_test.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 - } - } - }); - }); - Mocha.test("concatMany", () => { - Test_utils.eq("File \"belt_list_test.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 - } - } - } - } - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 48, characters 7-14", Belt_List.concatMany([]), /* [] */0); - Test_utils.eq("File \"belt_list_test.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 - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 51, characters 6-13", 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 - } - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 55, 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 - } - } - }); - }); - Mocha.test("concat", () => { - Test_utils.eq("File \"belt_list_test.res\", line 60, 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))); - Test_utils.eq("File \"belt_list_test.res\", line 65, characters 7-14", Belt_List.concat({ - hd: 1, - tl: /* [] */0 - }, /* [] */0), { - hd: 1, - tl: /* [] */0 - }); - Test_utils.eq("File \"belt_list_test.res\", line 66, characters 7-14", Belt_List.concat(/* [] */0, { - hd: 1, - tl: /* [] */0 - }), { - hd: 1, - tl: /* [] */0 - }); - }); - Mocha.test("zip", () => { - Test_utils.eq("File \"belt_list_test.res\", line 70, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 71, characters 7-14", Belt_List.zip(/* [] */0, { - hd: 1, - tl: /* [] */0 - }), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 72, characters 7-14", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 73, characters 7-14", Belt_List.zip({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, /* [] */0), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 74, 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; - Mocha.test("partition", () => { - Test_utils.eq("File \"belt_list_test.res\", line 81, 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 - } - } - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 82, 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 - ]); - Test_utils.eq("File \"belt_list_test.res\", line 83, 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 - } - } - } - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 84, characters 7-14", Belt_List.partition(/* [] */0, mod2), [ - /* [] */0, - /* [] */0 - ]); - }); - Mocha.test("unzip", () => { - Test_utils.eq("File \"belt_list_test.res\", line 88, characters 7-14", Belt_List.unzip(/* [] */0), [ - /* [] */0, - /* [] */0 - ]); - Test_utils.eq("File \"belt_list_test.res\", line 89, characters 7-14", Belt_List.unzip({ - hd: [ - 1, - 2 - ], - tl: /* [] */0 - }), [ - { - hd: 1, - tl: /* [] */0 - }, - { - hd: 2, - tl: /* [] */0 - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 90, 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 - } - } - ]); - }); - Mocha.test("filter", () => { - Test_utils.eq("File \"belt_list_test.res\", line 94, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 95, characters 7-14", Belt_List.keep({ - hd: 1, - tl: { - hd: 3, - tl: { - hd: 41, - tl: /* [] */0 - } - } - }, mod2), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 96, characters 7-14", Belt_List.keep(/* [] */0, mod2), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 97, 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 - } - } - } - } - }); - }); - Mocha.test("keepWithIndex", () => { - Test_utils.eq("File \"belt_list_test.res\", line 101, characters 7-14", Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 102, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 103, 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; - Mocha.test("map", () => { - Test_utils.eq("File \"belt_list_test.res\", line 109, 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 - } - } - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 110, characters 7-14", Belt_List.map(/* [] */0, id), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 111, 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); - Mocha.test("mapWithIndex etc.", () => { - let d = Belt_List.makeBy(10, x => (x << 1)); - Test_utils.eq("File \"belt_list_test.res\", line 124, characters 7-14", Belt_List.zipBy(length_10_id, length_10_id, add), d); - Test_utils.eq("File \"belt_list_test.res\", line 125, characters 7-14", Belt_List.zipBy(/* [] */0, { - hd: 1, - tl: /* [] */0 - }, add), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 126, characters 7-14", Belt_List.zipBy({ - hd: 1, - tl: /* [] */0 - }, /* [] */0, add), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 127, characters 7-14", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 128, characters 7-14", 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 - } - })); - Test_utils.eq("File \"belt_list_test.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)); - Test_utils.eq("File \"belt_list_test.res\", line 131, characters 6-13", 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)); - Test_utils.eq("File \"belt_list_test.res\", line 136, characters 7-14", Belt_List.length(xs), 8); - Test_utils.eq("File \"belt_list_test.res\", line 137, characters 7-14", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); - Test_utils.eq("File \"belt_list_test.res\", line 138, 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 - } - }); - }); - Mocha.test("take", () => { - Test_utils.eq("File \"belt_list_test.res\", line 142, characters 7-14", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, 2), { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 143, characters 7-14", Belt_List.take(/* [] */0, 1), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 144, characters 7-14", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }, 3), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 145, characters 7-14", Belt_List.take({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }, 2), { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 146, characters 7-14", Belt_List.take(length_10_id, 8), length_8_id); - Test_utils.eq("File \"belt_list_test.res\", line 147, characters 7-14", Belt_List.take(length_10_id, 0), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 148, characters 7-14", Belt_List.take(length_8_id, -2), undefined); - }); - Mocha.test("droo", () => { - Test_utils.eq("File \"belt_list_test.res\", line 152, characters 7-14", Belt_List.drop(length_10_id, 10), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 153, characters 7-14", Belt_List.drop(length_10_id, 8), { - hd: 8, - tl: { - hd: 9, - tl: /* [] */0 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 154, characters 7-14", Belt_List.drop(length_10_id, 0), length_10_id); - Test_utils.eq("File \"belt_list_test.res\", line 155, characters 7-14", Belt_List.drop(length_8_id, -1), undefined); - }); - Mocha.test("splitAt", () => { - let a = Belt_List.makeBy(5, id); - Test_utils.eq("File \"belt_list_test.res\", line 160, characters 7-14", Belt_List.splitAt(/* [] */0, 1), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 161, characters 7-14", Belt_List.splitAt(a, 6), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 162, characters 7-14", Belt_List.splitAt(a, 5), [ - a, - /* [] */0 - ]); - Test_utils.eq("File \"belt_list_test.res\", line 163, 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 - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 164, 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 - } - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 165, 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 - } - } - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 166, 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 - } - } - } - } - ]); - Test_utils.eq("File \"belt_list_test.res\", line 167, characters 7-14", Belt_List.splitAt(a, 0), [ - /* [] */0, - a - ]); - Test_utils.eq("File \"belt_list_test.res\", line 168, characters 7-14", Belt_List.splitAt(a, -1), undefined); - }); - Mocha.test("removeAssoc", () => { - let eqx = (x, y) => x === y; - Test_utils.ok("File \"belt_list_test.res\", line 174, characters 7-14", Belt_List.hasAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } - }, 2, (prim0, prim1) => prim0 === prim1)); - Test_utils.ok("File \"belt_list_test.res\", line 175, characters 7-14", !Belt_List.hasAssoc({ - hd: [ - 1, - "1" - ], - tl: { - hd: [ - 2, - "2" - ], - tl: { - hd: [ - 3, - "3" - ], - tl: /* [] */0 - } - } - }, 4, (prim0, prim1) => prim0 === prim1)); - Test_utils.ok("File \"belt_list_test.res\", line 176, 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)); - Test_utils.eq("File \"belt_list_test.res\", line 178, characters 6-13", 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 183, characters 6-13", 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 188, characters 6-13", 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 193, 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 - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 198, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 199, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 200, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 201, 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); - Test_utils.ok("File \"belt_list_test.res\", line 204, characters 7-14", ll === ll0); - let ll1 = Belt_List.setAssoc(ll, 2, "22", (prim0, prim1) => prim0 === prim1); - Test_utils.eq("File \"belt_list_test.res\", line 206, 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); - Test_utils.ok("File \"belt_list_test.res\", line 208, characters 7-14", Primitive_object.equal(ll2, { - hd: [ - 22, - "2" - ], - tl: ll1 - })); - Test_utils.ok("File \"belt_list_test.res\", line 209, characters 7-14", Belt_List.tailExn(ll2) === ll1); - Test_utils.ok("File \"belt_list_test.res\", line 211, characters 6-13", Primitive_object.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 - } - } - })); - Test_utils.ok("File \"belt_list_test.res\", line 216, characters 6-13", Primitive_object.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 - } - } - })); - Test_utils.eq("File \"belt_list_test.res\", line 219, characters 7-14", Belt_List.setAssoc(/* [] */0, 1, "1", (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: /* [] */0 - }); - Test_utils.eq("File \"belt_list_test.res\", line 220, characters 7-14", Belt_List.setAssoc({ - hd: [ - 1, - "2" - ], - tl: /* [] */0 - }, 1, "1", (prim0, prim1) => prim0 === prim1), { - hd: [ - 1, - "1" - ], - tl: /* [] */0 - }); - Test_utils.eq("File \"belt_list_test.res\", line 222, 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 - } - }); - Test_utils.ok("File \"belt_list_test.res\", line 223, characters 7-14", Primitive_object.equal(Belt_List.getAssoc({ - hd: [ - 1, - "a" - ], - tl: { - hd: [ - 2, - "b" - ], - tl: { - hd: [ - 3, - "c" - ], - tl: /* [] */0 - } - } - }, 2, (prim0, prim1) => prim0 === prim1), "b")); - Test_utils.ok("File \"belt_list_test.res\", line 224, 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); - }); - Mocha.test("head/tail etc.", () => { - let succx = x => x + 1 | 0; - Test_utils.eq("File \"belt_list_test.res\", line 230, characters 7-14", [ - Belt_List.head(length_10_id), - Belt_List.tail(length_10_id) - ], [ - 0, - Belt_List.drop(length_10_id, 1) - ]); - Test_utils.eq("File \"belt_list_test.res\", line 231, characters 7-14", Belt_List.head(/* [] */0), undefined); - Test_utils.$$throw("File \"belt_list_test.res\", line 232, characters 10-17", () => Belt_List.headExn(/* [] */0)); - Test_utils.$$throw("File \"belt_list_test.res\", line 233, characters 10-17", () => { - Belt_List.tailExn(/* [] */0); - }); - Test_utils.$$throw("File \"belt_list_test.res\", line 234, characters 10-17", () => { - Belt_List.getExn({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } - }, -1); - }); - Test_utils.$$throw("File \"belt_list_test.res\", line 235, characters 10-17", () => { - Belt_List.getExn({ - hd: 0, - tl: { - hd: 1, - tl: /* [] */0 - } - }, 2); - }); - Test_utils.eq("File \"belt_list_test.res\", line 236, 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 - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 237, characters 7-14", Belt_List.headExn({ - hd: 1, - tl: /* [] */0 - }), 1); - Test_utils.eq("File \"belt_list_test.res\", line 238, characters 7-14", Belt_List.tailExn({ - hd: 1, - tl: /* [] */0 - }), /* [] */0); - Belt_List.forEachWithIndex(length_10_id, (i, x) => Test_utils.eq("File \"belt_list_test.res\", line 239, characters 50-57", Belt_List.get(length_10_id, i), x)); - Test_utils.eq("File \"belt_list_test.res\", line 240, characters 7-14", Belt_List.tail(/* [] */0), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 241, characters 7-14", Belt_List.drop(/* [] */0, 3), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 242, characters 7-14", Belt_List.mapWithIndex(/* [] */0, (i, x) => i + x | 0), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 243, characters 7-14", Belt_List.get(length_10_id, -1), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 244, characters 7-14", Belt_List.get(length_10_id, 12), undefined); - Test_utils.eq("File \"belt_list_test.res\", line 245, characters 7-14", sum(/* [] */0), 0); - Test_utils.eq("File \"belt_list_test.res\", line 246, characters 7-14", sum(length_10_id), 45); - Test_utils.eq("File \"belt_list_test.res\", line 247, characters 7-14", Belt_List.makeBy(0, id), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 248, characters 7-14", Belt_List.reverse(Belt_List.reverse(length_10_id)), length_10_id); - Test_utils.eq("File \"belt_list_test.res\", line 249, characters 7-14", Belt_List.reverse(Belt_List.reverse(length_8_id)), length_8_id); - Test_utils.eq("File \"belt_list_test.res\", line 250, characters 7-14", Belt_List.reverse(/* [] */0), /* [] */0); - Test_utils.eq("File \"belt_list_test.res\", line 251, characters 7-14", Belt_List.reverse(Belt_List.mapReverse(length_10_id, succx)), Belt_List.map(length_10_id, succx)); - Test_utils.eq("File \"belt_list_test.res\", line 252, characters 7-14", Belt_List.reduce(length_10_id, 0, add), 45); - Test_utils.eq("File \"belt_list_test.res\", line 253, characters 7-14", Belt_List.reduceReverse(length_10_id, 0, add), 45); - Test_utils.eq("File \"belt_list_test.res\", line 254, characters 7-14", Belt_List.reduceReverse(Belt_List.makeBy(10000, i => i), 0, (prim0, prim1) => prim0 + prim1 | 0), 49995000); - Test_utils.eq("File \"belt_list_test.res\", line 257, characters 7-14", sum2(length_10_id, length_10_id), 90); - Test_utils.eq("File \"belt_list_test.res\", line 258, characters 7-14", sum2(length_8_id, length_10_id), 56); - Test_utils.eq("File \"belt_list_test.res\", line 259, characters 7-14", sum2(length_10_id, length_8_id), 56); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.res\", line 265, characters 7-14", Belt_List.every({ - hd: 2, - tl: { - hd: 4, - tl: { - hd: 6, - tl: /* [] */0 - } - } - }, mod2), true); - Test_utils.eq("File \"belt_list_test.res\", line 266, characters 7-14", Belt_List.every({ - hd: 1, - tl: /* [] */0 - }, mod2), false); - Test_utils.eq("File \"belt_list_test.res\", line 267, characters 7-14", Belt_List.every(/* [] */0, mod2), true); - Test_utils.eq("File \"belt_list_test.res\", line 268, characters 7-14", Belt_List.some({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 5, - tl: /* [] */0 - } - } - }, mod2), true); - Test_utils.eq("File \"belt_list_test.res\", line 269, characters 7-14", Belt_List.some({ - hd: 1, - tl: { - hd: 3, - tl: { - hd: 5, - tl: /* [] */0 - } - } - }, mod2), false); - Test_utils.eq("File \"belt_list_test.res\", line 270, characters 7-14", Belt_List.some(/* [] */0, mod2), false); - Test_utils.eq("File \"belt_list_test.res\", line 271, characters 7-14", Belt_List.has({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, "2", (x, s) => x.toString() === s), true); - Test_utils.eq("File \"belt_list_test.res\", line 272, characters 7-14", Belt_List.has({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, "0", (x, s) => x.toString() === s), false); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.res\", line 276, characters 7-14", Primitive_object.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 - } - } - } - })); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.res\", line 279, characters 7-14", Primitive_object.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 - } - } - } - })); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.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); - Test_utils.ok("File \"belt_list_test.res\", line 284, characters 6-13", Belt_List.reduceReverse2(a, { - hd: 0, - tl: a - }, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 99980001); - }); - Mocha.test("every2", () => { - Test_utils.eq("File \"belt_list_test.res\", line 290, characters 7-14", Belt_List.every2(/* [] */0, { - hd: 1, - tl: /* [] */0 - }, (x, y) => x > y), true); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.res\", line 292, characters 7-14", Belt_List.every2({ - hd: 2, - tl: /* [] */0 - }, { - hd: 1, - tl: /* [] */0 - }, (x, y) => x > y), true); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - }); - Mocha.test("some2", () => { - Test_utils.eq("File \"belt_list_test.res\", line 298, characters 7-14", Belt_List.some2(/* [] */0, { - hd: 1, - tl: /* [] */0 - }, (x, y) => x > y), false); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - Test_utils.eq("File \"belt_list_test.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); - }); - Mocha.test("add", () => Test_utils.eq("File \"belt_list_test.res\", line 307, characters 7-14", Belt_List.add(Belt_List.add(/* [] */0, 3), 2), { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - })); - Mocha.test("cmp", () => { - Test_utils.ok("File \"belt_list_test.res\", line 311, 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 - } - } - } - }, Primitive_int.compare) > 0); - Test_utils.ok("File \"belt_list_test.res\", line 312, 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 - } - } - }, Primitive_int.compare) > 0); - Test_utils.ok("File \"belt_list_test.res\", line 313, 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 - } - } - } - }, Primitive_int.compare) < 0); - Test_utils.ok("File \"belt_list_test.res\", line 314, 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 - } - } - }, Primitive_int.compare) > 0); - Test_utils.ok("File \"belt_list_test.res\", line 315, 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 - } - } - }, Primitive_int.compare) === 0); - Test_utils.ok("File \"belt_list_test.res\", line 316, 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 - } - } - }, Primitive_int.compare) > 0); - }); - Mocha.test("cmpByLength", () => { - Test_utils.ok("File \"belt_list_test.res\", line 320, characters 7-14", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0); - Test_utils.ok("File \"belt_list_test.res\", line 321, characters 7-14", Belt_List.cmpByLength({ - hd: 1, - tl: /* [] */0 - }, /* [] */0) > 0); - Test_utils.ok("File \"belt_list_test.res\", line 322, characters 7-14", Belt_List.cmpByLength(/* [] */0, { - hd: 1, - tl: /* [] */0 - }) < 0); - Test_utils.ok("File \"belt_list_test.res\", line 323, characters 7-14", Belt_List.cmpByLength({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }, { - hd: 1, - tl: /* [] */0 - }) > 0); - Test_utils.ok("File \"belt_list_test.res\", line 324, characters 7-14", Belt_List.cmpByLength({ - hd: 1, - tl: /* [] */0 - }, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }) < 0); - Test_utils.ok("File \"belt_list_test.res\", line 325, characters 7-14", Belt_List.cmpByLength({ - hd: 1, - tl: { - hd: 3, - tl: /* [] */0 - } - }, { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - }) === 0); - }); - Mocha.test("makeBy", () => { - let makeTest = n => Test_utils.eq("File \"belt_list_test.res\", line 329, characters 27-34", Belt_List.make(n, 3), Belt_List.makeBy(n, param => 3)); - makeTest(0); - makeTest(1); - makeTest(2); - makeTest(3); - }); - Mocha.test("sort", () => { - let cmp = (a, b) => a - b | 0; - Test_utils.eq("File \"belt_list_test.res\", line 339, 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 - } - } - } - }); - Test_utils.eq("File \"belt_list_test.res\", line 340, 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 - } - } - } - } - }); - }); - Mocha.test("eq", () => { - Test_utils.ok("File \"belt_list_test.res\", line 344, 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)); - Test_utils.ok("File \"belt_list_test.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: { - hd: 3, - tl: /* [] */0 - } - } - }, (x, y) => x === y)); - Test_utils.ok("File \"belt_list_test.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: 4, - tl: /* [] */0 - } - } - }, (x, y) => x === y)); - Test_utils.ok("File \"belt_list_test.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: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - }, (prim0, prim1) => prim0 === prim1)); - }); - Mocha.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; - } - - }); - Test_utils.eq("File \"belt_list_test.res\", line 360, characters 7-14", u1, { - hd: 1, - tl: { - hd: 8, - tl: { - hd: 15, - tl: /* [] */0 - } - } - }); - Test_utils.ok("File \"belt_list_test.res\", line 362, characters 6-13", Primitive_object.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 - } - })); - Test_utils.ok("File \"belt_list_test.res\", line 377, 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/tests/tests/src/belt_list_test.mjs b/tests/tests/src/belt_list_test.mjs new file mode 100644 index 0000000000..d31ec27bb5 --- /dev/null +++ b/tests/tests/src/belt_list_test.mjs @@ -0,0 +1,2186 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Test_utils from "./test_utils.mjs"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.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; +} + +Mocha.describe("Belt_list_test", () => { + Mocha.test("makeBy", () => { + let u = Belt_List.makeBy(5, i => Math.imul(i, i)); + let f = i => Test_utils.eq("File \"belt_list_test.res\", line 23, characters 20-27", Belt_List.getExn(u, i), Math.imul(i, i)); + for (let i = 0; i <= 4; ++i) { + f(i); + } + Test_utils.eq("File \"belt_list_test.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 + } + } + } + } + }); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + }); + Mocha.test("flatten", () => { + Test_utils.eq("File \"belt_list_test.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 + } + } + } + } + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 38, characters 7-14", Belt_List.flatten(/* [] */0), /* [] */0); + Test_utils.eq("File \"belt_list_test.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 + } + } + }); + }); + Mocha.test("concatMany", () => { + Test_utils.eq("File \"belt_list_test.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 + } + } + } + } + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 48, characters 7-14", Belt_List.concatMany([]), /* [] */0); + Test_utils.eq("File \"belt_list_test.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 + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 51, characters 6-13", 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 + } + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 55, 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 + } + } + }); + }); + Mocha.test("concat", () => { + Test_utils.eq("File \"belt_list_test.res\", line 60, 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))); + Test_utils.eq("File \"belt_list_test.res\", line 65, characters 7-14", Belt_List.concat({ + hd: 1, + tl: /* [] */0 + }, /* [] */0), { + hd: 1, + tl: /* [] */0 + }); + Test_utils.eq("File \"belt_list_test.res\", line 66, characters 7-14", Belt_List.concat(/* [] */0, { + hd: 1, + tl: /* [] */0 + }), { + hd: 1, + tl: /* [] */0 + }); + }); + Mocha.test("zip", () => { + Test_utils.eq("File \"belt_list_test.res\", line 70, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 71, characters 7-14", Belt_List.zip(/* [] */0, { + hd: 1, + tl: /* [] */0 + }), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 72, characters 7-14", Belt_List.zip(/* [] */0, /* [] */0), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 73, characters 7-14", Belt_List.zip({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, /* [] */0), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 74, 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; + Mocha.test("partition", () => { + Test_utils.eq("File \"belt_list_test.res\", line 81, 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 + } + } + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 82, 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 + ]); + Test_utils.eq("File \"belt_list_test.res\", line 83, 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 + } + } + } + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 84, characters 7-14", Belt_List.partition(/* [] */0, mod2), [ + /* [] */0, + /* [] */0 + ]); + }); + Mocha.test("unzip", () => { + Test_utils.eq("File \"belt_list_test.res\", line 88, characters 7-14", Belt_List.unzip(/* [] */0), [ + /* [] */0, + /* [] */0 + ]); + Test_utils.eq("File \"belt_list_test.res\", line 89, characters 7-14", Belt_List.unzip({ + hd: [ + 1, + 2 + ], + tl: /* [] */0 + }), [ + { + hd: 1, + tl: /* [] */0 + }, + { + hd: 2, + tl: /* [] */0 + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 90, 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 + } + } + ]); + }); + Mocha.test("filter", () => { + Test_utils.eq("File \"belt_list_test.res\", line 94, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 95, characters 7-14", Belt_List.keep({ + hd: 1, + tl: { + hd: 3, + tl: { + hd: 41, + tl: /* [] */0 + } + } + }, mod2), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 96, characters 7-14", Belt_List.keep(/* [] */0, mod2), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 97, 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 + } + } + } + } + }); + }); + Mocha.test("keepWithIndex", () => { + Test_utils.eq("File \"belt_list_test.res\", line 101, characters 7-14", Belt_List.keepWithIndex(/* [] */0, evenIndex), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 102, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 103, 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; + Mocha.test("map", () => { + Test_utils.eq("File \"belt_list_test.res\", line 109, 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 + } + } + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 110, characters 7-14", Belt_List.map(/* [] */0, id), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 111, 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); + Mocha.test("mapWithIndex etc.", () => { + let d = Belt_List.makeBy(10, x => (x << 1)); + Test_utils.eq("File \"belt_list_test.res\", line 124, characters 7-14", Belt_List.zipBy(length_10_id, length_10_id, add), d); + Test_utils.eq("File \"belt_list_test.res\", line 125, characters 7-14", Belt_List.zipBy(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, add), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 126, characters 7-14", Belt_List.zipBy({ + hd: 1, + tl: /* [] */0 + }, /* [] */0, add), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 127, characters 7-14", Belt_List.zipBy(/* [] */0, /* [] */0, add), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 128, characters 7-14", 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 + } + })); + Test_utils.eq("File \"belt_list_test.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)); + Test_utils.eq("File \"belt_list_test.res\", line 131, characters 6-13", 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)); + Test_utils.eq("File \"belt_list_test.res\", line 136, characters 7-14", Belt_List.length(xs), 8); + Test_utils.eq("File \"belt_list_test.res\", line 137, characters 7-14", xs, Belt_List.zipBy(length_10_id, length_8_id, add)); + Test_utils.eq("File \"belt_list_test.res\", line 138, 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 + } + }); + }); + Mocha.test("take", () => { + Test_utils.eq("File \"belt_list_test.res\", line 142, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, 2), { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 143, characters 7-14", Belt_List.take(/* [] */0, 1), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 144, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 3), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 145, characters 7-14", Belt_List.take({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, 2), { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 146, characters 7-14", Belt_List.take(length_10_id, 8), length_8_id); + Test_utils.eq("File \"belt_list_test.res\", line 147, characters 7-14", Belt_List.take(length_10_id, 0), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 148, characters 7-14", Belt_List.take(length_8_id, -2), undefined); + }); + Mocha.test("droo", () => { + Test_utils.eq("File \"belt_list_test.res\", line 152, characters 7-14", Belt_List.drop(length_10_id, 10), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 153, characters 7-14", Belt_List.drop(length_10_id, 8), { + hd: 8, + tl: { + hd: 9, + tl: /* [] */0 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 154, characters 7-14", Belt_List.drop(length_10_id, 0), length_10_id); + Test_utils.eq("File \"belt_list_test.res\", line 155, characters 7-14", Belt_List.drop(length_8_id, -1), undefined); + }); + Mocha.test("splitAt", () => { + let a = Belt_List.makeBy(5, id); + Test_utils.eq("File \"belt_list_test.res\", line 160, characters 7-14", Belt_List.splitAt(/* [] */0, 1), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 161, characters 7-14", Belt_List.splitAt(a, 6), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 162, characters 7-14", Belt_List.splitAt(a, 5), [ + a, + /* [] */0 + ]); + Test_utils.eq("File \"belt_list_test.res\", line 163, 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 + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 164, 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 + } + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 165, 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 + } + } + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 166, 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 + } + } + } + } + ]); + Test_utils.eq("File \"belt_list_test.res\", line 167, characters 7-14", Belt_List.splitAt(a, 0), [ + /* [] */0, + a + ]); + Test_utils.eq("File \"belt_list_test.res\", line 168, characters 7-14", Belt_List.splitAt(a, -1), undefined); + }); + Mocha.test("removeAssoc", () => { + let eqx = (x, y) => x === y; + Test_utils.ok("File \"belt_list_test.res\", line 174, characters 7-14", Belt_List.hasAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 2, (prim0, prim1) => prim0 === prim1)); + Test_utils.ok("File \"belt_list_test.res\", line 175, characters 7-14", !Belt_List.hasAssoc({ + hd: [ + 1, + "1" + ], + tl: { + hd: [ + 2, + "2" + ], + tl: { + hd: [ + 3, + "3" + ], + tl: /* [] */0 + } + } + }, 4, (prim0, prim1) => prim0 === prim1)); + Test_utils.ok("File \"belt_list_test.res\", line 176, 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)); + Test_utils.eq("File \"belt_list_test.res\", line 178, characters 6-13", 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 183, characters 6-13", 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 188, characters 6-13", 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 193, 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 + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 198, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 199, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 200, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 201, 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); + Test_utils.ok("File \"belt_list_test.res\", line 204, characters 7-14", ll === ll0); + let ll1 = Belt_List.setAssoc(ll, 2, "22", (prim0, prim1) => prim0 === prim1); + Test_utils.eq("File \"belt_list_test.res\", line 206, 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); + Test_utils.ok("File \"belt_list_test.res\", line 208, characters 7-14", Primitive_object.equal(ll2, { + hd: [ + 22, + "2" + ], + tl: ll1 + })); + Test_utils.ok("File \"belt_list_test.res\", line 209, characters 7-14", Belt_List.tailExn(ll2) === ll1); + Test_utils.ok("File \"belt_list_test.res\", line 211, characters 6-13", Primitive_object.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 + } + } + })); + Test_utils.ok("File \"belt_list_test.res\", line 216, characters 6-13", Primitive_object.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 + } + } + })); + Test_utils.eq("File \"belt_list_test.res\", line 219, characters 7-14", Belt_List.setAssoc(/* [] */0, 1, "1", (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: /* [] */0 + }); + Test_utils.eq("File \"belt_list_test.res\", line 220, characters 7-14", Belt_List.setAssoc({ + hd: [ + 1, + "2" + ], + tl: /* [] */0 + }, 1, "1", (prim0, prim1) => prim0 === prim1), { + hd: [ + 1, + "1" + ], + tl: /* [] */0 + }); + Test_utils.eq("File \"belt_list_test.res\", line 222, 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 + } + }); + Test_utils.ok("File \"belt_list_test.res\", line 223, characters 7-14", Primitive_object.equal(Belt_List.getAssoc({ + hd: [ + 1, + "a" + ], + tl: { + hd: [ + 2, + "b" + ], + tl: { + hd: [ + 3, + "c" + ], + tl: /* [] */0 + } + } + }, 2, (prim0, prim1) => prim0 === prim1), "b")); + Test_utils.ok("File \"belt_list_test.res\", line 224, 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); + }); + Mocha.test("head/tail etc.", () => { + let succx = x => x + 1 | 0; + Test_utils.eq("File \"belt_list_test.res\", line 230, characters 7-14", [ + Belt_List.head(length_10_id), + Belt_List.tail(length_10_id) + ], [ + 0, + Belt_List.drop(length_10_id, 1) + ]); + Test_utils.eq("File \"belt_list_test.res\", line 231, characters 7-14", Belt_List.head(/* [] */0), undefined); + Test_utils.$$throw("File \"belt_list_test.res\", line 232, characters 10-17", () => Belt_List.headExn(/* [] */0)); + Test_utils.$$throw("File \"belt_list_test.res\", line 233, characters 10-17", () => { + Belt_List.tailExn(/* [] */0); + }); + Test_utils.$$throw("File \"belt_list_test.res\", line 234, characters 10-17", () => { + Belt_List.getExn({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, -1); + }); + Test_utils.$$throw("File \"belt_list_test.res\", line 235, characters 10-17", () => { + Belt_List.getExn({ + hd: 0, + tl: { + hd: 1, + tl: /* [] */0 + } + }, 2); + }); + Test_utils.eq("File \"belt_list_test.res\", line 236, 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 + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 237, characters 7-14", Belt_List.headExn({ + hd: 1, + tl: /* [] */0 + }), 1); + Test_utils.eq("File \"belt_list_test.res\", line 238, characters 7-14", Belt_List.tailExn({ + hd: 1, + tl: /* [] */0 + }), /* [] */0); + Belt_List.forEachWithIndex(length_10_id, (i, x) => Test_utils.eq("File \"belt_list_test.res\", line 239, characters 50-57", Belt_List.get(length_10_id, i), x)); + Test_utils.eq("File \"belt_list_test.res\", line 240, characters 7-14", Belt_List.tail(/* [] */0), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 241, characters 7-14", Belt_List.drop(/* [] */0, 3), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 242, characters 7-14", Belt_List.mapWithIndex(/* [] */0, (i, x) => i + x | 0), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 243, characters 7-14", Belt_List.get(length_10_id, -1), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 244, characters 7-14", Belt_List.get(length_10_id, 12), undefined); + Test_utils.eq("File \"belt_list_test.res\", line 245, characters 7-14", sum(/* [] */0), 0); + Test_utils.eq("File \"belt_list_test.res\", line 246, characters 7-14", sum(length_10_id), 45); + Test_utils.eq("File \"belt_list_test.res\", line 247, characters 7-14", Belt_List.makeBy(0, id), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 248, characters 7-14", Belt_List.reverse(Belt_List.reverse(length_10_id)), length_10_id); + Test_utils.eq("File \"belt_list_test.res\", line 249, characters 7-14", Belt_List.reverse(Belt_List.reverse(length_8_id)), length_8_id); + Test_utils.eq("File \"belt_list_test.res\", line 250, characters 7-14", Belt_List.reverse(/* [] */0), /* [] */0); + Test_utils.eq("File \"belt_list_test.res\", line 251, characters 7-14", Belt_List.reverse(Belt_List.mapReverse(length_10_id, succx)), Belt_List.map(length_10_id, succx)); + Test_utils.eq("File \"belt_list_test.res\", line 252, characters 7-14", Belt_List.reduce(length_10_id, 0, add), 45); + Test_utils.eq("File \"belt_list_test.res\", line 253, characters 7-14", Belt_List.reduceReverse(length_10_id, 0, add), 45); + Test_utils.eq("File \"belt_list_test.res\", line 254, characters 7-14", Belt_List.reduceReverse(Belt_List.makeBy(10000, i => i), 0, (prim0, prim1) => prim0 + prim1 | 0), 49995000); + Test_utils.eq("File \"belt_list_test.res\", line 257, characters 7-14", sum2(length_10_id, length_10_id), 90); + Test_utils.eq("File \"belt_list_test.res\", line 258, characters 7-14", sum2(length_8_id, length_10_id), 56); + Test_utils.eq("File \"belt_list_test.res\", line 259, characters 7-14", sum2(length_10_id, length_8_id), 56); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.res\", line 265, characters 7-14", Belt_List.every({ + hd: 2, + tl: { + hd: 4, + tl: { + hd: 6, + tl: /* [] */0 + } + } + }, mod2), true); + Test_utils.eq("File \"belt_list_test.res\", line 266, characters 7-14", Belt_List.every({ + hd: 1, + tl: /* [] */0 + }, mod2), false); + Test_utils.eq("File \"belt_list_test.res\", line 267, characters 7-14", Belt_List.every(/* [] */0, mod2), true); + Test_utils.eq("File \"belt_list_test.res\", line 268, characters 7-14", Belt_List.some({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 5, + tl: /* [] */0 + } + } + }, mod2), true); + Test_utils.eq("File \"belt_list_test.res\", line 269, characters 7-14", Belt_List.some({ + hd: 1, + tl: { + hd: 3, + tl: { + hd: 5, + tl: /* [] */0 + } + } + }, mod2), false); + Test_utils.eq("File \"belt_list_test.res\", line 270, characters 7-14", Belt_List.some(/* [] */0, mod2), false); + Test_utils.eq("File \"belt_list_test.res\", line 271, characters 7-14", Belt_List.has({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, "2", (x, s) => x.toString() === s), true); + Test_utils.eq("File \"belt_list_test.res\", line 272, characters 7-14", Belt_List.has({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, "0", (x, s) => x.toString() === s), false); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.res\", line 276, characters 7-14", Primitive_object.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 + } + } + } + })); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.res\", line 279, characters 7-14", Primitive_object.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 + } + } + } + })); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.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); + Test_utils.ok("File \"belt_list_test.res\", line 284, characters 6-13", Belt_List.reduceReverse2(a, { + hd: 0, + tl: a + }, 0, (acc, x, y) => (acc + x | 0) + y | 0) === 99980001); + }); + Mocha.test("every2", () => { + Test_utils.eq("File \"belt_list_test.res\", line 290, characters 7-14", Belt_List.every2(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.res\", line 292, characters 7-14", Belt_List.every2({ + hd: 2, + tl: /* [] */0 + }, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), true); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + }); + Mocha.test("some2", () => { + Test_utils.eq("File \"belt_list_test.res\", line 298, characters 7-14", Belt_List.some2(/* [] */0, { + hd: 1, + tl: /* [] */0 + }, (x, y) => x > y), false); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + Test_utils.eq("File \"belt_list_test.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); + }); + Mocha.test("add", () => Test_utils.eq("File \"belt_list_test.res\", line 307, characters 7-14", Belt_List.add(Belt_List.add(/* [] */0, 3), 2), { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + })); + Mocha.test("cmp", () => { + Test_utils.ok("File \"belt_list_test.res\", line 311, 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 + } + } + } + }, Primitive_int.compare) > 0); + Test_utils.ok("File \"belt_list_test.res\", line 312, 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 + } + } + }, Primitive_int.compare) > 0); + Test_utils.ok("File \"belt_list_test.res\", line 313, 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 + } + } + } + }, Primitive_int.compare) < 0); + Test_utils.ok("File \"belt_list_test.res\", line 314, 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 + } + } + }, Primitive_int.compare) > 0); + Test_utils.ok("File \"belt_list_test.res\", line 315, 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 + } + } + }, Primitive_int.compare) === 0); + Test_utils.ok("File \"belt_list_test.res\", line 316, 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 + } + } + }, Primitive_int.compare) > 0); + }); + Mocha.test("cmpByLength", () => { + Test_utils.ok("File \"belt_list_test.res\", line 320, characters 7-14", Belt_List.cmpByLength(/* [] */0, /* [] */0) === 0); + Test_utils.ok("File \"belt_list_test.res\", line 321, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: /* [] */0 + }, /* [] */0) > 0); + Test_utils.ok("File \"belt_list_test.res\", line 322, characters 7-14", Belt_List.cmpByLength(/* [] */0, { + hd: 1, + tl: /* [] */0 + }) < 0); + Test_utils.ok("File \"belt_list_test.res\", line 323, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }, { + hd: 1, + tl: /* [] */0 + }) > 0); + Test_utils.ok("File \"belt_list_test.res\", line 324, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: /* [] */0 + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }) < 0); + Test_utils.ok("File \"belt_list_test.res\", line 325, characters 7-14", Belt_List.cmpByLength({ + hd: 1, + tl: { + hd: 3, + tl: /* [] */0 + } + }, { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + }) === 0); + }); + Mocha.test("makeBy", () => { + let makeTest = n => Test_utils.eq("File \"belt_list_test.res\", line 329, characters 27-34", Belt_List.make(n, 3), Belt_List.makeBy(n, param => 3)); + makeTest(0); + makeTest(1); + makeTest(2); + makeTest(3); + }); + Mocha.test("sort", () => { + let cmp = (a, b) => a - b | 0; + Test_utils.eq("File \"belt_list_test.res\", line 339, 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 + } + } + } + }); + Test_utils.eq("File \"belt_list_test.res\", line 340, 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 + } + } + } + } + }); + }); + Mocha.test("eq", () => { + Test_utils.ok("File \"belt_list_test.res\", line 344, 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)); + Test_utils.ok("File \"belt_list_test.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: { + hd: 3, + tl: /* [] */0 + } + } + }, (x, y) => x === y)); + Test_utils.ok("File \"belt_list_test.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: 4, + tl: /* [] */0 + } + } + }, (x, y) => x === y)); + Test_utils.ok("File \"belt_list_test.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: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }, (prim0, prim1) => prim0 === prim1)); + }); + Mocha.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; + } + + }); + Test_utils.eq("File \"belt_list_test.res\", line 360, characters 7-14", u1, { + hd: 1, + tl: { + hd: 8, + tl: { + hd: 15, + tl: /* [] */0 + } + } + }); + Test_utils.ok("File \"belt_list_test.res\", line 362, characters 6-13", Primitive_object.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 + } + })); + Test_utils.ok("File \"belt_list_test.res\", line 377, 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; + +export { + N, + A, + sum, + sum2, +} +/* Not a pure module */ diff --git a/tests/tests/src/belt_mapint_test.js b/tests/tests/src/belt_mapint_test.js deleted file mode 100644 index 138f665ed0..0000000000 --- a/tests/tests/src/belt_mapint_test.js +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Test_utils = require("./test_utils.js"); -let Belt_MapInt = require("rescript/lib/js/Belt_MapInt.js"); - -Mocha.describe("Belt_mapint_test", () => { - Mocha.test("set", () => { - let m; - for (let i = 0; i <= 999999; ++i) { - m = Belt_MapInt.set(m, i, i); - } - for (let i$1 = 0; i$1 <= 999999; ++i$1) { - Test_utils.ok("File \"belt_mapint_test.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); - } - Test_utils.ok("File \"belt_mapint_test.res\", line 23, characters 7-14", Belt_MapInt.isEmpty(m)); - }); -}); - -let M; - -exports.M = M; -/* Not a pure module */ diff --git a/tests/tests/src/belt_mapint_test.mjs b/tests/tests/src/belt_mapint_test.mjs new file mode 100644 index 0000000000..48f68d7a35 --- /dev/null +++ b/tests/tests/src/belt_mapint_test.mjs @@ -0,0 +1,28 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Test_utils from "./test_utils.mjs"; +import * as Belt_MapInt from "rescript/lib/es6/Belt_MapInt.js"; + +Mocha.describe("Belt_mapint_test", () => { + Mocha.test("set", () => { + let m; + for (let i = 0; i <= 999999; ++i) { + m = Belt_MapInt.set(m, i, i); + } + for (let i$1 = 0; i$1 <= 999999; ++i$1) { + Test_utils.ok("File \"belt_mapint_test.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); + } + Test_utils.ok("File \"belt_mapint_test.res\", line 23, characters 7-14", Belt_MapInt.isEmpty(m)); + }); +}); + +let M; + +export { + M, +} +/* Not a pure module */ diff --git a/tests/tests/src/belt_result_alias_test.js b/tests/tests/src/belt_result_alias_test.js deleted file mode 100644 index 49b887b852..0000000000 --- a/tests/tests/src/belt_result_alias_test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Result = require("rescript/lib/js/Belt_Result.js"); - -Belt_Result.map({ - TAG: "Ok", - _0: "Test" -}, r => "Value: " + r); - -Belt_Result.getWithDefault(Belt_Result.map({ - TAG: "Error", - _0: "error" -}, r => "Value: " + r), "success"); - -/* Not a pure module */ diff --git a/tests/tests/src/belt_result_alias_test.mjs b/tests/tests/src/belt_result_alias_test.mjs new file mode 100644 index 0000000000..ae39edea54 --- /dev/null +++ b/tests/tests/src/belt_result_alias_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Result from "rescript/lib/es6/Belt_Result.js"; + +Belt_Result.map({ + TAG: "Ok", + _0: "Test" +}, r => "Value: " + r); + +Belt_Result.getWithDefault(Belt_Result.map({ + TAG: "Error", + _0: "error" +}, r => "Value: " + r), "success"); + +/* Not a pure module */ diff --git a/tests/tests/src/belt_sortarray_test.js b/tests/tests/src/belt_sortarray_test.js deleted file mode 100644 index 2975a39075..0000000000 --- a/tests/tests/src/belt_sortarray_test.js +++ /dev/null @@ -1,345 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mocha = require("mocha"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_Range = require("rescript/lib/js/Belt_Range.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Test_utils = require("./test_utils.js"); -let Belt_SortArray = require("rescript/lib/js/Belt_SortArray.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_SortArrayInt = require("rescript/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; -} - -Mocha.describe("Belt_sortarray_test", () => { - Mocha.test("union", () => { - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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 - ]); - }); - Mocha.test("intersect", () => { - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.res\", line 48, characters 7-14", inters(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), []); - }); - Mocha.test("diff", () => { - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.res\", line 55, characters 7-14", diffs(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ - 0, - 1, - 2 - ]); - }); - Mocha.test("isSorted", () => { - Test_utils.ok("File \"belt_sortarray_test.res\", line 59, characters 7-14", Belt_SortArray.isSorted([], cmp)); - Test_utils.ok("File \"belt_sortarray_test.res\", line 60, characters 7-14", Belt_SortArray.isSorted([0], cmp)); - Test_utils.ok("File \"belt_sortarray_test.res\", line 61, characters 7-14", Belt_SortArray.isSorted([ - 0, - 1 - ], cmp)); - Test_utils.ok("File \"belt_sortarray_test.res\", line 62, characters 7-14", !Belt_SortArray.isSorted([ - 1, - 0 - ], cmp)); - }); - Mocha.test("stableSortInPlaceBy", () => Test_utils.ok("File \"belt_sortarray_test.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); - }))); - Mocha.test("stableSortInPlaceBy 2", () => { - let u = Array_data_util.randomRange(0, 1000000); - let u1 = u.slice(0); - Belt_SortArray.stableSortInPlaceBy(u, cmp); - Test_utils.ok("File \"belt_sortarray_test.res\", line 85, characters 7-14", Belt_SortArray.isSorted(u, cmp)); - Belt_SortArrayInt.stableSortInPlace(u1); - Test_utils.ok("File \"belt_sortarray_test.res\", line 87, characters 7-14", Belt_SortArray.isSorted(u1, cmp)); - }); - Mocha.test("stableSortInPlaceBy 3", () => { - let u = [ - [ - 1, - "a" - ], - [ - 1, - "b" - ], - [ - 2, - "a" - ] - ]; - Test_utils.eq("File \"belt_sortarray_test.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" - ] - ]; - Test_utils.eq("File \"belt_sortarray_test.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" - ] - ]; - Test_utils.eq("File \"belt_sortarray_test.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" - ] - ]); - }); - Mocha.test("binarySearchBy", () => { - Test_utils.eq("File \"belt_sortarray_test.res\", line 108, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy([ - 1, - 3, - 5, - 7 - ], 4, cmp)), 2); - Test_utils.eq("File \"belt_sortarray_test.res\", line 109, characters 7-14", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 - ], 33, cmp), 4); - Test_utils.eq("File \"belt_sortarray_test.res\", line 110, characters 7-14", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 - ], 1, cmp), 0); - Test_utils.eq("File \"belt_sortarray_test.res\", line 111, characters 7-14", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 - ], 2, cmp), 1); - Test_utils.eq("File \"belt_sortarray_test.res\", line 112, characters 7-14", Belt_SortArray.binarySearchBy([ - 1, - 2, - 3, - 4, - 33, - 35, - 36 - ], 3, cmp), 2); - Test_utils.eq("File \"belt_sortarray_test.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); - Test_utils.ok("File \"belt_sortarray_test.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)); - Test_utils.eq("File \"belt_sortarray_test.res\", line 118, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, 5000, cmp)), 2001); - Test_utils.eq("File \"belt_sortarray_test.res\", line 119, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, -1, cmp)), 0); - Test_utils.eq("File \"belt_sortarray_test.res\", line 120, characters 7-14", Belt_SortArray.binarySearchBy(cc, 0, cmp), 0); - Test_utils.eq("File \"belt_sortarray_test.res\", line 122, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, 1, cmp)), 1); - Test_utils.ok("File \"belt_sortarray_test.res\", line 124, characters 6-13", Belt_Range.every(0, 1999, i => Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp)) === (i + 1 | 0))); - }); - Mocha.test("strictlySortedLength", () => { - let lt = (x, y) => x < y; - Test_utils.eq("File \"belt_sortarray_test.res\", line 133, characters 7-14", Belt_SortArray.strictlySortedLength([], lt), 0); - Test_utils.eq("File \"belt_sortarray_test.res\", line 134, characters 7-14", Belt_SortArray.strictlySortedLength([1], lt), 1); - Test_utils.eq("File \"belt_sortarray_test.res\", line 135, characters 7-14", Belt_SortArray.strictlySortedLength([ - 1, - 1 - ], lt), 1); - Test_utils.eq("File \"belt_sortarray_test.res\", line 136, characters 7-14", Belt_SortArray.strictlySortedLength([ - 1, - 1, - 2 - ], lt), 1); - Test_utils.eq("File \"belt_sortarray_test.res\", line 137, characters 7-14", Belt_SortArray.strictlySortedLength([ - 1, - 2 - ], lt), 2); - Test_utils.eq("File \"belt_sortarray_test.res\", line 138, characters 7-14", Belt_SortArray.strictlySortedLength([ - 1, - 2, - 3, - 4, - 3 - ], lt), 4); - Test_utils.eq("File \"belt_sortarray_test.res\", line 139, characters 7-14", Belt_SortArray.strictlySortedLength([ - 4, - 4, - 3, - 2, - 1 - ], lt), 1); - Test_utils.eq("File \"belt_sortarray_test.res\", line 140, characters 7-14", Belt_SortArray.strictlySortedLength([ - 4, - 3, - 2, - 1 - ], lt), -4); - Test_utils.eq("File \"belt_sortarray_test.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/tests/tests/src/belt_sortarray_test.mjs b/tests/tests/src/belt_sortarray_test.mjs new file mode 100644 index 0000000000..6c6ab7f7c4 --- /dev/null +++ b/tests/tests/src/belt_sortarray_test.mjs @@ -0,0 +1,346 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mocha from "mocha"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_Range from "rescript/lib/es6/Belt_Range.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Test_utils from "./test_utils.mjs"; +import * as Belt_SortArray from "rescript/lib/es6/Belt_SortArray.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Belt_SortArrayInt from "rescript/lib/es6/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; +} + +Mocha.describe("Belt_sortarray_test", () => { + Mocha.test("union", () => { + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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 + ]); + }); + Mocha.test("intersect", () => { + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.res\", line 48, characters 7-14", inters(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), []); + }); + Mocha.test("diff", () => { + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.res\", line 55, characters 7-14", diffs(Array_data_util.range(0, 2), Array_data_util.range(4, 7)), [ + 0, + 1, + 2 + ]); + }); + Mocha.test("isSorted", () => { + Test_utils.ok("File \"belt_sortarray_test.res\", line 59, characters 7-14", Belt_SortArray.isSorted([], cmp)); + Test_utils.ok("File \"belt_sortarray_test.res\", line 60, characters 7-14", Belt_SortArray.isSorted([0], cmp)); + Test_utils.ok("File \"belt_sortarray_test.res\", line 61, characters 7-14", Belt_SortArray.isSorted([ + 0, + 1 + ], cmp)); + Test_utils.ok("File \"belt_sortarray_test.res\", line 62, characters 7-14", !Belt_SortArray.isSorted([ + 1, + 0 + ], cmp)); + }); + Mocha.test("stableSortInPlaceBy", () => Test_utils.ok("File \"belt_sortarray_test.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); + }))); + Mocha.test("stableSortInPlaceBy 2", () => { + let u = Array_data_util.randomRange(0, 1000000); + let u1 = u.slice(0); + Belt_SortArray.stableSortInPlaceBy(u, cmp); + Test_utils.ok("File \"belt_sortarray_test.res\", line 85, characters 7-14", Belt_SortArray.isSorted(u, cmp)); + Belt_SortArrayInt.stableSortInPlace(u1); + Test_utils.ok("File \"belt_sortarray_test.res\", line 87, characters 7-14", Belt_SortArray.isSorted(u1, cmp)); + }); + Mocha.test("stableSortInPlaceBy 3", () => { + let u = [ + [ + 1, + "a" + ], + [ + 1, + "b" + ], + [ + 2, + "a" + ] + ]; + Test_utils.eq("File \"belt_sortarray_test.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" + ] + ]; + Test_utils.eq("File \"belt_sortarray_test.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" + ] + ]; + Test_utils.eq("File \"belt_sortarray_test.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" + ] + ]); + }); + Mocha.test("binarySearchBy", () => { + Test_utils.eq("File \"belt_sortarray_test.res\", line 108, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy([ + 1, + 3, + 5, + 7 + ], 4, cmp)), 2); + Test_utils.eq("File \"belt_sortarray_test.res\", line 109, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 33, cmp), 4); + Test_utils.eq("File \"belt_sortarray_test.res\", line 110, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 1, cmp), 0); + Test_utils.eq("File \"belt_sortarray_test.res\", line 111, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 2, cmp), 1); + Test_utils.eq("File \"belt_sortarray_test.res\", line 112, characters 7-14", Belt_SortArray.binarySearchBy([ + 1, + 2, + 3, + 4, + 33, + 35, + 36 + ], 3, cmp), 2); + Test_utils.eq("File \"belt_sortarray_test.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); + Test_utils.ok("File \"belt_sortarray_test.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)); + Test_utils.eq("File \"belt_sortarray_test.res\", line 118, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, 5000, cmp)), 2001); + Test_utils.eq("File \"belt_sortarray_test.res\", line 119, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, -1, cmp)), 0); + Test_utils.eq("File \"belt_sortarray_test.res\", line 120, characters 7-14", Belt_SortArray.binarySearchBy(cc, 0, cmp), 0); + Test_utils.eq("File \"belt_sortarray_test.res\", line 122, characters 7-14", Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, 1, cmp)), 1); + Test_utils.ok("File \"belt_sortarray_test.res\", line 124, characters 6-13", Belt_Range.every(0, 1999, i => Pervasives.lnot(Belt_SortArray.binarySearchBy(cc, (i << 1) + 1 | 0, cmp)) === (i + 1 | 0))); + }); + Mocha.test("strictlySortedLength", () => { + let lt = (x, y) => x < y; + Test_utils.eq("File \"belt_sortarray_test.res\", line 133, characters 7-14", Belt_SortArray.strictlySortedLength([], lt), 0); + Test_utils.eq("File \"belt_sortarray_test.res\", line 134, characters 7-14", Belt_SortArray.strictlySortedLength([1], lt), 1); + Test_utils.eq("File \"belt_sortarray_test.res\", line 135, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 1 + ], lt), 1); + Test_utils.eq("File \"belt_sortarray_test.res\", line 136, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 1, + 2 + ], lt), 1); + Test_utils.eq("File \"belt_sortarray_test.res\", line 137, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 2 + ], lt), 2); + Test_utils.eq("File \"belt_sortarray_test.res\", line 138, characters 7-14", Belt_SortArray.strictlySortedLength([ + 1, + 2, + 3, + 4, + 3 + ], lt), 4); + Test_utils.eq("File \"belt_sortarray_test.res\", line 139, characters 7-14", Belt_SortArray.strictlySortedLength([ + 4, + 4, + 3, + 2, + 1 + ], lt), 1); + Test_utils.eq("File \"belt_sortarray_test.res\", line 140, characters 7-14", Belt_SortArray.strictlySortedLength([ + 4, + 3, + 2, + 1 + ], lt), -4); + Test_utils.eq("File \"belt_sortarray_test.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; + +export { + I, + R, + A, + S, + SI, + cmp, + unions, + inters, + diffs, +} +/* Not a pure module */ diff --git a/tests/tests/src/bench.js b/tests/tests/src/bench.js deleted file mode 100644 index e1a94eab1c..0000000000 --- a/tests/tests/src/bench.js +++ /dev/null @@ -1,57 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); - -function map(f, a) { - let f$1 = x => f(x); - let l = a.length; - if (l === 0) { - return []; - } - let r = Belt_Array.make(l, f$1(a[0])); - for (let i = 1; i < l; ++i) { - r[i] = f$1(a[i]); - } - return r; -} - -function init(l, f) { - let f$1 = x => f(x); - if (l === 0) { - return []; - } - if (l < 0) { - return Pervasives.invalid_arg("Array.init"); - } - let res = Belt_Array.make(l, f$1(0)); - for (let i = 1; i < l; ++i) { - res[i] = f$1(i); - } - return res; -} - -function fold_left(f, x, a) { - let f$1 = (x, y) => f(x, y); - let r = x; - for (let i = 0, i_finish = a.length; i < i_finish; ++i) { - r = f$1(r, a[i]); - } - return r; -} - -function f2() { - let arr = init(3000000, i => i); - let b = map(i => i + i - 1, arr); - let v = fold_left((prim0, prim1) => prim0 + prim1, 0, b); - console.log("%f", v); -} - -f2(); - -exports.map = map; -exports.init = init; -exports.fold_left = fold_left; -exports.f2 = f2; -/* Not a pure module */ diff --git a/tests/tests/src/bench.mjs b/tests/tests/src/bench.mjs new file mode 100644 index 0000000000..d3009bf70a --- /dev/null +++ b/tests/tests/src/bench.mjs @@ -0,0 +1,58 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; + +function map(f, a) { + let f$1 = x => f(x); + let l = a.length; + if (l === 0) { + return []; + } + let r = Belt_Array.make(l, f$1(a[0])); + for (let i = 1; i < l; ++i) { + r[i] = f$1(a[i]); + } + return r; +} + +function init(l, f) { + let f$1 = x => f(x); + if (l === 0) { + return []; + } + if (l < 0) { + return Pervasives.invalid_arg("Array.init"); + } + let res = Belt_Array.make(l, f$1(0)); + for (let i = 1; i < l; ++i) { + res[i] = f$1(i); + } + return res; +} + +function fold_left(f, x, a) { + let f$1 = (x, y) => f(x, y); + let r = x; + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { + r = f$1(r, a[i]); + } + return r; +} + +function f2() { + let arr = init(3000000, i => i); + let b = map(i => i + i - 1, arr); + let v = fold_left((prim0, prim1) => prim0 + prim1, 0, b); + console.log("%f", v); +} + +f2(); + +export { + map, + init, + fold_left, + f2, +} +/* Not a pure module */ diff --git a/tests/tests/src/big_enum.js b/tests/tests/src/big_enum.js deleted file mode 100644 index 108718e9cc..0000000000 --- a/tests/tests/src/big_enum.js +++ /dev/null @@ -1,1217 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function to_enum(x) { - switch (x) { - case "A0" : - return 0; - case "A1" : - return 1; - case "A2" : - return 2; - case "A3" : - return 3; - case "A4" : - return 4; - case "A5" : - return 5; - case "A6" : - return 6; - case "A7" : - return 7; - case "A8" : - return 8; - case "A9" : - return 9; - case "A10" : - return 10; - case "A11" : - return 11; - case "A12" : - return 12; - case "A13" : - return 13; - case "A14" : - return 14; - case "A15" : - return 15; - case "A16" : - return 16; - case "A17" : - return 17; - case "A18" : - return 18; - case "A19" : - return 19; - case "A20" : - return 20; - case "A21" : - return 21; - case "A22" : - return 22; - case "A23" : - return 23; - case "A24" : - return 24; - case "A25" : - return 25; - case "A26" : - return 26; - case "A27" : - return 27; - case "A28" : - return 28; - case "A29" : - return 29; - case "A30" : - return 30; - case "A31" : - return 31; - case "A32" : - return 32; - case "A33" : - return 33; - case "A34" : - return 34; - case "A35" : - return 35; - case "A36" : - return 36; - case "A37" : - return 37; - case "A38" : - return 38; - case "A39" : - return 39; - case "A40" : - return 40; - case "A41" : - return 41; - case "A42" : - return 42; - case "A43" : - return 43; - case "A44" : - return 44; - case "A45" : - return 45; - case "A46" : - return 46; - case "A47" : - return 47; - case "A48" : - return 48; - case "A49" : - return 49; - case "A50" : - return 50; - case "A51" : - return 51; - case "A52" : - return 52; - case "A53" : - return 53; - case "A54" : - return 54; - case "A55" : - return 55; - case "A56" : - return 56; - case "A57" : - return 57; - case "A58" : - return 58; - case "A59" : - return 59; - case "A60" : - return 60; - case "A61" : - return 61; - case "A62" : - return 62; - case "A63" : - return 63; - case "A64" : - return 64; - case "A65" : - return 65; - case "A66" : - return 66; - case "A67" : - return 67; - case "A68" : - return 68; - case "A69" : - return 69; - case "A70" : - return 70; - case "A71" : - return 71; - case "A72" : - return 72; - case "A73" : - return 73; - case "A74" : - return 74; - case "A75" : - return 75; - case "A76" : - return 76; - case "A77" : - return 77; - case "A78" : - return 78; - case "A79" : - return 79; - case "A80" : - return 80; - case "A81" : - return 81; - case "A82" : - return 82; - case "A83" : - return 83; - case "A84" : - return 84; - case "A85" : - return 85; - case "A86" : - return 86; - case "A87" : - return 87; - case "A88" : - return 88; - case "A89" : - return 89; - case "A90" : - return 90; - case "A91" : - return 91; - case "A92" : - return 92; - case "A93" : - return 93; - case "A94" : - return 94; - case "A95" : - return 95; - case "A96" : - return 96; - case "A97" : - return 97; - case "A98" : - return 98; - case "A99" : - return 99; - case "A100" : - return 100; - case "A101" : - return 101; - case "A102" : - return 102; - case "A103" : - return 103; - case "A104" : - return 104; - case "A105" : - return 105; - case "A106" : - return 106; - case "A107" : - return 107; - case "A108" : - return 108; - case "A109" : - return 109; - case "A110" : - return 110; - case "A111" : - return 111; - case "A112" : - return 112; - case "A113" : - return 113; - case "A114" : - return 114; - case "A115" : - return 115; - case "A116" : - return 116; - case "A117" : - return 117; - case "A118" : - return 118; - case "A119" : - return 119; - case "A120" : - return 120; - case "A121" : - return 121; - case "A122" : - return 122; - case "A123" : - return 123; - case "A124" : - return 124; - case "A125" : - return 125; - case "A126" : - return 126; - case "A127" : - return 127; - case "A128" : - return 128; - case "A129" : - return 129; - case "A130" : - return 130; - case "A131" : - return 131; - case "A132" : - return 132; - case "A133" : - return 133; - case "A134" : - return 134; - case "A135" : - return 135; - case "A136" : - return 136; - case "A137" : - return 137; - case "A138" : - return 138; - case "A139" : - return 139; - case "A140" : - return 140; - case "A141" : - return 141; - case "A142" : - return 142; - case "A143" : - return 143; - case "A144" : - return 144; - case "A145" : - return 145; - case "A146" : - return 146; - case "A147" : - return 147; - case "A148" : - return 148; - case "A149" : - return 149; - case "A150" : - return 150; - case "A151" : - return 151; - case "A152" : - return 152; - case "A153" : - return 153; - case "A154" : - return 154; - case "A155" : - return 155; - case "A156" : - return 156; - case "A157" : - return 157; - case "A158" : - return 158; - case "A159" : - return 159; - case "A160" : - return 160; - case "A161" : - return 161; - case "A162" : - return 162; - case "A163" : - return 163; - case "A164" : - return 164; - case "A165" : - return 165; - case "A166" : - return 166; - case "A167" : - return 167; - case "A168" : - return 168; - case "A169" : - return 169; - case "A170" : - return 170; - case "A171" : - return 171; - case "A172" : - return 172; - case "A173" : - return 173; - case "A174" : - return 174; - case "A175" : - return 175; - case "A176" : - return 176; - case "A177" : - return 177; - case "A178" : - return 178; - case "A179" : - return 179; - case "A180" : - return 180; - case "A181" : - return 181; - case "A182" : - return 182; - case "A183" : - return 183; - case "A184" : - return 184; - case "A185" : - return 185; - case "A186" : - return 186; - case "A187" : - return 187; - case "A188" : - return 188; - case "A189" : - return 189; - case "A190" : - return 190; - case "A191" : - return 191; - case "A192" : - return 192; - case "A193" : - return 193; - case "A194" : - return 194; - case "A195" : - return 195; - case "A196" : - return 196; - case "A197" : - return 197; - case "A198" : - return 198; - case "A199" : - return 199; - case "A200" : - return 200; - case "A201" : - return 201; - case "A202" : - return 202; - case "A203" : - return 203; - case "A204" : - return 204; - case "A205" : - return 205; - case "A206" : - return 206; - case "A207" : - return 207; - case "A208" : - return 208; - case "A209" : - return 209; - case "A210" : - return 210; - case "A211" : - return 211; - case "A212" : - return 212; - case "A213" : - return 213; - case "A214" : - return 214; - case "A215" : - return 215; - case "A216" : - return 216; - case "A217" : - return 217; - case "A218" : - return 218; - case "A219" : - return 219; - case "A220" : - return 220; - case "A221" : - return 221; - case "A222" : - return 222; - case "A223" : - return 223; - case "A224" : - return 224; - case "A225" : - return 225; - case "A226" : - return 226; - case "A227" : - return 227; - case "A228" : - return 228; - case "A229" : - return 229; - case "A230" : - return 230; - case "A231" : - return 231; - case "A232" : - return 232; - case "A233" : - return 233; - case "A234" : - return 234; - case "A235" : - return 235; - case "A236" : - return 236; - case "A237" : - return 237; - case "A238" : - return 238; - case "A239" : - return 239; - case "A240" : - return 240; - case "A241" : - return 241; - case "A242" : - return 242; - case "A243" : - return 243; - case "A244" : - return 244; - case "A245" : - return 245; - case "A246" : - return 246; - case "A247" : - return 247; - case "A248" : - return 248; - case "A249" : - return 249; - case "A250" : - return 250; - case "A251" : - return 251; - case "A252" : - return 252; - case "A253" : - return 253; - case "A254" : - return 254; - case "A255" : - return 255; - case "A256" : - return 256; - case "A257" : - return 257; - case "A258" : - return 258; - case "A259" : - return 259; - case "A260" : - return 260; - case "A261" : - return 261; - case "A262" : - return 262; - case "A263" : - return 263; - case "A264" : - return 264; - case "A265" : - return 265; - case "A266" : - return 266; - case "A267" : - return 267; - case "A268" : - return 268; - case "A269" : - return 269; - case "A270" : - return 270; - case "A271" : - return 271; - case "A272" : - return 272; - case "A273" : - return 273; - case "A274" : - return 274; - case "A275" : - return 275; - case "A276" : - return 276; - case "A277" : - return 277; - case "A278" : - return 278; - case "A279" : - return 279; - case "A280" : - return 280; - case "A281" : - return 281; - case "A282" : - return 282; - case "A283" : - return 283; - case "A284" : - return 284; - case "A285" : - return 285; - case "A286" : - return 286; - case "A287" : - return 287; - case "A288" : - return 288; - case "A289" : - return 289; - case "A290" : - return 290; - case "A291" : - return 291; - case "A292" : - return 292; - case "A293" : - return 293; - case "A294" : - return 294; - case "A295" : - return 295; - case "A296" : - return 296; - case "A297" : - return 297; - case "A298" : - return 298; - case "A299" : - return 299; - } -} - -function to_string(x) { - switch (x) { - case "A0" : - return "A0"; - case "A1" : - return "A1"; - case "A2" : - return "A2"; - case "A3" : - return "A3"; - case "A4" : - return "A4"; - case "A5" : - return "A5"; - case "A6" : - return "A6"; - case "A7" : - return "A7"; - case "A8" : - return "A8"; - case "A9" : - return "A9"; - case "A10" : - return "A10"; - case "A11" : - return "A11"; - case "A12" : - return "A12"; - case "A13" : - return "A13"; - case "A14" : - return "A14"; - case "A15" : - return "A15"; - case "A16" : - return "A16"; - case "A17" : - return "A17"; - case "A18" : - return "A18"; - case "A19" : - return "A19"; - case "A20" : - return "A20"; - case "A21" : - return "A21"; - case "A22" : - return "A22"; - case "A23" : - return "A23"; - case "A24" : - return "A24"; - case "A25" : - return "A25"; - case "A26" : - return "A26"; - case "A27" : - return "A27"; - case "A28" : - return "A28"; - case "A29" : - return "A29"; - case "A30" : - return "A30"; - case "A31" : - return "A31"; - case "A32" : - return "A32"; - case "A33" : - return "A33"; - case "A34" : - return "A34"; - case "A35" : - return "A35"; - case "A36" : - return "A36"; - case "A37" : - return "A37"; - case "A38" : - return "A38"; - case "A39" : - return "A39"; - case "A40" : - return "A40"; - case "A41" : - return "A41"; - case "A42" : - return "A42"; - case "A43" : - return "A43"; - case "A44" : - return "A44"; - case "A45" : - return "A45"; - case "A46" : - return "A46"; - case "A47" : - return "A47"; - case "A48" : - return "A48"; - case "A49" : - return "A49"; - case "A50" : - return "A50"; - case "A51" : - return "A51"; - case "A52" : - return "A52"; - case "A53" : - return "A53"; - case "A54" : - return "A54"; - case "A55" : - return "A55"; - case "A56" : - return "A56"; - case "A57" : - return "A57"; - case "A58" : - return "A58"; - case "A59" : - return "A59"; - case "A60" : - return "A60"; - case "A61" : - return "A61"; - case "A62" : - return "A62"; - case "A63" : - return "A63"; - case "A64" : - return "A64"; - case "A65" : - return "A65"; - case "A66" : - return "A66"; - case "A67" : - return "A67"; - case "A68" : - return "A68"; - case "A69" : - return "A69"; - case "A70" : - return "A70"; - case "A71" : - return "A71"; - case "A72" : - return "A72"; - case "A73" : - return "A73"; - case "A74" : - return "A74"; - case "A75" : - return "A75"; - case "A76" : - return "A76"; - case "A77" : - return "A77"; - case "A78" : - return "A78"; - case "A79" : - return "A79"; - case "A80" : - return "A80"; - case "A81" : - return "A81"; - case "A82" : - return "A82"; - case "A83" : - return "A83"; - case "A84" : - return "A84"; - case "A85" : - return "A85"; - case "A86" : - return "A86"; - case "A87" : - return "A87"; - case "A88" : - return "A88"; - case "A89" : - return "A89"; - case "A90" : - return "A90"; - case "A91" : - return "A91"; - case "A92" : - return "A92"; - case "A93" : - return "A93"; - case "A94" : - return "A94"; - case "A95" : - return "A95"; - case "A96" : - return "A96"; - case "A97" : - return "A97"; - case "A98" : - return "A98"; - case "A99" : - return "A99"; - case "A100" : - return "A100"; - case "A101" : - return "A101"; - case "A102" : - return "A102"; - case "A103" : - return "A103"; - case "A104" : - return "A104"; - case "A105" : - return "A105"; - case "A106" : - return "A106"; - case "A107" : - return "A107"; - case "A108" : - return "A108"; - case "A109" : - return "A109"; - case "A110" : - return "A110"; - case "A111" : - return "A111"; - case "A112" : - return "A112"; - case "A113" : - return "A113"; - case "A114" : - return "A114"; - case "A115" : - return "A115"; - case "A116" : - return "A116"; - case "A117" : - return "A117"; - case "A118" : - return "A118"; - case "A119" : - return "A119"; - case "A120" : - return "A120"; - case "A121" : - return "A121"; - case "A122" : - return "A122"; - case "A123" : - return "A123"; - case "A124" : - return "A124"; - case "A125" : - return "A125"; - case "A126" : - return "A126"; - case "A127" : - return "A127"; - case "A128" : - return "A128"; - case "A129" : - return "A129"; - case "A130" : - return "A130"; - case "A131" : - return "A131"; - case "A132" : - return "A132"; - case "A133" : - return "A133"; - case "A134" : - return "A134"; - case "A135" : - return "A135"; - case "A136" : - return "A136"; - case "A137" : - return "A137"; - case "A138" : - return "A138"; - case "A139" : - return "A139"; - case "A140" : - return "A140"; - case "A141" : - return "A141"; - case "A142" : - return "A142"; - case "A143" : - return "A143"; - case "A144" : - return "A144"; - case "A145" : - return "A145"; - case "A146" : - return "A146"; - case "A147" : - return "A147"; - case "A148" : - return "A148"; - case "A149" : - return "A149"; - case "A150" : - return "A150"; - case "A151" : - return "A151"; - case "A152" : - return "A152"; - case "A153" : - return "A153"; - case "A154" : - return "A154"; - case "A155" : - return "A155"; - case "A156" : - return "A156"; - case "A157" : - return "A157"; - case "A158" : - return "A158"; - case "A159" : - return "A159"; - case "A160" : - return "A160"; - case "A161" : - return "A161"; - case "A162" : - return "A162"; - case "A163" : - return "A163"; - case "A164" : - return "A164"; - case "A165" : - return "A165"; - case "A166" : - return "A166"; - case "A167" : - return "A167"; - case "A168" : - return "A168"; - case "A169" : - return "A169"; - case "A170" : - return "A170"; - case "A171" : - return "A171"; - case "A172" : - return "A172"; - case "A173" : - return "A173"; - case "A174" : - return "A174"; - case "A175" : - return "A175"; - case "A176" : - return "A176"; - case "A177" : - return "A177"; - case "A178" : - return "A178"; - case "A179" : - return "A179"; - case "A180" : - return "A180"; - case "A181" : - return "A181"; - case "A182" : - return "A182"; - case "A183" : - return "A183"; - case "A184" : - return "A184"; - case "A185" : - return "A185"; - case "A186" : - return "A186"; - case "A187" : - return "A187"; - case "A188" : - return "A188"; - case "A189" : - return "A189"; - case "A190" : - return "A190"; - case "A191" : - return "A191"; - case "A192" : - return "A192"; - case "A193" : - return "A193"; - case "A194" : - return "A194"; - case "A195" : - return "A195"; - case "A196" : - return "A196"; - case "A197" : - return "A197"; - case "A198" : - return "A198"; - case "A199" : - return "A199"; - case "A200" : - return "A200"; - case "A201" : - return "A201"; - case "A202" : - return "A202"; - case "A203" : - return "A203"; - case "A204" : - return "A204"; - case "A205" : - return "A205"; - case "A206" : - return "A206"; - case "A207" : - return "A207"; - case "A208" : - return "A208"; - case "A209" : - return "A209"; - case "A210" : - return "A210"; - case "A211" : - return "A211"; - case "A212" : - return "A212"; - case "A213" : - return "A213"; - case "A214" : - return "A214"; - case "A215" : - return "A215"; - case "A216" : - return "A216"; - case "A217" : - return "A217"; - case "A218" : - return "A218"; - case "A219" : - return "A219"; - case "A220" : - return "A220"; - case "A221" : - return "A221"; - case "A222" : - return "A222"; - case "A223" : - return "A223"; - case "A224" : - return "A224"; - case "A225" : - return "A225"; - case "A226" : - return "A226"; - case "A227" : - return "A227"; - case "A228" : - return "A228"; - case "A229" : - return "A229"; - case "A230" : - return "A230"; - case "A231" : - return "A231"; - case "A232" : - return "A232"; - case "A233" : - return "A233"; - case "A234" : - return "A234"; - case "A235" : - return "A235"; - case "A236" : - return "A236"; - case "A237" : - return "A237"; - case "A238" : - return "A238"; - case "A239" : - return "A239"; - case "A240" : - return "A240"; - case "A241" : - return "A241"; - case "A242" : - return "A242"; - case "A243" : - return "A243"; - case "A244" : - return "A244"; - case "A245" : - return "A245"; - case "A246" : - return "A246"; - case "A247" : - return "A247"; - case "A248" : - return "A248"; - case "A249" : - return "A249"; - case "A250" : - return "A250"; - case "A251" : - return "A251"; - case "A252" : - return "A252"; - case "A253" : - return "A253"; - case "A254" : - return "A254"; - case "A255" : - return "A255"; - case "A256" : - return "A256"; - case "A257" : - return "A257"; - case "A258" : - return "A258"; - case "A259" : - return "A259"; - case "A260" : - return "A260"; - case "A261" : - return "A261"; - case "A262" : - return "A262"; - case "A263" : - return "A263"; - case "A264" : - return "A264"; - case "A265" : - return "A265"; - case "A266" : - return "A266"; - case "A267" : - return "A267"; - case "A268" : - return "A268"; - case "A269" : - return "A269"; - case "A270" : - return "A270"; - case "A271" : - return "A271"; - case "A272" : - return "A272"; - case "A273" : - return "A273"; - case "A274" : - return "A274"; - case "A275" : - return "A275"; - case "A276" : - return "A276"; - case "A277" : - return "A277"; - case "A278" : - return "A278"; - case "A279" : - return "A279"; - case "A280" : - return "A280"; - case "A281" : - return "A281"; - case "A282" : - return "A282"; - case "A283" : - return "A283"; - case "A284" : - return "A284"; - case "A285" : - return "A285"; - case "A286" : - return "A286"; - case "A287" : - return "A287"; - case "A288" : - return "A288"; - case "A289" : - return "A289"; - case "A290" : - return "A290"; - case "A291" : - return "A291"; - case "A292" : - return "A292"; - case "A293" : - return "A293"; - case "A294" : - return "A294"; - case "A295" : - return "A295"; - case "A296" : - return "A296"; - case "A297" : - return "A297"; - case "A298" : - return "A298"; - case "A299" : - return "A299"; - } -} - -exports.to_enum = to_enum; -exports.to_string = to_string; -/* No side effect */ diff --git a/tests/tests/src/big_enum.mjs b/tests/tests/src/big_enum.mjs new file mode 100644 index 0000000000..3e9964fed1 --- /dev/null +++ b/tests/tests/src/big_enum.mjs @@ -0,0 +1,1218 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function to_enum(x) { + switch (x) { + case "A0" : + return 0; + case "A1" : + return 1; + case "A2" : + return 2; + case "A3" : + return 3; + case "A4" : + return 4; + case "A5" : + return 5; + case "A6" : + return 6; + case "A7" : + return 7; + case "A8" : + return 8; + case "A9" : + return 9; + case "A10" : + return 10; + case "A11" : + return 11; + case "A12" : + return 12; + case "A13" : + return 13; + case "A14" : + return 14; + case "A15" : + return 15; + case "A16" : + return 16; + case "A17" : + return 17; + case "A18" : + return 18; + case "A19" : + return 19; + case "A20" : + return 20; + case "A21" : + return 21; + case "A22" : + return 22; + case "A23" : + return 23; + case "A24" : + return 24; + case "A25" : + return 25; + case "A26" : + return 26; + case "A27" : + return 27; + case "A28" : + return 28; + case "A29" : + return 29; + case "A30" : + return 30; + case "A31" : + return 31; + case "A32" : + return 32; + case "A33" : + return 33; + case "A34" : + return 34; + case "A35" : + return 35; + case "A36" : + return 36; + case "A37" : + return 37; + case "A38" : + return 38; + case "A39" : + return 39; + case "A40" : + return 40; + case "A41" : + return 41; + case "A42" : + return 42; + case "A43" : + return 43; + case "A44" : + return 44; + case "A45" : + return 45; + case "A46" : + return 46; + case "A47" : + return 47; + case "A48" : + return 48; + case "A49" : + return 49; + case "A50" : + return 50; + case "A51" : + return 51; + case "A52" : + return 52; + case "A53" : + return 53; + case "A54" : + return 54; + case "A55" : + return 55; + case "A56" : + return 56; + case "A57" : + return 57; + case "A58" : + return 58; + case "A59" : + return 59; + case "A60" : + return 60; + case "A61" : + return 61; + case "A62" : + return 62; + case "A63" : + return 63; + case "A64" : + return 64; + case "A65" : + return 65; + case "A66" : + return 66; + case "A67" : + return 67; + case "A68" : + return 68; + case "A69" : + return 69; + case "A70" : + return 70; + case "A71" : + return 71; + case "A72" : + return 72; + case "A73" : + return 73; + case "A74" : + return 74; + case "A75" : + return 75; + case "A76" : + return 76; + case "A77" : + return 77; + case "A78" : + return 78; + case "A79" : + return 79; + case "A80" : + return 80; + case "A81" : + return 81; + case "A82" : + return 82; + case "A83" : + return 83; + case "A84" : + return 84; + case "A85" : + return 85; + case "A86" : + return 86; + case "A87" : + return 87; + case "A88" : + return 88; + case "A89" : + return 89; + case "A90" : + return 90; + case "A91" : + return 91; + case "A92" : + return 92; + case "A93" : + return 93; + case "A94" : + return 94; + case "A95" : + return 95; + case "A96" : + return 96; + case "A97" : + return 97; + case "A98" : + return 98; + case "A99" : + return 99; + case "A100" : + return 100; + case "A101" : + return 101; + case "A102" : + return 102; + case "A103" : + return 103; + case "A104" : + return 104; + case "A105" : + return 105; + case "A106" : + return 106; + case "A107" : + return 107; + case "A108" : + return 108; + case "A109" : + return 109; + case "A110" : + return 110; + case "A111" : + return 111; + case "A112" : + return 112; + case "A113" : + return 113; + case "A114" : + return 114; + case "A115" : + return 115; + case "A116" : + return 116; + case "A117" : + return 117; + case "A118" : + return 118; + case "A119" : + return 119; + case "A120" : + return 120; + case "A121" : + return 121; + case "A122" : + return 122; + case "A123" : + return 123; + case "A124" : + return 124; + case "A125" : + return 125; + case "A126" : + return 126; + case "A127" : + return 127; + case "A128" : + return 128; + case "A129" : + return 129; + case "A130" : + return 130; + case "A131" : + return 131; + case "A132" : + return 132; + case "A133" : + return 133; + case "A134" : + return 134; + case "A135" : + return 135; + case "A136" : + return 136; + case "A137" : + return 137; + case "A138" : + return 138; + case "A139" : + return 139; + case "A140" : + return 140; + case "A141" : + return 141; + case "A142" : + return 142; + case "A143" : + return 143; + case "A144" : + return 144; + case "A145" : + return 145; + case "A146" : + return 146; + case "A147" : + return 147; + case "A148" : + return 148; + case "A149" : + return 149; + case "A150" : + return 150; + case "A151" : + return 151; + case "A152" : + return 152; + case "A153" : + return 153; + case "A154" : + return 154; + case "A155" : + return 155; + case "A156" : + return 156; + case "A157" : + return 157; + case "A158" : + return 158; + case "A159" : + return 159; + case "A160" : + return 160; + case "A161" : + return 161; + case "A162" : + return 162; + case "A163" : + return 163; + case "A164" : + return 164; + case "A165" : + return 165; + case "A166" : + return 166; + case "A167" : + return 167; + case "A168" : + return 168; + case "A169" : + return 169; + case "A170" : + return 170; + case "A171" : + return 171; + case "A172" : + return 172; + case "A173" : + return 173; + case "A174" : + return 174; + case "A175" : + return 175; + case "A176" : + return 176; + case "A177" : + return 177; + case "A178" : + return 178; + case "A179" : + return 179; + case "A180" : + return 180; + case "A181" : + return 181; + case "A182" : + return 182; + case "A183" : + return 183; + case "A184" : + return 184; + case "A185" : + return 185; + case "A186" : + return 186; + case "A187" : + return 187; + case "A188" : + return 188; + case "A189" : + return 189; + case "A190" : + return 190; + case "A191" : + return 191; + case "A192" : + return 192; + case "A193" : + return 193; + case "A194" : + return 194; + case "A195" : + return 195; + case "A196" : + return 196; + case "A197" : + return 197; + case "A198" : + return 198; + case "A199" : + return 199; + case "A200" : + return 200; + case "A201" : + return 201; + case "A202" : + return 202; + case "A203" : + return 203; + case "A204" : + return 204; + case "A205" : + return 205; + case "A206" : + return 206; + case "A207" : + return 207; + case "A208" : + return 208; + case "A209" : + return 209; + case "A210" : + return 210; + case "A211" : + return 211; + case "A212" : + return 212; + case "A213" : + return 213; + case "A214" : + return 214; + case "A215" : + return 215; + case "A216" : + return 216; + case "A217" : + return 217; + case "A218" : + return 218; + case "A219" : + return 219; + case "A220" : + return 220; + case "A221" : + return 221; + case "A222" : + return 222; + case "A223" : + return 223; + case "A224" : + return 224; + case "A225" : + return 225; + case "A226" : + return 226; + case "A227" : + return 227; + case "A228" : + return 228; + case "A229" : + return 229; + case "A230" : + return 230; + case "A231" : + return 231; + case "A232" : + return 232; + case "A233" : + return 233; + case "A234" : + return 234; + case "A235" : + return 235; + case "A236" : + return 236; + case "A237" : + return 237; + case "A238" : + return 238; + case "A239" : + return 239; + case "A240" : + return 240; + case "A241" : + return 241; + case "A242" : + return 242; + case "A243" : + return 243; + case "A244" : + return 244; + case "A245" : + return 245; + case "A246" : + return 246; + case "A247" : + return 247; + case "A248" : + return 248; + case "A249" : + return 249; + case "A250" : + return 250; + case "A251" : + return 251; + case "A252" : + return 252; + case "A253" : + return 253; + case "A254" : + return 254; + case "A255" : + return 255; + case "A256" : + return 256; + case "A257" : + return 257; + case "A258" : + return 258; + case "A259" : + return 259; + case "A260" : + return 260; + case "A261" : + return 261; + case "A262" : + return 262; + case "A263" : + return 263; + case "A264" : + return 264; + case "A265" : + return 265; + case "A266" : + return 266; + case "A267" : + return 267; + case "A268" : + return 268; + case "A269" : + return 269; + case "A270" : + return 270; + case "A271" : + return 271; + case "A272" : + return 272; + case "A273" : + return 273; + case "A274" : + return 274; + case "A275" : + return 275; + case "A276" : + return 276; + case "A277" : + return 277; + case "A278" : + return 278; + case "A279" : + return 279; + case "A280" : + return 280; + case "A281" : + return 281; + case "A282" : + return 282; + case "A283" : + return 283; + case "A284" : + return 284; + case "A285" : + return 285; + case "A286" : + return 286; + case "A287" : + return 287; + case "A288" : + return 288; + case "A289" : + return 289; + case "A290" : + return 290; + case "A291" : + return 291; + case "A292" : + return 292; + case "A293" : + return 293; + case "A294" : + return 294; + case "A295" : + return 295; + case "A296" : + return 296; + case "A297" : + return 297; + case "A298" : + return 298; + case "A299" : + return 299; + } +} + +function to_string(x) { + switch (x) { + case "A0" : + return "A0"; + case "A1" : + return "A1"; + case "A2" : + return "A2"; + case "A3" : + return "A3"; + case "A4" : + return "A4"; + case "A5" : + return "A5"; + case "A6" : + return "A6"; + case "A7" : + return "A7"; + case "A8" : + return "A8"; + case "A9" : + return "A9"; + case "A10" : + return "A10"; + case "A11" : + return "A11"; + case "A12" : + return "A12"; + case "A13" : + return "A13"; + case "A14" : + return "A14"; + case "A15" : + return "A15"; + case "A16" : + return "A16"; + case "A17" : + return "A17"; + case "A18" : + return "A18"; + case "A19" : + return "A19"; + case "A20" : + return "A20"; + case "A21" : + return "A21"; + case "A22" : + return "A22"; + case "A23" : + return "A23"; + case "A24" : + return "A24"; + case "A25" : + return "A25"; + case "A26" : + return "A26"; + case "A27" : + return "A27"; + case "A28" : + return "A28"; + case "A29" : + return "A29"; + case "A30" : + return "A30"; + case "A31" : + return "A31"; + case "A32" : + return "A32"; + case "A33" : + return "A33"; + case "A34" : + return "A34"; + case "A35" : + return "A35"; + case "A36" : + return "A36"; + case "A37" : + return "A37"; + case "A38" : + return "A38"; + case "A39" : + return "A39"; + case "A40" : + return "A40"; + case "A41" : + return "A41"; + case "A42" : + return "A42"; + case "A43" : + return "A43"; + case "A44" : + return "A44"; + case "A45" : + return "A45"; + case "A46" : + return "A46"; + case "A47" : + return "A47"; + case "A48" : + return "A48"; + case "A49" : + return "A49"; + case "A50" : + return "A50"; + case "A51" : + return "A51"; + case "A52" : + return "A52"; + case "A53" : + return "A53"; + case "A54" : + return "A54"; + case "A55" : + return "A55"; + case "A56" : + return "A56"; + case "A57" : + return "A57"; + case "A58" : + return "A58"; + case "A59" : + return "A59"; + case "A60" : + return "A60"; + case "A61" : + return "A61"; + case "A62" : + return "A62"; + case "A63" : + return "A63"; + case "A64" : + return "A64"; + case "A65" : + return "A65"; + case "A66" : + return "A66"; + case "A67" : + return "A67"; + case "A68" : + return "A68"; + case "A69" : + return "A69"; + case "A70" : + return "A70"; + case "A71" : + return "A71"; + case "A72" : + return "A72"; + case "A73" : + return "A73"; + case "A74" : + return "A74"; + case "A75" : + return "A75"; + case "A76" : + return "A76"; + case "A77" : + return "A77"; + case "A78" : + return "A78"; + case "A79" : + return "A79"; + case "A80" : + return "A80"; + case "A81" : + return "A81"; + case "A82" : + return "A82"; + case "A83" : + return "A83"; + case "A84" : + return "A84"; + case "A85" : + return "A85"; + case "A86" : + return "A86"; + case "A87" : + return "A87"; + case "A88" : + return "A88"; + case "A89" : + return "A89"; + case "A90" : + return "A90"; + case "A91" : + return "A91"; + case "A92" : + return "A92"; + case "A93" : + return "A93"; + case "A94" : + return "A94"; + case "A95" : + return "A95"; + case "A96" : + return "A96"; + case "A97" : + return "A97"; + case "A98" : + return "A98"; + case "A99" : + return "A99"; + case "A100" : + return "A100"; + case "A101" : + return "A101"; + case "A102" : + return "A102"; + case "A103" : + return "A103"; + case "A104" : + return "A104"; + case "A105" : + return "A105"; + case "A106" : + return "A106"; + case "A107" : + return "A107"; + case "A108" : + return "A108"; + case "A109" : + return "A109"; + case "A110" : + return "A110"; + case "A111" : + return "A111"; + case "A112" : + return "A112"; + case "A113" : + return "A113"; + case "A114" : + return "A114"; + case "A115" : + return "A115"; + case "A116" : + return "A116"; + case "A117" : + return "A117"; + case "A118" : + return "A118"; + case "A119" : + return "A119"; + case "A120" : + return "A120"; + case "A121" : + return "A121"; + case "A122" : + return "A122"; + case "A123" : + return "A123"; + case "A124" : + return "A124"; + case "A125" : + return "A125"; + case "A126" : + return "A126"; + case "A127" : + return "A127"; + case "A128" : + return "A128"; + case "A129" : + return "A129"; + case "A130" : + return "A130"; + case "A131" : + return "A131"; + case "A132" : + return "A132"; + case "A133" : + return "A133"; + case "A134" : + return "A134"; + case "A135" : + return "A135"; + case "A136" : + return "A136"; + case "A137" : + return "A137"; + case "A138" : + return "A138"; + case "A139" : + return "A139"; + case "A140" : + return "A140"; + case "A141" : + return "A141"; + case "A142" : + return "A142"; + case "A143" : + return "A143"; + case "A144" : + return "A144"; + case "A145" : + return "A145"; + case "A146" : + return "A146"; + case "A147" : + return "A147"; + case "A148" : + return "A148"; + case "A149" : + return "A149"; + case "A150" : + return "A150"; + case "A151" : + return "A151"; + case "A152" : + return "A152"; + case "A153" : + return "A153"; + case "A154" : + return "A154"; + case "A155" : + return "A155"; + case "A156" : + return "A156"; + case "A157" : + return "A157"; + case "A158" : + return "A158"; + case "A159" : + return "A159"; + case "A160" : + return "A160"; + case "A161" : + return "A161"; + case "A162" : + return "A162"; + case "A163" : + return "A163"; + case "A164" : + return "A164"; + case "A165" : + return "A165"; + case "A166" : + return "A166"; + case "A167" : + return "A167"; + case "A168" : + return "A168"; + case "A169" : + return "A169"; + case "A170" : + return "A170"; + case "A171" : + return "A171"; + case "A172" : + return "A172"; + case "A173" : + return "A173"; + case "A174" : + return "A174"; + case "A175" : + return "A175"; + case "A176" : + return "A176"; + case "A177" : + return "A177"; + case "A178" : + return "A178"; + case "A179" : + return "A179"; + case "A180" : + return "A180"; + case "A181" : + return "A181"; + case "A182" : + return "A182"; + case "A183" : + return "A183"; + case "A184" : + return "A184"; + case "A185" : + return "A185"; + case "A186" : + return "A186"; + case "A187" : + return "A187"; + case "A188" : + return "A188"; + case "A189" : + return "A189"; + case "A190" : + return "A190"; + case "A191" : + return "A191"; + case "A192" : + return "A192"; + case "A193" : + return "A193"; + case "A194" : + return "A194"; + case "A195" : + return "A195"; + case "A196" : + return "A196"; + case "A197" : + return "A197"; + case "A198" : + return "A198"; + case "A199" : + return "A199"; + case "A200" : + return "A200"; + case "A201" : + return "A201"; + case "A202" : + return "A202"; + case "A203" : + return "A203"; + case "A204" : + return "A204"; + case "A205" : + return "A205"; + case "A206" : + return "A206"; + case "A207" : + return "A207"; + case "A208" : + return "A208"; + case "A209" : + return "A209"; + case "A210" : + return "A210"; + case "A211" : + return "A211"; + case "A212" : + return "A212"; + case "A213" : + return "A213"; + case "A214" : + return "A214"; + case "A215" : + return "A215"; + case "A216" : + return "A216"; + case "A217" : + return "A217"; + case "A218" : + return "A218"; + case "A219" : + return "A219"; + case "A220" : + return "A220"; + case "A221" : + return "A221"; + case "A222" : + return "A222"; + case "A223" : + return "A223"; + case "A224" : + return "A224"; + case "A225" : + return "A225"; + case "A226" : + return "A226"; + case "A227" : + return "A227"; + case "A228" : + return "A228"; + case "A229" : + return "A229"; + case "A230" : + return "A230"; + case "A231" : + return "A231"; + case "A232" : + return "A232"; + case "A233" : + return "A233"; + case "A234" : + return "A234"; + case "A235" : + return "A235"; + case "A236" : + return "A236"; + case "A237" : + return "A237"; + case "A238" : + return "A238"; + case "A239" : + return "A239"; + case "A240" : + return "A240"; + case "A241" : + return "A241"; + case "A242" : + return "A242"; + case "A243" : + return "A243"; + case "A244" : + return "A244"; + case "A245" : + return "A245"; + case "A246" : + return "A246"; + case "A247" : + return "A247"; + case "A248" : + return "A248"; + case "A249" : + return "A249"; + case "A250" : + return "A250"; + case "A251" : + return "A251"; + case "A252" : + return "A252"; + case "A253" : + return "A253"; + case "A254" : + return "A254"; + case "A255" : + return "A255"; + case "A256" : + return "A256"; + case "A257" : + return "A257"; + case "A258" : + return "A258"; + case "A259" : + return "A259"; + case "A260" : + return "A260"; + case "A261" : + return "A261"; + case "A262" : + return "A262"; + case "A263" : + return "A263"; + case "A264" : + return "A264"; + case "A265" : + return "A265"; + case "A266" : + return "A266"; + case "A267" : + return "A267"; + case "A268" : + return "A268"; + case "A269" : + return "A269"; + case "A270" : + return "A270"; + case "A271" : + return "A271"; + case "A272" : + return "A272"; + case "A273" : + return "A273"; + case "A274" : + return "A274"; + case "A275" : + return "A275"; + case "A276" : + return "A276"; + case "A277" : + return "A277"; + case "A278" : + return "A278"; + case "A279" : + return "A279"; + case "A280" : + return "A280"; + case "A281" : + return "A281"; + case "A282" : + return "A282"; + case "A283" : + return "A283"; + case "A284" : + return "A284"; + case "A285" : + return "A285"; + case "A286" : + return "A286"; + case "A287" : + return "A287"; + case "A288" : + return "A288"; + case "A289" : + return "A289"; + case "A290" : + return "A290"; + case "A291" : + return "A291"; + case "A292" : + return "A292"; + case "A293" : + return "A293"; + case "A294" : + return "A294"; + case "A295" : + return "A295"; + case "A296" : + return "A296"; + case "A297" : + return "A297"; + case "A298" : + return "A298"; + case "A299" : + return "A299"; + } +} + +export { + to_enum, + to_string, +} +/* No side effect */ diff --git a/tests/tests/src/big_polyvar_test.js b/tests/tests/src/big_polyvar_test.js deleted file mode 100644 index 20c276f20f..0000000000 --- a/tests/tests/src/big_polyvar_test.js +++ /dev/null @@ -1,7242 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let _map = {"variant0":"variant0","variant1":"variant1","variant2":"variant2","variant3":"variant3","variant4":"variant4","variant5":"variant5","variant6":"variant6","variant7":"variant7","variant8":"variant8","variant9":"variant9","variant10":"variant10","variant11":"variant11","variant12":"variant12","variant13":"variant13","variant14":"variant14","variant15":"variant15","variant16":"variant16","variant17":"variant17","variant18":"variant18","variant19":"variant19","variant20":"variant20","variant21":"variant21","variant22":"variant22","variant23":"variant23","variant24":"variant24","variant25":"variant25","variant26":"variant26","variant27":"variant27","variant28":"variant28","variant29":"variant29","variant30":"variant30","variant31":"variant31","variant32":"variant32","variant33":"variant33","variant34":"variant34","variant35":"variant35","variant36":"variant36","variant37":"variant37","variant38":"variant38","variant39":"variant39","variant40":"variant40","variant41":"variant41","variant42":"variant42","variant43":"variant43","variant44":"variant44","variant45":"variant45","variant46":"variant46","variant47":"variant47","variant48":"variant48","variant49":"variant49","variant50":"variant50","variant51":"variant51","variant52":"variant52","variant53":"variant53","variant54":"variant54","variant55":"variant55","variant56":"variant56","variant57":"variant57","variant58":"variant58","variant59":"variant59","variant60":"variant60","variant61":"variant61","variant62":"variant62","variant63":"variant63","variant64":"variant64","variant65":"variant65","variant66":"variant66","variant67":"variant67","variant68":"variant68","variant69":"variant69","variant70":"variant70","variant71":"variant71","variant72":"variant72","variant73":"variant73","variant74":"variant74","variant75":"variant75","variant76":"variant76","variant77":"variant77","variant78":"variant78","variant79":"variant79","variant80":"variant80","variant81":"variant81","variant82":"variant82","variant83":"variant83","variant84":"variant84","variant85":"variant85","variant86":"variant86","variant87":"variant87","variant88":"variant88","variant89":"variant89","variant90":"variant90","variant91":"variant91","variant92":"variant92","variant93":"variant93","variant94":"variant94","variant95":"variant95","variant96":"variant96","variant97":"variant97","variant98":"variant98","variant99":"variant99","variant100":"variant100","variant101":"variant101","variant102":"variant102","variant103":"variant103","variant104":"variant104","variant105":"variant105","variant106":"variant106","variant107":"variant107","variant108":"variant108","variant109":"variant109","variant110":"variant110","variant111":"variant111","variant112":"variant112","variant113":"variant113","variant114":"variant114","variant115":"variant115","variant116":"variant116","variant117":"variant117","variant118":"variant118","variant119":"variant119","variant120":"variant120","variant121":"variant121","variant122":"variant122","variant123":"variant123","variant124":"variant124","variant125":"variant125","variant126":"variant126","variant127":"variant127","variant128":"variant128","variant129":"variant129","variant130":"variant130","variant131":"variant131","variant132":"variant132","variant133":"variant133","variant134":"variant134","variant135":"variant135","variant136":"variant136","variant137":"variant137","variant138":"variant138","variant139":"variant139","variant140":"variant140","variant141":"variant141","variant142":"variant142","variant143":"variant143","variant144":"variant144","variant145":"variant145","variant146":"variant146","variant147":"variant147","variant148":"variant148","variant149":"variant149","variant150":"variant150","variant151":"variant151","variant152":"variant152","variant153":"variant153","variant154":"variant154","variant155":"variant155","variant156":"variant156","variant157":"variant157","variant158":"variant158","variant159":"variant159","variant160":"variant160","variant161":"variant161","variant162":"variant162","variant163":"variant163","variant164":"variant164","variant165":"variant165","variant166":"variant166","variant167":"variant167","variant168":"variant168","variant169":"variant169","variant170":"variant170","variant171":"variant171","variant172":"variant172","variant173":"variant173","variant174":"variant174","variant175":"variant175","variant176":"variant176","variant177":"variant177","variant178":"variant178","variant179":"variant179","variant180":"variant180","variant181":"variant181","variant182":"variant182","variant183":"variant183","variant184":"variant184","variant185":"variant185","variant186":"variant186","variant187":"variant187","variant188":"variant188","variant189":"variant189","variant190":"variant190","variant191":"variant191","variant192":"variant192","variant193":"variant193","variant194":"variant194","variant195":"variant195","variant196":"variant196","variant197":"variant197","variant198":"variant198","variant199":"variant199","variant200":"variant200","variant201":"variant201","variant202":"variant202","variant203":"variant203","variant204":"variant204","variant205":"variant205","variant206":"variant206","variant207":"variant207","variant208":"variant208","variant209":"variant209","variant210":"variant210","variant211":"variant211","variant212":"variant212","variant213":"variant213","variant214":"variant214","variant215":"variant215","variant216":"variant216","variant217":"variant217","variant218":"variant218","variant219":"variant219","variant220":"variant220","variant221":"variant221","variant222":"variant222","variant223":"variant223","variant224":"variant224","variant225":"variant225","variant226":"variant226","variant227":"variant227","variant228":"variant228","variant229":"variant229","variant230":"variant230","variant231":"variant231","variant232":"variant232","variant233":"variant233","variant234":"variant234","variant235":"variant235","variant236":"variant236","variant237":"variant237","variant238":"variant238","variant239":"variant239","variant240":"variant240","variant241":"variant241","variant242":"variant242","variant243":"variant243","variant244":"variant244","variant245":"variant245","variant246":"variant246","variant247":"variant247","variant248":"variant248","variant249":"variant249","variant250":"variant250","variant251":"variant251","variant252":"variant252","variant253":"variant253","variant254":"variant254","variant255":"variant255","variant256":"variant256","variant257":"variant257","variant258":"variant258","variant259":"variant259","variant260":"variant260","variant261":"variant261","variant262":"variant262","variant263":"variant263","variant264":"variant264","variant265":"variant265","variant266":"variant266","variant267":"variant267","variant268":"variant268","variant269":"variant269","variant270":"variant270","variant271":"variant271","variant272":"variant272","variant273":"variant273","variant274":"variant274","variant275":"variant275","variant276":"variant276","variant277":"variant277","variant278":"variant278","variant279":"variant279","variant280":"variant280","variant281":"variant281","variant282":"variant282","variant283":"variant283","variant284":"variant284","variant285":"variant285","variant286":"variant286","variant287":"variant287","variant288":"variant288","variant289":"variant289","variant290":"variant290","variant291":"variant291","variant292":"variant292","variant293":"variant293","variant294":"variant294","variant295":"variant295","variant296":"variant296","variant297":"variant297","variant298":"variant298","variant299":"variant299"}; - -function tToJs(param) { - return param; -} - -function tFromJs(param) { - return _map[param]; -} - -function eq(x, y) { - if (x !== undefined) { - if (y !== undefined) { - return x === y; - } else { - return false; - } - } else { - return y === undefined; - } -} - -if ("variant0" !== "variant0") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 314, - 0 - ], - Error: new Error() - }; -} - -if ("variant1" !== "variant1") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 315, - 0 - ], - Error: new Error() - }; -} - -if ("variant2" !== "variant2") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 316, - 0 - ], - Error: new Error() - }; -} - -if ("variant3" !== "variant3") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 317, - 0 - ], - Error: new Error() - }; -} - -if ("variant4" !== "variant4") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 318, - 0 - ], - Error: new Error() - }; -} - -if ("variant5" !== "variant5") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 319, - 0 - ], - Error: new Error() - }; -} - -if ("variant6" !== "variant6") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 320, - 0 - ], - Error: new Error() - }; -} - -if ("variant7" !== "variant7") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 321, - 0 - ], - Error: new Error() - }; -} - -if ("variant8" !== "variant8") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 322, - 0 - ], - Error: new Error() - }; -} - -if ("variant9" !== "variant9") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 323, - 0 - ], - Error: new Error() - }; -} - -if ("variant10" !== "variant10") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 324, - 0 - ], - Error: new Error() - }; -} - -if ("variant11" !== "variant11") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 325, - 0 - ], - Error: new Error() - }; -} - -if ("variant12" !== "variant12") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 326, - 0 - ], - Error: new Error() - }; -} - -if ("variant13" !== "variant13") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 327, - 0 - ], - Error: new Error() - }; -} - -if ("variant14" !== "variant14") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 328, - 0 - ], - Error: new Error() - }; -} - -if ("variant15" !== "variant15") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 329, - 0 - ], - Error: new Error() - }; -} - -if ("variant16" !== "variant16") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 330, - 0 - ], - Error: new Error() - }; -} - -if ("variant17" !== "variant17") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 331, - 0 - ], - Error: new Error() - }; -} - -if ("variant18" !== "variant18") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 332, - 0 - ], - Error: new Error() - }; -} - -if ("variant19" !== "variant19") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 333, - 0 - ], - Error: new Error() - }; -} - -if ("variant20" !== "variant20") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 334, - 0 - ], - Error: new Error() - }; -} - -if ("variant21" !== "variant21") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 335, - 0 - ], - Error: new Error() - }; -} - -if ("variant22" !== "variant22") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 336, - 0 - ], - Error: new Error() - }; -} - -if ("variant23" !== "variant23") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 337, - 0 - ], - Error: new Error() - }; -} - -if ("variant24" !== "variant24") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 338, - 0 - ], - Error: new Error() - }; -} - -if ("variant25" !== "variant25") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 339, - 0 - ], - Error: new Error() - }; -} - -if ("variant26" !== "variant26") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 340, - 0 - ], - Error: new Error() - }; -} - -if ("variant27" !== "variant27") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 341, - 0 - ], - Error: new Error() - }; -} - -if ("variant28" !== "variant28") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 342, - 0 - ], - Error: new Error() - }; -} - -if ("variant29" !== "variant29") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 343, - 0 - ], - Error: new Error() - }; -} - -if ("variant30" !== "variant30") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 344, - 0 - ], - Error: new Error() - }; -} - -if ("variant31" !== "variant31") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 345, - 0 - ], - Error: new Error() - }; -} - -if ("variant32" !== "variant32") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 346, - 0 - ], - Error: new Error() - }; -} - -if ("variant33" !== "variant33") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 347, - 0 - ], - Error: new Error() - }; -} - -if ("variant34" !== "variant34") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 348, - 0 - ], - Error: new Error() - }; -} - -if ("variant35" !== "variant35") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 349, - 0 - ], - Error: new Error() - }; -} - -if ("variant36" !== "variant36") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 350, - 0 - ], - Error: new Error() - }; -} - -if ("variant37" !== "variant37") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 351, - 0 - ], - Error: new Error() - }; -} - -if ("variant38" !== "variant38") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 352, - 0 - ], - Error: new Error() - }; -} - -if ("variant39" !== "variant39") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 353, - 0 - ], - Error: new Error() - }; -} - -if ("variant40" !== "variant40") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 354, - 0 - ], - Error: new Error() - }; -} - -if ("variant41" !== "variant41") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 355, - 0 - ], - Error: new Error() - }; -} - -if ("variant42" !== "variant42") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 356, - 0 - ], - Error: new Error() - }; -} - -if ("variant43" !== "variant43") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 357, - 0 - ], - Error: new Error() - }; -} - -if ("variant44" !== "variant44") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 358, - 0 - ], - Error: new Error() - }; -} - -if ("variant45" !== "variant45") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 359, - 0 - ], - Error: new Error() - }; -} - -if ("variant46" !== "variant46") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 360, - 0 - ], - Error: new Error() - }; -} - -if ("variant47" !== "variant47") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 361, - 0 - ], - Error: new Error() - }; -} - -if ("variant48" !== "variant48") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 362, - 0 - ], - Error: new Error() - }; -} - -if ("variant49" !== "variant49") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 363, - 0 - ], - Error: new Error() - }; -} - -if ("variant50" !== "variant50") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 364, - 0 - ], - Error: new Error() - }; -} - -if ("variant51" !== "variant51") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 365, - 0 - ], - Error: new Error() - }; -} - -if ("variant52" !== "variant52") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 366, - 0 - ], - Error: new Error() - }; -} - -if ("variant53" !== "variant53") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 367, - 0 - ], - Error: new Error() - }; -} - -if ("variant54" !== "variant54") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 368, - 0 - ], - Error: new Error() - }; -} - -if ("variant55" !== "variant55") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 369, - 0 - ], - Error: new Error() - }; -} - -if ("variant56" !== "variant56") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 370, - 0 - ], - Error: new Error() - }; -} - -if ("variant57" !== "variant57") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 371, - 0 - ], - Error: new Error() - }; -} - -if ("variant58" !== "variant58") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 372, - 0 - ], - Error: new Error() - }; -} - -if ("variant59" !== "variant59") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 373, - 0 - ], - Error: new Error() - }; -} - -if ("variant60" !== "variant60") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 374, - 0 - ], - Error: new Error() - }; -} - -if ("variant61" !== "variant61") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 375, - 0 - ], - Error: new Error() - }; -} - -if ("variant62" !== "variant62") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 376, - 0 - ], - Error: new Error() - }; -} - -if ("variant63" !== "variant63") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 377, - 0 - ], - Error: new Error() - }; -} - -if ("variant64" !== "variant64") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 378, - 0 - ], - Error: new Error() - }; -} - -if ("variant65" !== "variant65") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 379, - 0 - ], - Error: new Error() - }; -} - -if ("variant66" !== "variant66") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 380, - 0 - ], - Error: new Error() - }; -} - -if ("variant67" !== "variant67") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 381, - 0 - ], - Error: new Error() - }; -} - -if ("variant68" !== "variant68") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 382, - 0 - ], - Error: new Error() - }; -} - -if ("variant69" !== "variant69") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 383, - 0 - ], - Error: new Error() - }; -} - -if ("variant70" !== "variant70") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 384, - 0 - ], - Error: new Error() - }; -} - -if ("variant71" !== "variant71") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 385, - 0 - ], - Error: new Error() - }; -} - -if ("variant72" !== "variant72") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 386, - 0 - ], - Error: new Error() - }; -} - -if ("variant73" !== "variant73") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 387, - 0 - ], - Error: new Error() - }; -} - -if ("variant74" !== "variant74") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 388, - 0 - ], - Error: new Error() - }; -} - -if ("variant75" !== "variant75") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 389, - 0 - ], - Error: new Error() - }; -} - -if ("variant76" !== "variant76") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 390, - 0 - ], - Error: new Error() - }; -} - -if ("variant77" !== "variant77") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 391, - 0 - ], - Error: new Error() - }; -} - -if ("variant78" !== "variant78") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 392, - 0 - ], - Error: new Error() - }; -} - -if ("variant79" !== "variant79") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 393, - 0 - ], - Error: new Error() - }; -} - -if ("variant80" !== "variant80") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 394, - 0 - ], - Error: new Error() - }; -} - -if ("variant81" !== "variant81") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 395, - 0 - ], - Error: new Error() - }; -} - -if ("variant82" !== "variant82") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 396, - 0 - ], - Error: new Error() - }; -} - -if ("variant83" !== "variant83") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 397, - 0 - ], - Error: new Error() - }; -} - -if ("variant84" !== "variant84") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 398, - 0 - ], - Error: new Error() - }; -} - -if ("variant85" !== "variant85") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 399, - 0 - ], - Error: new Error() - }; -} - -if ("variant86" !== "variant86") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 400, - 0 - ], - Error: new Error() - }; -} - -if ("variant87" !== "variant87") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 401, - 0 - ], - Error: new Error() - }; -} - -if ("variant88" !== "variant88") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 402, - 0 - ], - Error: new Error() - }; -} - -if ("variant89" !== "variant89") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 403, - 0 - ], - Error: new Error() - }; -} - -if ("variant90" !== "variant90") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 404, - 0 - ], - Error: new Error() - }; -} - -if ("variant91" !== "variant91") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 405, - 0 - ], - Error: new Error() - }; -} - -if ("variant92" !== "variant92") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 406, - 0 - ], - Error: new Error() - }; -} - -if ("variant93" !== "variant93") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 407, - 0 - ], - Error: new Error() - }; -} - -if ("variant94" !== "variant94") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 408, - 0 - ], - Error: new Error() - }; -} - -if ("variant95" !== "variant95") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 409, - 0 - ], - Error: new Error() - }; -} - -if ("variant96" !== "variant96") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 410, - 0 - ], - Error: new Error() - }; -} - -if ("variant97" !== "variant97") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 411, - 0 - ], - Error: new Error() - }; -} - -if ("variant98" !== "variant98") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 412, - 0 - ], - Error: new Error() - }; -} - -if ("variant99" !== "variant99") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 413, - 0 - ], - Error: new Error() - }; -} - -if ("variant100" !== "variant100") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 414, - 0 - ], - Error: new Error() - }; -} - -if ("variant101" !== "variant101") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 415, - 0 - ], - Error: new Error() - }; -} - -if ("variant102" !== "variant102") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 416, - 0 - ], - Error: new Error() - }; -} - -if ("variant103" !== "variant103") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 417, - 0 - ], - Error: new Error() - }; -} - -if ("variant104" !== "variant104") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 418, - 0 - ], - Error: new Error() - }; -} - -if ("variant105" !== "variant105") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 419, - 0 - ], - Error: new Error() - }; -} - -if ("variant106" !== "variant106") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 420, - 0 - ], - Error: new Error() - }; -} - -if ("variant107" !== "variant107") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 421, - 0 - ], - Error: new Error() - }; -} - -if ("variant108" !== "variant108") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 422, - 0 - ], - Error: new Error() - }; -} - -if ("variant109" !== "variant109") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 423, - 0 - ], - Error: new Error() - }; -} - -if ("variant110" !== "variant110") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 424, - 0 - ], - Error: new Error() - }; -} - -if ("variant111" !== "variant111") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 425, - 0 - ], - Error: new Error() - }; -} - -if ("variant112" !== "variant112") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 426, - 0 - ], - Error: new Error() - }; -} - -if ("variant113" !== "variant113") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 427, - 0 - ], - Error: new Error() - }; -} - -if ("variant114" !== "variant114") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 428, - 0 - ], - Error: new Error() - }; -} - -if ("variant115" !== "variant115") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 429, - 0 - ], - Error: new Error() - }; -} - -if ("variant116" !== "variant116") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 430, - 0 - ], - Error: new Error() - }; -} - -if ("variant117" !== "variant117") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 431, - 0 - ], - Error: new Error() - }; -} - -if ("variant118" !== "variant118") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 432, - 0 - ], - Error: new Error() - }; -} - -if ("variant119" !== "variant119") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 433, - 0 - ], - Error: new Error() - }; -} - -if ("variant120" !== "variant120") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 434, - 0 - ], - Error: new Error() - }; -} - -if ("variant121" !== "variant121") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 435, - 0 - ], - Error: new Error() - }; -} - -if ("variant122" !== "variant122") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 436, - 0 - ], - Error: new Error() - }; -} - -if ("variant123" !== "variant123") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 437, - 0 - ], - Error: new Error() - }; -} - -if ("variant124" !== "variant124") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 438, - 0 - ], - Error: new Error() - }; -} - -if ("variant125" !== "variant125") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 439, - 0 - ], - Error: new Error() - }; -} - -if ("variant126" !== "variant126") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 440, - 0 - ], - Error: new Error() - }; -} - -if ("variant127" !== "variant127") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 441, - 0 - ], - Error: new Error() - }; -} - -if ("variant128" !== "variant128") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 442, - 0 - ], - Error: new Error() - }; -} - -if ("variant129" !== "variant129") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 443, - 0 - ], - Error: new Error() - }; -} - -if ("variant130" !== "variant130") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 444, - 0 - ], - Error: new Error() - }; -} - -if ("variant131" !== "variant131") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 445, - 0 - ], - Error: new Error() - }; -} - -if ("variant132" !== "variant132") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 446, - 0 - ], - Error: new Error() - }; -} - -if ("variant133" !== "variant133") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 447, - 0 - ], - Error: new Error() - }; -} - -if ("variant134" !== "variant134") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 448, - 0 - ], - Error: new Error() - }; -} - -if ("variant135" !== "variant135") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 449, - 0 - ], - Error: new Error() - }; -} - -if ("variant136" !== "variant136") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 450, - 0 - ], - Error: new Error() - }; -} - -if ("variant137" !== "variant137") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 451, - 0 - ], - Error: new Error() - }; -} - -if ("variant138" !== "variant138") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 452, - 0 - ], - Error: new Error() - }; -} - -if ("variant139" !== "variant139") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 453, - 0 - ], - Error: new Error() - }; -} - -if ("variant140" !== "variant140") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 454, - 0 - ], - Error: new Error() - }; -} - -if ("variant141" !== "variant141") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 455, - 0 - ], - Error: new Error() - }; -} - -if ("variant142" !== "variant142") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 456, - 0 - ], - Error: new Error() - }; -} - -if ("variant143" !== "variant143") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 457, - 0 - ], - Error: new Error() - }; -} - -if ("variant144" !== "variant144") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 458, - 0 - ], - Error: new Error() - }; -} - -if ("variant145" !== "variant145") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 459, - 0 - ], - Error: new Error() - }; -} - -if ("variant146" !== "variant146") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 460, - 0 - ], - Error: new Error() - }; -} - -if ("variant147" !== "variant147") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 461, - 0 - ], - Error: new Error() - }; -} - -if ("variant148" !== "variant148") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 462, - 0 - ], - Error: new Error() - }; -} - -if ("variant149" !== "variant149") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 463, - 0 - ], - Error: new Error() - }; -} - -if ("variant150" !== "variant150") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 464, - 0 - ], - Error: new Error() - }; -} - -if ("variant151" !== "variant151") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 465, - 0 - ], - Error: new Error() - }; -} - -if ("variant152" !== "variant152") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 466, - 0 - ], - Error: new Error() - }; -} - -if ("variant153" !== "variant153") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 467, - 0 - ], - Error: new Error() - }; -} - -if ("variant154" !== "variant154") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 468, - 0 - ], - Error: new Error() - }; -} - -if ("variant155" !== "variant155") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 469, - 0 - ], - Error: new Error() - }; -} - -if ("variant156" !== "variant156") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 470, - 0 - ], - Error: new Error() - }; -} - -if ("variant157" !== "variant157") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 471, - 0 - ], - Error: new Error() - }; -} - -if ("variant158" !== "variant158") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 472, - 0 - ], - Error: new Error() - }; -} - -if ("variant159" !== "variant159") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 473, - 0 - ], - Error: new Error() - }; -} - -if ("variant160" !== "variant160") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 474, - 0 - ], - Error: new Error() - }; -} - -if ("variant161" !== "variant161") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 475, - 0 - ], - Error: new Error() - }; -} - -if ("variant162" !== "variant162") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 476, - 0 - ], - Error: new Error() - }; -} - -if ("variant163" !== "variant163") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 477, - 0 - ], - Error: new Error() - }; -} - -if ("variant164" !== "variant164") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 478, - 0 - ], - Error: new Error() - }; -} - -if ("variant165" !== "variant165") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 479, - 0 - ], - Error: new Error() - }; -} - -if ("variant166" !== "variant166") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 480, - 0 - ], - Error: new Error() - }; -} - -if ("variant167" !== "variant167") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 481, - 0 - ], - Error: new Error() - }; -} - -if ("variant168" !== "variant168") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 482, - 0 - ], - Error: new Error() - }; -} - -if ("variant169" !== "variant169") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 483, - 0 - ], - Error: new Error() - }; -} - -if ("variant170" !== "variant170") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 484, - 0 - ], - Error: new Error() - }; -} - -if ("variant171" !== "variant171") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 485, - 0 - ], - Error: new Error() - }; -} - -if ("variant172" !== "variant172") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 486, - 0 - ], - Error: new Error() - }; -} - -if ("variant173" !== "variant173") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 487, - 0 - ], - Error: new Error() - }; -} - -if ("variant174" !== "variant174") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 488, - 0 - ], - Error: new Error() - }; -} - -if ("variant175" !== "variant175") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 489, - 0 - ], - Error: new Error() - }; -} - -if ("variant176" !== "variant176") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 490, - 0 - ], - Error: new Error() - }; -} - -if ("variant177" !== "variant177") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 491, - 0 - ], - Error: new Error() - }; -} - -if ("variant178" !== "variant178") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 492, - 0 - ], - Error: new Error() - }; -} - -if ("variant179" !== "variant179") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 493, - 0 - ], - Error: new Error() - }; -} - -if ("variant180" !== "variant180") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 494, - 0 - ], - Error: new Error() - }; -} - -if ("variant181" !== "variant181") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 495, - 0 - ], - Error: new Error() - }; -} - -if ("variant182" !== "variant182") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 496, - 0 - ], - Error: new Error() - }; -} - -if ("variant183" !== "variant183") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 497, - 0 - ], - Error: new Error() - }; -} - -if ("variant184" !== "variant184") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 498, - 0 - ], - Error: new Error() - }; -} - -if ("variant185" !== "variant185") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 499, - 0 - ], - Error: new Error() - }; -} - -if ("variant186" !== "variant186") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 500, - 0 - ], - Error: new Error() - }; -} - -if ("variant187" !== "variant187") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 501, - 0 - ], - Error: new Error() - }; -} - -if ("variant188" !== "variant188") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 502, - 0 - ], - Error: new Error() - }; -} - -if ("variant189" !== "variant189") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 503, - 0 - ], - Error: new Error() - }; -} - -if ("variant190" !== "variant190") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 504, - 0 - ], - Error: new Error() - }; -} - -if ("variant191" !== "variant191") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 505, - 0 - ], - Error: new Error() - }; -} - -if ("variant192" !== "variant192") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 506, - 0 - ], - Error: new Error() - }; -} - -if ("variant193" !== "variant193") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 507, - 0 - ], - Error: new Error() - }; -} - -if ("variant194" !== "variant194") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 508, - 0 - ], - Error: new Error() - }; -} - -if ("variant195" !== "variant195") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 509, - 0 - ], - Error: new Error() - }; -} - -if ("variant196" !== "variant196") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 510, - 0 - ], - Error: new Error() - }; -} - -if ("variant197" !== "variant197") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 511, - 0 - ], - Error: new Error() - }; -} - -if ("variant198" !== "variant198") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 512, - 0 - ], - Error: new Error() - }; -} - -if ("variant199" !== "variant199") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 513, - 0 - ], - Error: new Error() - }; -} - -if ("variant200" !== "variant200") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 514, - 0 - ], - Error: new Error() - }; -} - -if ("variant201" !== "variant201") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 515, - 0 - ], - Error: new Error() - }; -} - -if ("variant202" !== "variant202") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 516, - 0 - ], - Error: new Error() - }; -} - -if ("variant203" !== "variant203") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 517, - 0 - ], - Error: new Error() - }; -} - -if ("variant204" !== "variant204") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 518, - 0 - ], - Error: new Error() - }; -} - -if ("variant205" !== "variant205") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 519, - 0 - ], - Error: new Error() - }; -} - -if ("variant206" !== "variant206") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 520, - 0 - ], - Error: new Error() - }; -} - -if ("variant207" !== "variant207") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 521, - 0 - ], - Error: new Error() - }; -} - -if ("variant208" !== "variant208") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 522, - 0 - ], - Error: new Error() - }; -} - -if ("variant209" !== "variant209") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 523, - 0 - ], - Error: new Error() - }; -} - -if ("variant210" !== "variant210") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 524, - 0 - ], - Error: new Error() - }; -} - -if ("variant211" !== "variant211") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 525, - 0 - ], - Error: new Error() - }; -} - -if ("variant212" !== "variant212") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 526, - 0 - ], - Error: new Error() - }; -} - -if ("variant213" !== "variant213") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 527, - 0 - ], - Error: new Error() - }; -} - -if ("variant214" !== "variant214") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 528, - 0 - ], - Error: new Error() - }; -} - -if ("variant215" !== "variant215") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 529, - 0 - ], - Error: new Error() - }; -} - -if ("variant216" !== "variant216") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 530, - 0 - ], - Error: new Error() - }; -} - -if ("variant217" !== "variant217") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 531, - 0 - ], - Error: new Error() - }; -} - -if ("variant218" !== "variant218") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 532, - 0 - ], - Error: new Error() - }; -} - -if ("variant219" !== "variant219") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 533, - 0 - ], - Error: new Error() - }; -} - -if ("variant220" !== "variant220") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 534, - 0 - ], - Error: new Error() - }; -} - -if ("variant221" !== "variant221") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 535, - 0 - ], - Error: new Error() - }; -} - -if ("variant222" !== "variant222") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 536, - 0 - ], - Error: new Error() - }; -} - -if ("variant223" !== "variant223") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 537, - 0 - ], - Error: new Error() - }; -} - -if ("variant224" !== "variant224") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 538, - 0 - ], - Error: new Error() - }; -} - -if ("variant225" !== "variant225") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 539, - 0 - ], - Error: new Error() - }; -} - -if ("variant226" !== "variant226") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 540, - 0 - ], - Error: new Error() - }; -} - -if ("variant227" !== "variant227") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 541, - 0 - ], - Error: new Error() - }; -} - -if ("variant228" !== "variant228") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 542, - 0 - ], - Error: new Error() - }; -} - -if ("variant229" !== "variant229") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 543, - 0 - ], - Error: new Error() - }; -} - -if ("variant230" !== "variant230") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 544, - 0 - ], - Error: new Error() - }; -} - -if ("variant231" !== "variant231") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 545, - 0 - ], - Error: new Error() - }; -} - -if ("variant232" !== "variant232") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 546, - 0 - ], - Error: new Error() - }; -} - -if ("variant233" !== "variant233") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 547, - 0 - ], - Error: new Error() - }; -} - -if ("variant234" !== "variant234") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 548, - 0 - ], - Error: new Error() - }; -} - -if ("variant235" !== "variant235") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 549, - 0 - ], - Error: new Error() - }; -} - -if ("variant236" !== "variant236") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 550, - 0 - ], - Error: new Error() - }; -} - -if ("variant237" !== "variant237") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 551, - 0 - ], - Error: new Error() - }; -} - -if ("variant238" !== "variant238") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 552, - 0 - ], - Error: new Error() - }; -} - -if ("variant239" !== "variant239") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 553, - 0 - ], - Error: new Error() - }; -} - -if ("variant240" !== "variant240") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 554, - 0 - ], - Error: new Error() - }; -} - -if ("variant241" !== "variant241") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 555, - 0 - ], - Error: new Error() - }; -} - -if ("variant242" !== "variant242") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 556, - 0 - ], - Error: new Error() - }; -} - -if ("variant243" !== "variant243") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 557, - 0 - ], - Error: new Error() - }; -} - -if ("variant244" !== "variant244") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 558, - 0 - ], - Error: new Error() - }; -} - -if ("variant245" !== "variant245") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 559, - 0 - ], - Error: new Error() - }; -} - -if ("variant246" !== "variant246") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 560, - 0 - ], - Error: new Error() - }; -} - -if ("variant247" !== "variant247") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 561, - 0 - ], - Error: new Error() - }; -} - -if ("variant248" !== "variant248") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 562, - 0 - ], - Error: new Error() - }; -} - -if ("variant249" !== "variant249") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 563, - 0 - ], - Error: new Error() - }; -} - -if ("variant250" !== "variant250") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 564, - 0 - ], - Error: new Error() - }; -} - -if ("variant251" !== "variant251") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 565, - 0 - ], - Error: new Error() - }; -} - -if ("variant252" !== "variant252") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 566, - 0 - ], - Error: new Error() - }; -} - -if ("variant253" !== "variant253") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 567, - 0 - ], - Error: new Error() - }; -} - -if ("variant254" !== "variant254") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 568, - 0 - ], - Error: new Error() - }; -} - -if ("variant255" !== "variant255") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 569, - 0 - ], - Error: new Error() - }; -} - -if ("variant256" !== "variant256") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 570, - 0 - ], - Error: new Error() - }; -} - -if ("variant257" !== "variant257") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 571, - 0 - ], - Error: new Error() - }; -} - -if ("variant258" !== "variant258") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 572, - 0 - ], - Error: new Error() - }; -} - -if ("variant259" !== "variant259") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 573, - 0 - ], - Error: new Error() - }; -} - -if ("variant260" !== "variant260") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 574, - 0 - ], - Error: new Error() - }; -} - -if ("variant261" !== "variant261") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 575, - 0 - ], - Error: new Error() - }; -} - -if ("variant262" !== "variant262") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 576, - 0 - ], - Error: new Error() - }; -} - -if ("variant263" !== "variant263") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 577, - 0 - ], - Error: new Error() - }; -} - -if ("variant264" !== "variant264") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 578, - 0 - ], - Error: new Error() - }; -} - -if ("variant265" !== "variant265") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 579, - 0 - ], - Error: new Error() - }; -} - -if ("variant266" !== "variant266") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 580, - 0 - ], - Error: new Error() - }; -} - -if ("variant267" !== "variant267") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 581, - 0 - ], - Error: new Error() - }; -} - -if ("variant268" !== "variant268") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 582, - 0 - ], - Error: new Error() - }; -} - -if ("variant269" !== "variant269") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 583, - 0 - ], - Error: new Error() - }; -} - -if ("variant270" !== "variant270") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 584, - 0 - ], - Error: new Error() - }; -} - -if ("variant271" !== "variant271") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 585, - 0 - ], - Error: new Error() - }; -} - -if ("variant272" !== "variant272") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 586, - 0 - ], - Error: new Error() - }; -} - -if ("variant273" !== "variant273") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 587, - 0 - ], - Error: new Error() - }; -} - -if ("variant274" !== "variant274") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 588, - 0 - ], - Error: new Error() - }; -} - -if ("variant275" !== "variant275") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 589, - 0 - ], - Error: new Error() - }; -} - -if ("variant276" !== "variant276") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 590, - 0 - ], - Error: new Error() - }; -} - -if ("variant277" !== "variant277") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 591, - 0 - ], - Error: new Error() - }; -} - -if ("variant278" !== "variant278") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 592, - 0 - ], - Error: new Error() - }; -} - -if ("variant279" !== "variant279") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 593, - 0 - ], - Error: new Error() - }; -} - -if ("variant280" !== "variant280") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 594, - 0 - ], - Error: new Error() - }; -} - -if ("variant281" !== "variant281") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 595, - 0 - ], - Error: new Error() - }; -} - -if ("variant282" !== "variant282") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 596, - 0 - ], - Error: new Error() - }; -} - -if ("variant283" !== "variant283") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 597, - 0 - ], - Error: new Error() - }; -} - -if ("variant284" !== "variant284") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 598, - 0 - ], - Error: new Error() - }; -} - -if ("variant285" !== "variant285") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 599, - 0 - ], - Error: new Error() - }; -} - -if ("variant286" !== "variant286") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 600, - 0 - ], - Error: new Error() - }; -} - -if ("variant287" !== "variant287") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 601, - 0 - ], - Error: new Error() - }; -} - -if ("variant288" !== "variant288") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 602, - 0 - ], - Error: new Error() - }; -} - -if ("variant289" !== "variant289") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 603, - 0 - ], - Error: new Error() - }; -} - -if ("variant290" !== "variant290") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 604, - 0 - ], - Error: new Error() - }; -} - -if ("variant291" !== "variant291") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 605, - 0 - ], - Error: new Error() - }; -} - -if ("variant292" !== "variant292") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 606, - 0 - ], - Error: new Error() - }; -} - -if ("variant293" !== "variant293") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 607, - 0 - ], - Error: new Error() - }; -} - -if ("variant294" !== "variant294") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 608, - 0 - ], - Error: new Error() - }; -} - -if ("variant295" !== "variant295") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 609, - 0 - ], - Error: new Error() - }; -} - -if ("variant296" !== "variant296") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 610, - 0 - ], - Error: new Error() - }; -} - -if ("variant297" !== "variant297") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 611, - 0 - ], - Error: new Error() - }; -} - -if ("variant298" !== "variant298") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 612, - 0 - ], - Error: new Error() - }; -} - -if ("variant299" !== "variant299") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 613, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant0"), "variant0")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 614, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant1"), "variant1")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 615, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant2"), "variant2")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 616, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant3"), "variant3")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 617, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant4"), "variant4")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 618, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant5"), "variant5")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 619, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant6"), "variant6")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 620, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant7"), "variant7")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 621, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant8"), "variant8")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 622, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant9"), "variant9")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 623, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant10"), "variant10")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 624, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant11"), "variant11")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 625, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant12"), "variant12")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 626, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant13"), "variant13")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 627, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant14"), "variant14")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 628, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant15"), "variant15")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 629, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant16"), "variant16")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 630, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant17"), "variant17")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 631, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant18"), "variant18")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 632, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant19"), "variant19")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 633, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant20"), "variant20")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 634, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant21"), "variant21")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 635, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant22"), "variant22")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 636, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant23"), "variant23")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 637, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant24"), "variant24")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 638, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant25"), "variant25")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 639, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant26"), "variant26")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 640, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant27"), "variant27")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 641, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant28"), "variant28")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 642, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant29"), "variant29")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 643, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant30"), "variant30")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 644, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant31"), "variant31")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 645, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant32"), "variant32")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 646, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant33"), "variant33")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 647, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant34"), "variant34")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 648, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant35"), "variant35")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 649, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant36"), "variant36")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 650, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant37"), "variant37")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 651, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant38"), "variant38")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 652, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant39"), "variant39")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 653, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant40"), "variant40")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 654, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant41"), "variant41")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 655, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant42"), "variant42")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 656, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant43"), "variant43")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 657, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant44"), "variant44")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 658, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant45"), "variant45")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 659, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant46"), "variant46")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 660, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant47"), "variant47")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 661, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant48"), "variant48")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 662, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant49"), "variant49")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 663, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant50"), "variant50")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 664, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant51"), "variant51")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 665, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant52"), "variant52")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 666, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant53"), "variant53")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 667, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant54"), "variant54")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 668, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant55"), "variant55")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 669, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant56"), "variant56")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 670, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant57"), "variant57")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 671, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant58"), "variant58")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 672, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant59"), "variant59")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 673, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant60"), "variant60")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 674, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant61"), "variant61")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 675, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant62"), "variant62")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 676, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant63"), "variant63")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 677, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant64"), "variant64")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 678, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant65"), "variant65")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 679, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant66"), "variant66")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 680, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant67"), "variant67")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 681, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant68"), "variant68")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 682, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant69"), "variant69")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 683, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant70"), "variant70")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 684, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant71"), "variant71")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 685, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant72"), "variant72")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 686, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant73"), "variant73")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 687, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant74"), "variant74")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 688, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant75"), "variant75")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 689, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant76"), "variant76")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 690, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant77"), "variant77")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 691, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant78"), "variant78")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 692, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant79"), "variant79")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 693, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant80"), "variant80")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 694, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant81"), "variant81")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 695, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant82"), "variant82")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 696, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant83"), "variant83")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 697, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant84"), "variant84")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 698, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant85"), "variant85")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 699, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant86"), "variant86")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 700, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant87"), "variant87")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 701, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant88"), "variant88")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 702, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant89"), "variant89")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 703, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant90"), "variant90")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 704, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant91"), "variant91")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 705, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant92"), "variant92")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 706, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant93"), "variant93")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 707, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant94"), "variant94")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 708, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant95"), "variant95")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 709, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant96"), "variant96")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 710, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant97"), "variant97")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 711, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant98"), "variant98")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 712, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant99"), "variant99")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 713, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant100"), "variant100")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 714, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant101"), "variant101")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 715, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant102"), "variant102")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 716, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant103"), "variant103")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 717, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant104"), "variant104")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 718, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant105"), "variant105")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 719, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant106"), "variant106")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 720, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant107"), "variant107")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 721, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant108"), "variant108")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 722, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant109"), "variant109")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 723, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant110"), "variant110")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 724, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant111"), "variant111")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 725, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant112"), "variant112")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 726, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant113"), "variant113")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 727, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant114"), "variant114")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 728, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant115"), "variant115")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 729, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant116"), "variant116")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 730, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant117"), "variant117")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 731, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant118"), "variant118")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 732, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant119"), "variant119")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 733, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant120"), "variant120")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 734, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant121"), "variant121")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 735, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant122"), "variant122")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 736, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant123"), "variant123")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 737, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant124"), "variant124")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 738, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant125"), "variant125")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 739, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant126"), "variant126")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 740, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant127"), "variant127")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 741, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant128"), "variant128")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 742, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant129"), "variant129")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 743, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant130"), "variant130")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 744, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant131"), "variant131")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 745, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant132"), "variant132")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 746, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant133"), "variant133")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 747, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant134"), "variant134")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 748, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant135"), "variant135")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 749, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant136"), "variant136")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 750, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant137"), "variant137")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 751, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant138"), "variant138")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 752, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant139"), "variant139")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 753, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant140"), "variant140")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 754, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant141"), "variant141")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 755, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant142"), "variant142")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 756, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant143"), "variant143")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 757, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant144"), "variant144")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 758, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant145"), "variant145")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 759, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant146"), "variant146")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 760, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant147"), "variant147")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 761, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant148"), "variant148")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 762, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant149"), "variant149")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 763, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant150"), "variant150")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 764, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant151"), "variant151")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 765, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant152"), "variant152")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 766, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant153"), "variant153")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 767, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant154"), "variant154")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 768, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant155"), "variant155")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 769, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant156"), "variant156")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 770, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant157"), "variant157")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 771, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant158"), "variant158")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 772, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant159"), "variant159")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 773, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant160"), "variant160")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 774, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant161"), "variant161")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 775, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant162"), "variant162")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 776, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant163"), "variant163")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 777, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant164"), "variant164")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 778, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant165"), "variant165")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 779, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant166"), "variant166")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 780, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant167"), "variant167")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 781, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant168"), "variant168")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 782, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant169"), "variant169")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 783, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant170"), "variant170")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 784, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant171"), "variant171")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 785, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant172"), "variant172")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 786, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant173"), "variant173")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 787, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant174"), "variant174")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 788, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant175"), "variant175")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 789, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant176"), "variant176")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 790, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant177"), "variant177")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 791, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant178"), "variant178")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 792, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant179"), "variant179")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 793, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant180"), "variant180")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 794, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant181"), "variant181")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 795, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant182"), "variant182")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 796, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant183"), "variant183")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 797, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant184"), "variant184")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 798, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant185"), "variant185")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 799, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant186"), "variant186")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 800, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant187"), "variant187")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 801, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant188"), "variant188")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 802, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant189"), "variant189")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 803, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant190"), "variant190")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 804, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant191"), "variant191")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 805, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant192"), "variant192")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 806, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant193"), "variant193")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 807, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant194"), "variant194")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 808, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant195"), "variant195")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 809, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant196"), "variant196")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 810, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant197"), "variant197")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 811, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant198"), "variant198")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 812, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant199"), "variant199")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 813, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant200"), "variant200")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 814, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant201"), "variant201")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 815, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant202"), "variant202")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 816, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant203"), "variant203")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 817, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant204"), "variant204")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 818, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant205"), "variant205")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 819, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant206"), "variant206")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 820, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant207"), "variant207")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 821, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant208"), "variant208")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 822, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant209"), "variant209")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 823, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant210"), "variant210")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 824, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant211"), "variant211")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 825, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant212"), "variant212")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 826, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant213"), "variant213")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 827, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant214"), "variant214")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 828, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant215"), "variant215")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 829, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant216"), "variant216")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 830, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant217"), "variant217")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 831, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant218"), "variant218")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 832, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant219"), "variant219")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 833, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant220"), "variant220")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 834, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant221"), "variant221")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 835, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant222"), "variant222")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 836, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant223"), "variant223")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 837, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant224"), "variant224")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 838, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant225"), "variant225")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 839, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant226"), "variant226")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 840, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant227"), "variant227")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 841, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant228"), "variant228")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 842, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant229"), "variant229")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 843, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant230"), "variant230")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 844, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant231"), "variant231")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 845, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant232"), "variant232")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 846, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant233"), "variant233")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 847, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant234"), "variant234")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 848, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant235"), "variant235")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 849, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant236"), "variant236")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 850, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant237"), "variant237")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 851, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant238"), "variant238")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 852, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant239"), "variant239")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 853, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant240"), "variant240")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 854, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant241"), "variant241")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 855, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant242"), "variant242")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 856, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant243"), "variant243")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 857, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant244"), "variant244")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 858, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant245"), "variant245")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 859, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant246"), "variant246")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 860, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant247"), "variant247")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 861, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant248"), "variant248")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 862, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant249"), "variant249")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 863, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant250"), "variant250")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 864, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant251"), "variant251")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 865, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant252"), "variant252")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 866, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant253"), "variant253")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 867, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant254"), "variant254")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 868, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant255"), "variant255")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 869, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant256"), "variant256")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 870, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant257"), "variant257")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 871, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant258"), "variant258")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 872, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant259"), "variant259")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 873, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant260"), "variant260")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 874, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant261"), "variant261")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 875, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant262"), "variant262")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 876, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant263"), "variant263")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 877, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant264"), "variant264")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 878, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant265"), "variant265")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 879, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant266"), "variant266")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 880, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant267"), "variant267")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 881, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant268"), "variant268")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 882, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant269"), "variant269")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 883, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant270"), "variant270")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 884, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant271"), "variant271")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 885, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant272"), "variant272")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 886, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant273"), "variant273")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 887, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant274"), "variant274")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 888, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant275"), "variant275")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 889, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant276"), "variant276")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 890, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant277"), "variant277")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 891, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant278"), "variant278")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 892, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant279"), "variant279")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 893, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant280"), "variant280")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 894, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant281"), "variant281")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 895, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant282"), "variant282")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 896, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant283"), "variant283")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 897, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant284"), "variant284")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 898, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant285"), "variant285")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 899, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant286"), "variant286")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 900, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant287"), "variant287")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 901, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant288"), "variant288")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 902, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant289"), "variant289")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 903, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant290"), "variant290")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 904, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant291"), "variant291")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 905, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant292"), "variant292")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 906, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant293"), "variant293")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 907, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant294"), "variant294")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 908, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant295"), "variant295")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 909, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant296"), "variant296")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 910, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant297"), "variant297")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 911, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant298"), "variant298")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 912, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("variant299"), "variant299")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 913, - 0 - ], - Error: new Error() - }; -} - -if (!eq(tFromJs("xx"), undefined)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "big_polyvar_test.res", - 914, - 0 - ], - Error: new Error() - }; -} - -exports.tToJs = tToJs; -exports.tFromJs = tFromJs; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/big_polyvar_test.mjs b/tests/tests/src/big_polyvar_test.mjs new file mode 100644 index 0000000000..7a170c28ed --- /dev/null +++ b/tests/tests/src/big_polyvar_test.mjs @@ -0,0 +1,7243 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let _map = {"variant0":"variant0","variant1":"variant1","variant2":"variant2","variant3":"variant3","variant4":"variant4","variant5":"variant5","variant6":"variant6","variant7":"variant7","variant8":"variant8","variant9":"variant9","variant10":"variant10","variant11":"variant11","variant12":"variant12","variant13":"variant13","variant14":"variant14","variant15":"variant15","variant16":"variant16","variant17":"variant17","variant18":"variant18","variant19":"variant19","variant20":"variant20","variant21":"variant21","variant22":"variant22","variant23":"variant23","variant24":"variant24","variant25":"variant25","variant26":"variant26","variant27":"variant27","variant28":"variant28","variant29":"variant29","variant30":"variant30","variant31":"variant31","variant32":"variant32","variant33":"variant33","variant34":"variant34","variant35":"variant35","variant36":"variant36","variant37":"variant37","variant38":"variant38","variant39":"variant39","variant40":"variant40","variant41":"variant41","variant42":"variant42","variant43":"variant43","variant44":"variant44","variant45":"variant45","variant46":"variant46","variant47":"variant47","variant48":"variant48","variant49":"variant49","variant50":"variant50","variant51":"variant51","variant52":"variant52","variant53":"variant53","variant54":"variant54","variant55":"variant55","variant56":"variant56","variant57":"variant57","variant58":"variant58","variant59":"variant59","variant60":"variant60","variant61":"variant61","variant62":"variant62","variant63":"variant63","variant64":"variant64","variant65":"variant65","variant66":"variant66","variant67":"variant67","variant68":"variant68","variant69":"variant69","variant70":"variant70","variant71":"variant71","variant72":"variant72","variant73":"variant73","variant74":"variant74","variant75":"variant75","variant76":"variant76","variant77":"variant77","variant78":"variant78","variant79":"variant79","variant80":"variant80","variant81":"variant81","variant82":"variant82","variant83":"variant83","variant84":"variant84","variant85":"variant85","variant86":"variant86","variant87":"variant87","variant88":"variant88","variant89":"variant89","variant90":"variant90","variant91":"variant91","variant92":"variant92","variant93":"variant93","variant94":"variant94","variant95":"variant95","variant96":"variant96","variant97":"variant97","variant98":"variant98","variant99":"variant99","variant100":"variant100","variant101":"variant101","variant102":"variant102","variant103":"variant103","variant104":"variant104","variant105":"variant105","variant106":"variant106","variant107":"variant107","variant108":"variant108","variant109":"variant109","variant110":"variant110","variant111":"variant111","variant112":"variant112","variant113":"variant113","variant114":"variant114","variant115":"variant115","variant116":"variant116","variant117":"variant117","variant118":"variant118","variant119":"variant119","variant120":"variant120","variant121":"variant121","variant122":"variant122","variant123":"variant123","variant124":"variant124","variant125":"variant125","variant126":"variant126","variant127":"variant127","variant128":"variant128","variant129":"variant129","variant130":"variant130","variant131":"variant131","variant132":"variant132","variant133":"variant133","variant134":"variant134","variant135":"variant135","variant136":"variant136","variant137":"variant137","variant138":"variant138","variant139":"variant139","variant140":"variant140","variant141":"variant141","variant142":"variant142","variant143":"variant143","variant144":"variant144","variant145":"variant145","variant146":"variant146","variant147":"variant147","variant148":"variant148","variant149":"variant149","variant150":"variant150","variant151":"variant151","variant152":"variant152","variant153":"variant153","variant154":"variant154","variant155":"variant155","variant156":"variant156","variant157":"variant157","variant158":"variant158","variant159":"variant159","variant160":"variant160","variant161":"variant161","variant162":"variant162","variant163":"variant163","variant164":"variant164","variant165":"variant165","variant166":"variant166","variant167":"variant167","variant168":"variant168","variant169":"variant169","variant170":"variant170","variant171":"variant171","variant172":"variant172","variant173":"variant173","variant174":"variant174","variant175":"variant175","variant176":"variant176","variant177":"variant177","variant178":"variant178","variant179":"variant179","variant180":"variant180","variant181":"variant181","variant182":"variant182","variant183":"variant183","variant184":"variant184","variant185":"variant185","variant186":"variant186","variant187":"variant187","variant188":"variant188","variant189":"variant189","variant190":"variant190","variant191":"variant191","variant192":"variant192","variant193":"variant193","variant194":"variant194","variant195":"variant195","variant196":"variant196","variant197":"variant197","variant198":"variant198","variant199":"variant199","variant200":"variant200","variant201":"variant201","variant202":"variant202","variant203":"variant203","variant204":"variant204","variant205":"variant205","variant206":"variant206","variant207":"variant207","variant208":"variant208","variant209":"variant209","variant210":"variant210","variant211":"variant211","variant212":"variant212","variant213":"variant213","variant214":"variant214","variant215":"variant215","variant216":"variant216","variant217":"variant217","variant218":"variant218","variant219":"variant219","variant220":"variant220","variant221":"variant221","variant222":"variant222","variant223":"variant223","variant224":"variant224","variant225":"variant225","variant226":"variant226","variant227":"variant227","variant228":"variant228","variant229":"variant229","variant230":"variant230","variant231":"variant231","variant232":"variant232","variant233":"variant233","variant234":"variant234","variant235":"variant235","variant236":"variant236","variant237":"variant237","variant238":"variant238","variant239":"variant239","variant240":"variant240","variant241":"variant241","variant242":"variant242","variant243":"variant243","variant244":"variant244","variant245":"variant245","variant246":"variant246","variant247":"variant247","variant248":"variant248","variant249":"variant249","variant250":"variant250","variant251":"variant251","variant252":"variant252","variant253":"variant253","variant254":"variant254","variant255":"variant255","variant256":"variant256","variant257":"variant257","variant258":"variant258","variant259":"variant259","variant260":"variant260","variant261":"variant261","variant262":"variant262","variant263":"variant263","variant264":"variant264","variant265":"variant265","variant266":"variant266","variant267":"variant267","variant268":"variant268","variant269":"variant269","variant270":"variant270","variant271":"variant271","variant272":"variant272","variant273":"variant273","variant274":"variant274","variant275":"variant275","variant276":"variant276","variant277":"variant277","variant278":"variant278","variant279":"variant279","variant280":"variant280","variant281":"variant281","variant282":"variant282","variant283":"variant283","variant284":"variant284","variant285":"variant285","variant286":"variant286","variant287":"variant287","variant288":"variant288","variant289":"variant289","variant290":"variant290","variant291":"variant291","variant292":"variant292","variant293":"variant293","variant294":"variant294","variant295":"variant295","variant296":"variant296","variant297":"variant297","variant298":"variant298","variant299":"variant299"}; + +function tToJs(param) { + return param; +} + +function tFromJs(param) { + return _map[param]; +} + +function eq(x, y) { + if (x !== undefined) { + if (y !== undefined) { + return x === y; + } else { + return false; + } + } else { + return y === undefined; + } +} + +if ("variant0" !== "variant0") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 314, + 0 + ], + Error: new Error() + }; +} + +if ("variant1" !== "variant1") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 315, + 0 + ], + Error: new Error() + }; +} + +if ("variant2" !== "variant2") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 316, + 0 + ], + Error: new Error() + }; +} + +if ("variant3" !== "variant3") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 317, + 0 + ], + Error: new Error() + }; +} + +if ("variant4" !== "variant4") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 318, + 0 + ], + Error: new Error() + }; +} + +if ("variant5" !== "variant5") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 319, + 0 + ], + Error: new Error() + }; +} + +if ("variant6" !== "variant6") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 320, + 0 + ], + Error: new Error() + }; +} + +if ("variant7" !== "variant7") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 321, + 0 + ], + Error: new Error() + }; +} + +if ("variant8" !== "variant8") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 322, + 0 + ], + Error: new Error() + }; +} + +if ("variant9" !== "variant9") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 323, + 0 + ], + Error: new Error() + }; +} + +if ("variant10" !== "variant10") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 324, + 0 + ], + Error: new Error() + }; +} + +if ("variant11" !== "variant11") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 325, + 0 + ], + Error: new Error() + }; +} + +if ("variant12" !== "variant12") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 326, + 0 + ], + Error: new Error() + }; +} + +if ("variant13" !== "variant13") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 327, + 0 + ], + Error: new Error() + }; +} + +if ("variant14" !== "variant14") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 328, + 0 + ], + Error: new Error() + }; +} + +if ("variant15" !== "variant15") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 329, + 0 + ], + Error: new Error() + }; +} + +if ("variant16" !== "variant16") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 330, + 0 + ], + Error: new Error() + }; +} + +if ("variant17" !== "variant17") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 331, + 0 + ], + Error: new Error() + }; +} + +if ("variant18" !== "variant18") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 332, + 0 + ], + Error: new Error() + }; +} + +if ("variant19" !== "variant19") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 333, + 0 + ], + Error: new Error() + }; +} + +if ("variant20" !== "variant20") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 334, + 0 + ], + Error: new Error() + }; +} + +if ("variant21" !== "variant21") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 335, + 0 + ], + Error: new Error() + }; +} + +if ("variant22" !== "variant22") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 336, + 0 + ], + Error: new Error() + }; +} + +if ("variant23" !== "variant23") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 337, + 0 + ], + Error: new Error() + }; +} + +if ("variant24" !== "variant24") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 338, + 0 + ], + Error: new Error() + }; +} + +if ("variant25" !== "variant25") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 339, + 0 + ], + Error: new Error() + }; +} + +if ("variant26" !== "variant26") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 340, + 0 + ], + Error: new Error() + }; +} + +if ("variant27" !== "variant27") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 341, + 0 + ], + Error: new Error() + }; +} + +if ("variant28" !== "variant28") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 342, + 0 + ], + Error: new Error() + }; +} + +if ("variant29" !== "variant29") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 343, + 0 + ], + Error: new Error() + }; +} + +if ("variant30" !== "variant30") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 344, + 0 + ], + Error: new Error() + }; +} + +if ("variant31" !== "variant31") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 345, + 0 + ], + Error: new Error() + }; +} + +if ("variant32" !== "variant32") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 346, + 0 + ], + Error: new Error() + }; +} + +if ("variant33" !== "variant33") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 347, + 0 + ], + Error: new Error() + }; +} + +if ("variant34" !== "variant34") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 348, + 0 + ], + Error: new Error() + }; +} + +if ("variant35" !== "variant35") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 349, + 0 + ], + Error: new Error() + }; +} + +if ("variant36" !== "variant36") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 350, + 0 + ], + Error: new Error() + }; +} + +if ("variant37" !== "variant37") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 351, + 0 + ], + Error: new Error() + }; +} + +if ("variant38" !== "variant38") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 352, + 0 + ], + Error: new Error() + }; +} + +if ("variant39" !== "variant39") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 353, + 0 + ], + Error: new Error() + }; +} + +if ("variant40" !== "variant40") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 354, + 0 + ], + Error: new Error() + }; +} + +if ("variant41" !== "variant41") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 355, + 0 + ], + Error: new Error() + }; +} + +if ("variant42" !== "variant42") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 356, + 0 + ], + Error: new Error() + }; +} + +if ("variant43" !== "variant43") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 357, + 0 + ], + Error: new Error() + }; +} + +if ("variant44" !== "variant44") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 358, + 0 + ], + Error: new Error() + }; +} + +if ("variant45" !== "variant45") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 359, + 0 + ], + Error: new Error() + }; +} + +if ("variant46" !== "variant46") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 360, + 0 + ], + Error: new Error() + }; +} + +if ("variant47" !== "variant47") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 361, + 0 + ], + Error: new Error() + }; +} + +if ("variant48" !== "variant48") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 362, + 0 + ], + Error: new Error() + }; +} + +if ("variant49" !== "variant49") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 363, + 0 + ], + Error: new Error() + }; +} + +if ("variant50" !== "variant50") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 364, + 0 + ], + Error: new Error() + }; +} + +if ("variant51" !== "variant51") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 365, + 0 + ], + Error: new Error() + }; +} + +if ("variant52" !== "variant52") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 366, + 0 + ], + Error: new Error() + }; +} + +if ("variant53" !== "variant53") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 367, + 0 + ], + Error: new Error() + }; +} + +if ("variant54" !== "variant54") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 368, + 0 + ], + Error: new Error() + }; +} + +if ("variant55" !== "variant55") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 369, + 0 + ], + Error: new Error() + }; +} + +if ("variant56" !== "variant56") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 370, + 0 + ], + Error: new Error() + }; +} + +if ("variant57" !== "variant57") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 371, + 0 + ], + Error: new Error() + }; +} + +if ("variant58" !== "variant58") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 372, + 0 + ], + Error: new Error() + }; +} + +if ("variant59" !== "variant59") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 373, + 0 + ], + Error: new Error() + }; +} + +if ("variant60" !== "variant60") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 374, + 0 + ], + Error: new Error() + }; +} + +if ("variant61" !== "variant61") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 375, + 0 + ], + Error: new Error() + }; +} + +if ("variant62" !== "variant62") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 376, + 0 + ], + Error: new Error() + }; +} + +if ("variant63" !== "variant63") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 377, + 0 + ], + Error: new Error() + }; +} + +if ("variant64" !== "variant64") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 378, + 0 + ], + Error: new Error() + }; +} + +if ("variant65" !== "variant65") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 379, + 0 + ], + Error: new Error() + }; +} + +if ("variant66" !== "variant66") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 380, + 0 + ], + Error: new Error() + }; +} + +if ("variant67" !== "variant67") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 381, + 0 + ], + Error: new Error() + }; +} + +if ("variant68" !== "variant68") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 382, + 0 + ], + Error: new Error() + }; +} + +if ("variant69" !== "variant69") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 383, + 0 + ], + Error: new Error() + }; +} + +if ("variant70" !== "variant70") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 384, + 0 + ], + Error: new Error() + }; +} + +if ("variant71" !== "variant71") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 385, + 0 + ], + Error: new Error() + }; +} + +if ("variant72" !== "variant72") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 386, + 0 + ], + Error: new Error() + }; +} + +if ("variant73" !== "variant73") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 387, + 0 + ], + Error: new Error() + }; +} + +if ("variant74" !== "variant74") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 388, + 0 + ], + Error: new Error() + }; +} + +if ("variant75" !== "variant75") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 389, + 0 + ], + Error: new Error() + }; +} + +if ("variant76" !== "variant76") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 390, + 0 + ], + Error: new Error() + }; +} + +if ("variant77" !== "variant77") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 391, + 0 + ], + Error: new Error() + }; +} + +if ("variant78" !== "variant78") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 392, + 0 + ], + Error: new Error() + }; +} + +if ("variant79" !== "variant79") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 393, + 0 + ], + Error: new Error() + }; +} + +if ("variant80" !== "variant80") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 394, + 0 + ], + Error: new Error() + }; +} + +if ("variant81" !== "variant81") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 395, + 0 + ], + Error: new Error() + }; +} + +if ("variant82" !== "variant82") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 396, + 0 + ], + Error: new Error() + }; +} + +if ("variant83" !== "variant83") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 397, + 0 + ], + Error: new Error() + }; +} + +if ("variant84" !== "variant84") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 398, + 0 + ], + Error: new Error() + }; +} + +if ("variant85" !== "variant85") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 399, + 0 + ], + Error: new Error() + }; +} + +if ("variant86" !== "variant86") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 400, + 0 + ], + Error: new Error() + }; +} + +if ("variant87" !== "variant87") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 401, + 0 + ], + Error: new Error() + }; +} + +if ("variant88" !== "variant88") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 402, + 0 + ], + Error: new Error() + }; +} + +if ("variant89" !== "variant89") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 403, + 0 + ], + Error: new Error() + }; +} + +if ("variant90" !== "variant90") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 404, + 0 + ], + Error: new Error() + }; +} + +if ("variant91" !== "variant91") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 405, + 0 + ], + Error: new Error() + }; +} + +if ("variant92" !== "variant92") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 406, + 0 + ], + Error: new Error() + }; +} + +if ("variant93" !== "variant93") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 407, + 0 + ], + Error: new Error() + }; +} + +if ("variant94" !== "variant94") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 408, + 0 + ], + Error: new Error() + }; +} + +if ("variant95" !== "variant95") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 409, + 0 + ], + Error: new Error() + }; +} + +if ("variant96" !== "variant96") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 410, + 0 + ], + Error: new Error() + }; +} + +if ("variant97" !== "variant97") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 411, + 0 + ], + Error: new Error() + }; +} + +if ("variant98" !== "variant98") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 412, + 0 + ], + Error: new Error() + }; +} + +if ("variant99" !== "variant99") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 413, + 0 + ], + Error: new Error() + }; +} + +if ("variant100" !== "variant100") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 414, + 0 + ], + Error: new Error() + }; +} + +if ("variant101" !== "variant101") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 415, + 0 + ], + Error: new Error() + }; +} + +if ("variant102" !== "variant102") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 416, + 0 + ], + Error: new Error() + }; +} + +if ("variant103" !== "variant103") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 417, + 0 + ], + Error: new Error() + }; +} + +if ("variant104" !== "variant104") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 418, + 0 + ], + Error: new Error() + }; +} + +if ("variant105" !== "variant105") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 419, + 0 + ], + Error: new Error() + }; +} + +if ("variant106" !== "variant106") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 420, + 0 + ], + Error: new Error() + }; +} + +if ("variant107" !== "variant107") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 421, + 0 + ], + Error: new Error() + }; +} + +if ("variant108" !== "variant108") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 422, + 0 + ], + Error: new Error() + }; +} + +if ("variant109" !== "variant109") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 423, + 0 + ], + Error: new Error() + }; +} + +if ("variant110" !== "variant110") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 424, + 0 + ], + Error: new Error() + }; +} + +if ("variant111" !== "variant111") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 425, + 0 + ], + Error: new Error() + }; +} + +if ("variant112" !== "variant112") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 426, + 0 + ], + Error: new Error() + }; +} + +if ("variant113" !== "variant113") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 427, + 0 + ], + Error: new Error() + }; +} + +if ("variant114" !== "variant114") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 428, + 0 + ], + Error: new Error() + }; +} + +if ("variant115" !== "variant115") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 429, + 0 + ], + Error: new Error() + }; +} + +if ("variant116" !== "variant116") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 430, + 0 + ], + Error: new Error() + }; +} + +if ("variant117" !== "variant117") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 431, + 0 + ], + Error: new Error() + }; +} + +if ("variant118" !== "variant118") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 432, + 0 + ], + Error: new Error() + }; +} + +if ("variant119" !== "variant119") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 433, + 0 + ], + Error: new Error() + }; +} + +if ("variant120" !== "variant120") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 434, + 0 + ], + Error: new Error() + }; +} + +if ("variant121" !== "variant121") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 435, + 0 + ], + Error: new Error() + }; +} + +if ("variant122" !== "variant122") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 436, + 0 + ], + Error: new Error() + }; +} + +if ("variant123" !== "variant123") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 437, + 0 + ], + Error: new Error() + }; +} + +if ("variant124" !== "variant124") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 438, + 0 + ], + Error: new Error() + }; +} + +if ("variant125" !== "variant125") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 439, + 0 + ], + Error: new Error() + }; +} + +if ("variant126" !== "variant126") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 440, + 0 + ], + Error: new Error() + }; +} + +if ("variant127" !== "variant127") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 441, + 0 + ], + Error: new Error() + }; +} + +if ("variant128" !== "variant128") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 442, + 0 + ], + Error: new Error() + }; +} + +if ("variant129" !== "variant129") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 443, + 0 + ], + Error: new Error() + }; +} + +if ("variant130" !== "variant130") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 444, + 0 + ], + Error: new Error() + }; +} + +if ("variant131" !== "variant131") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 445, + 0 + ], + Error: new Error() + }; +} + +if ("variant132" !== "variant132") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 446, + 0 + ], + Error: new Error() + }; +} + +if ("variant133" !== "variant133") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 447, + 0 + ], + Error: new Error() + }; +} + +if ("variant134" !== "variant134") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 448, + 0 + ], + Error: new Error() + }; +} + +if ("variant135" !== "variant135") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 449, + 0 + ], + Error: new Error() + }; +} + +if ("variant136" !== "variant136") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 450, + 0 + ], + Error: new Error() + }; +} + +if ("variant137" !== "variant137") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 451, + 0 + ], + Error: new Error() + }; +} + +if ("variant138" !== "variant138") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 452, + 0 + ], + Error: new Error() + }; +} + +if ("variant139" !== "variant139") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 453, + 0 + ], + Error: new Error() + }; +} + +if ("variant140" !== "variant140") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 454, + 0 + ], + Error: new Error() + }; +} + +if ("variant141" !== "variant141") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 455, + 0 + ], + Error: new Error() + }; +} + +if ("variant142" !== "variant142") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 456, + 0 + ], + Error: new Error() + }; +} + +if ("variant143" !== "variant143") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 457, + 0 + ], + Error: new Error() + }; +} + +if ("variant144" !== "variant144") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 458, + 0 + ], + Error: new Error() + }; +} + +if ("variant145" !== "variant145") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 459, + 0 + ], + Error: new Error() + }; +} + +if ("variant146" !== "variant146") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 460, + 0 + ], + Error: new Error() + }; +} + +if ("variant147" !== "variant147") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 461, + 0 + ], + Error: new Error() + }; +} + +if ("variant148" !== "variant148") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 462, + 0 + ], + Error: new Error() + }; +} + +if ("variant149" !== "variant149") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 463, + 0 + ], + Error: new Error() + }; +} + +if ("variant150" !== "variant150") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 464, + 0 + ], + Error: new Error() + }; +} + +if ("variant151" !== "variant151") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 465, + 0 + ], + Error: new Error() + }; +} + +if ("variant152" !== "variant152") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 466, + 0 + ], + Error: new Error() + }; +} + +if ("variant153" !== "variant153") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 467, + 0 + ], + Error: new Error() + }; +} + +if ("variant154" !== "variant154") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 468, + 0 + ], + Error: new Error() + }; +} + +if ("variant155" !== "variant155") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 469, + 0 + ], + Error: new Error() + }; +} + +if ("variant156" !== "variant156") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 470, + 0 + ], + Error: new Error() + }; +} + +if ("variant157" !== "variant157") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 471, + 0 + ], + Error: new Error() + }; +} + +if ("variant158" !== "variant158") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 472, + 0 + ], + Error: new Error() + }; +} + +if ("variant159" !== "variant159") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 473, + 0 + ], + Error: new Error() + }; +} + +if ("variant160" !== "variant160") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 474, + 0 + ], + Error: new Error() + }; +} + +if ("variant161" !== "variant161") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 475, + 0 + ], + Error: new Error() + }; +} + +if ("variant162" !== "variant162") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 476, + 0 + ], + Error: new Error() + }; +} + +if ("variant163" !== "variant163") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 477, + 0 + ], + Error: new Error() + }; +} + +if ("variant164" !== "variant164") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 478, + 0 + ], + Error: new Error() + }; +} + +if ("variant165" !== "variant165") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 479, + 0 + ], + Error: new Error() + }; +} + +if ("variant166" !== "variant166") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 480, + 0 + ], + Error: new Error() + }; +} + +if ("variant167" !== "variant167") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 481, + 0 + ], + Error: new Error() + }; +} + +if ("variant168" !== "variant168") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 482, + 0 + ], + Error: new Error() + }; +} + +if ("variant169" !== "variant169") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 483, + 0 + ], + Error: new Error() + }; +} + +if ("variant170" !== "variant170") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 484, + 0 + ], + Error: new Error() + }; +} + +if ("variant171" !== "variant171") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 485, + 0 + ], + Error: new Error() + }; +} + +if ("variant172" !== "variant172") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 486, + 0 + ], + Error: new Error() + }; +} + +if ("variant173" !== "variant173") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 487, + 0 + ], + Error: new Error() + }; +} + +if ("variant174" !== "variant174") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 488, + 0 + ], + Error: new Error() + }; +} + +if ("variant175" !== "variant175") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 489, + 0 + ], + Error: new Error() + }; +} + +if ("variant176" !== "variant176") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 490, + 0 + ], + Error: new Error() + }; +} + +if ("variant177" !== "variant177") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 491, + 0 + ], + Error: new Error() + }; +} + +if ("variant178" !== "variant178") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 492, + 0 + ], + Error: new Error() + }; +} + +if ("variant179" !== "variant179") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 493, + 0 + ], + Error: new Error() + }; +} + +if ("variant180" !== "variant180") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 494, + 0 + ], + Error: new Error() + }; +} + +if ("variant181" !== "variant181") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 495, + 0 + ], + Error: new Error() + }; +} + +if ("variant182" !== "variant182") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 496, + 0 + ], + Error: new Error() + }; +} + +if ("variant183" !== "variant183") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 497, + 0 + ], + Error: new Error() + }; +} + +if ("variant184" !== "variant184") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 498, + 0 + ], + Error: new Error() + }; +} + +if ("variant185" !== "variant185") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 499, + 0 + ], + Error: new Error() + }; +} + +if ("variant186" !== "variant186") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 500, + 0 + ], + Error: new Error() + }; +} + +if ("variant187" !== "variant187") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 501, + 0 + ], + Error: new Error() + }; +} + +if ("variant188" !== "variant188") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 502, + 0 + ], + Error: new Error() + }; +} + +if ("variant189" !== "variant189") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 503, + 0 + ], + Error: new Error() + }; +} + +if ("variant190" !== "variant190") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 504, + 0 + ], + Error: new Error() + }; +} + +if ("variant191" !== "variant191") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 505, + 0 + ], + Error: new Error() + }; +} + +if ("variant192" !== "variant192") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 506, + 0 + ], + Error: new Error() + }; +} + +if ("variant193" !== "variant193") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 507, + 0 + ], + Error: new Error() + }; +} + +if ("variant194" !== "variant194") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 508, + 0 + ], + Error: new Error() + }; +} + +if ("variant195" !== "variant195") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 509, + 0 + ], + Error: new Error() + }; +} + +if ("variant196" !== "variant196") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 510, + 0 + ], + Error: new Error() + }; +} + +if ("variant197" !== "variant197") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 511, + 0 + ], + Error: new Error() + }; +} + +if ("variant198" !== "variant198") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 512, + 0 + ], + Error: new Error() + }; +} + +if ("variant199" !== "variant199") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 513, + 0 + ], + Error: new Error() + }; +} + +if ("variant200" !== "variant200") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 514, + 0 + ], + Error: new Error() + }; +} + +if ("variant201" !== "variant201") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 515, + 0 + ], + Error: new Error() + }; +} + +if ("variant202" !== "variant202") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 516, + 0 + ], + Error: new Error() + }; +} + +if ("variant203" !== "variant203") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 517, + 0 + ], + Error: new Error() + }; +} + +if ("variant204" !== "variant204") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 518, + 0 + ], + Error: new Error() + }; +} + +if ("variant205" !== "variant205") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 519, + 0 + ], + Error: new Error() + }; +} + +if ("variant206" !== "variant206") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 520, + 0 + ], + Error: new Error() + }; +} + +if ("variant207" !== "variant207") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 521, + 0 + ], + Error: new Error() + }; +} + +if ("variant208" !== "variant208") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 522, + 0 + ], + Error: new Error() + }; +} + +if ("variant209" !== "variant209") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 523, + 0 + ], + Error: new Error() + }; +} + +if ("variant210" !== "variant210") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 524, + 0 + ], + Error: new Error() + }; +} + +if ("variant211" !== "variant211") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 525, + 0 + ], + Error: new Error() + }; +} + +if ("variant212" !== "variant212") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 526, + 0 + ], + Error: new Error() + }; +} + +if ("variant213" !== "variant213") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 527, + 0 + ], + Error: new Error() + }; +} + +if ("variant214" !== "variant214") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 528, + 0 + ], + Error: new Error() + }; +} + +if ("variant215" !== "variant215") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 529, + 0 + ], + Error: new Error() + }; +} + +if ("variant216" !== "variant216") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 530, + 0 + ], + Error: new Error() + }; +} + +if ("variant217" !== "variant217") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 531, + 0 + ], + Error: new Error() + }; +} + +if ("variant218" !== "variant218") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 532, + 0 + ], + Error: new Error() + }; +} + +if ("variant219" !== "variant219") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 533, + 0 + ], + Error: new Error() + }; +} + +if ("variant220" !== "variant220") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 534, + 0 + ], + Error: new Error() + }; +} + +if ("variant221" !== "variant221") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 535, + 0 + ], + Error: new Error() + }; +} + +if ("variant222" !== "variant222") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 536, + 0 + ], + Error: new Error() + }; +} + +if ("variant223" !== "variant223") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 537, + 0 + ], + Error: new Error() + }; +} + +if ("variant224" !== "variant224") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 538, + 0 + ], + Error: new Error() + }; +} + +if ("variant225" !== "variant225") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 539, + 0 + ], + Error: new Error() + }; +} + +if ("variant226" !== "variant226") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 540, + 0 + ], + Error: new Error() + }; +} + +if ("variant227" !== "variant227") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 541, + 0 + ], + Error: new Error() + }; +} + +if ("variant228" !== "variant228") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 542, + 0 + ], + Error: new Error() + }; +} + +if ("variant229" !== "variant229") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 543, + 0 + ], + Error: new Error() + }; +} + +if ("variant230" !== "variant230") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 544, + 0 + ], + Error: new Error() + }; +} + +if ("variant231" !== "variant231") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 545, + 0 + ], + Error: new Error() + }; +} + +if ("variant232" !== "variant232") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 546, + 0 + ], + Error: new Error() + }; +} + +if ("variant233" !== "variant233") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 547, + 0 + ], + Error: new Error() + }; +} + +if ("variant234" !== "variant234") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 548, + 0 + ], + Error: new Error() + }; +} + +if ("variant235" !== "variant235") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 549, + 0 + ], + Error: new Error() + }; +} + +if ("variant236" !== "variant236") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 550, + 0 + ], + Error: new Error() + }; +} + +if ("variant237" !== "variant237") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 551, + 0 + ], + Error: new Error() + }; +} + +if ("variant238" !== "variant238") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 552, + 0 + ], + Error: new Error() + }; +} + +if ("variant239" !== "variant239") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 553, + 0 + ], + Error: new Error() + }; +} + +if ("variant240" !== "variant240") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 554, + 0 + ], + Error: new Error() + }; +} + +if ("variant241" !== "variant241") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 555, + 0 + ], + Error: new Error() + }; +} + +if ("variant242" !== "variant242") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 556, + 0 + ], + Error: new Error() + }; +} + +if ("variant243" !== "variant243") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 557, + 0 + ], + Error: new Error() + }; +} + +if ("variant244" !== "variant244") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 558, + 0 + ], + Error: new Error() + }; +} + +if ("variant245" !== "variant245") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 559, + 0 + ], + Error: new Error() + }; +} + +if ("variant246" !== "variant246") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 560, + 0 + ], + Error: new Error() + }; +} + +if ("variant247" !== "variant247") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 561, + 0 + ], + Error: new Error() + }; +} + +if ("variant248" !== "variant248") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 562, + 0 + ], + Error: new Error() + }; +} + +if ("variant249" !== "variant249") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 563, + 0 + ], + Error: new Error() + }; +} + +if ("variant250" !== "variant250") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 564, + 0 + ], + Error: new Error() + }; +} + +if ("variant251" !== "variant251") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 565, + 0 + ], + Error: new Error() + }; +} + +if ("variant252" !== "variant252") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 566, + 0 + ], + Error: new Error() + }; +} + +if ("variant253" !== "variant253") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 567, + 0 + ], + Error: new Error() + }; +} + +if ("variant254" !== "variant254") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 568, + 0 + ], + Error: new Error() + }; +} + +if ("variant255" !== "variant255") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 569, + 0 + ], + Error: new Error() + }; +} + +if ("variant256" !== "variant256") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 570, + 0 + ], + Error: new Error() + }; +} + +if ("variant257" !== "variant257") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 571, + 0 + ], + Error: new Error() + }; +} + +if ("variant258" !== "variant258") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 572, + 0 + ], + Error: new Error() + }; +} + +if ("variant259" !== "variant259") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 573, + 0 + ], + Error: new Error() + }; +} + +if ("variant260" !== "variant260") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 574, + 0 + ], + Error: new Error() + }; +} + +if ("variant261" !== "variant261") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 575, + 0 + ], + Error: new Error() + }; +} + +if ("variant262" !== "variant262") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 576, + 0 + ], + Error: new Error() + }; +} + +if ("variant263" !== "variant263") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 577, + 0 + ], + Error: new Error() + }; +} + +if ("variant264" !== "variant264") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 578, + 0 + ], + Error: new Error() + }; +} + +if ("variant265" !== "variant265") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 579, + 0 + ], + Error: new Error() + }; +} + +if ("variant266" !== "variant266") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 580, + 0 + ], + Error: new Error() + }; +} + +if ("variant267" !== "variant267") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 581, + 0 + ], + Error: new Error() + }; +} + +if ("variant268" !== "variant268") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 582, + 0 + ], + Error: new Error() + }; +} + +if ("variant269" !== "variant269") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 583, + 0 + ], + Error: new Error() + }; +} + +if ("variant270" !== "variant270") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 584, + 0 + ], + Error: new Error() + }; +} + +if ("variant271" !== "variant271") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 585, + 0 + ], + Error: new Error() + }; +} + +if ("variant272" !== "variant272") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 586, + 0 + ], + Error: new Error() + }; +} + +if ("variant273" !== "variant273") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 587, + 0 + ], + Error: new Error() + }; +} + +if ("variant274" !== "variant274") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 588, + 0 + ], + Error: new Error() + }; +} + +if ("variant275" !== "variant275") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 589, + 0 + ], + Error: new Error() + }; +} + +if ("variant276" !== "variant276") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 590, + 0 + ], + Error: new Error() + }; +} + +if ("variant277" !== "variant277") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 591, + 0 + ], + Error: new Error() + }; +} + +if ("variant278" !== "variant278") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 592, + 0 + ], + Error: new Error() + }; +} + +if ("variant279" !== "variant279") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 593, + 0 + ], + Error: new Error() + }; +} + +if ("variant280" !== "variant280") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 594, + 0 + ], + Error: new Error() + }; +} + +if ("variant281" !== "variant281") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 595, + 0 + ], + Error: new Error() + }; +} + +if ("variant282" !== "variant282") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 596, + 0 + ], + Error: new Error() + }; +} + +if ("variant283" !== "variant283") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 597, + 0 + ], + Error: new Error() + }; +} + +if ("variant284" !== "variant284") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 598, + 0 + ], + Error: new Error() + }; +} + +if ("variant285" !== "variant285") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 599, + 0 + ], + Error: new Error() + }; +} + +if ("variant286" !== "variant286") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 600, + 0 + ], + Error: new Error() + }; +} + +if ("variant287" !== "variant287") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 601, + 0 + ], + Error: new Error() + }; +} + +if ("variant288" !== "variant288") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 602, + 0 + ], + Error: new Error() + }; +} + +if ("variant289" !== "variant289") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 603, + 0 + ], + Error: new Error() + }; +} + +if ("variant290" !== "variant290") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 604, + 0 + ], + Error: new Error() + }; +} + +if ("variant291" !== "variant291") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 605, + 0 + ], + Error: new Error() + }; +} + +if ("variant292" !== "variant292") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 606, + 0 + ], + Error: new Error() + }; +} + +if ("variant293" !== "variant293") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 607, + 0 + ], + Error: new Error() + }; +} + +if ("variant294" !== "variant294") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 608, + 0 + ], + Error: new Error() + }; +} + +if ("variant295" !== "variant295") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 609, + 0 + ], + Error: new Error() + }; +} + +if ("variant296" !== "variant296") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 610, + 0 + ], + Error: new Error() + }; +} + +if ("variant297" !== "variant297") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 611, + 0 + ], + Error: new Error() + }; +} + +if ("variant298" !== "variant298") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 612, + 0 + ], + Error: new Error() + }; +} + +if ("variant299" !== "variant299") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 613, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant0"), "variant0")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 614, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant1"), "variant1")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 615, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant2"), "variant2")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 616, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant3"), "variant3")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 617, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant4"), "variant4")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 618, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant5"), "variant5")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 619, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant6"), "variant6")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 620, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant7"), "variant7")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 621, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant8"), "variant8")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 622, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant9"), "variant9")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 623, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant10"), "variant10")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 624, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant11"), "variant11")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 625, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant12"), "variant12")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 626, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant13"), "variant13")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 627, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant14"), "variant14")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 628, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant15"), "variant15")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 629, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant16"), "variant16")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 630, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant17"), "variant17")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 631, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant18"), "variant18")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 632, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant19"), "variant19")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 633, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant20"), "variant20")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 634, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant21"), "variant21")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 635, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant22"), "variant22")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 636, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant23"), "variant23")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 637, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant24"), "variant24")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 638, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant25"), "variant25")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 639, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant26"), "variant26")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 640, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant27"), "variant27")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 641, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant28"), "variant28")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 642, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant29"), "variant29")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 643, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant30"), "variant30")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 644, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant31"), "variant31")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 645, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant32"), "variant32")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 646, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant33"), "variant33")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 647, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant34"), "variant34")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 648, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant35"), "variant35")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 649, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant36"), "variant36")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 650, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant37"), "variant37")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 651, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant38"), "variant38")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 652, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant39"), "variant39")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 653, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant40"), "variant40")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 654, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant41"), "variant41")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 655, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant42"), "variant42")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 656, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant43"), "variant43")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 657, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant44"), "variant44")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 658, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant45"), "variant45")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 659, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant46"), "variant46")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 660, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant47"), "variant47")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 661, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant48"), "variant48")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 662, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant49"), "variant49")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 663, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant50"), "variant50")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 664, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant51"), "variant51")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 665, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant52"), "variant52")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 666, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant53"), "variant53")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 667, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant54"), "variant54")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 668, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant55"), "variant55")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 669, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant56"), "variant56")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 670, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant57"), "variant57")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 671, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant58"), "variant58")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 672, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant59"), "variant59")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 673, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant60"), "variant60")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 674, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant61"), "variant61")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 675, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant62"), "variant62")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 676, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant63"), "variant63")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 677, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant64"), "variant64")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 678, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant65"), "variant65")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 679, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant66"), "variant66")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 680, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant67"), "variant67")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 681, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant68"), "variant68")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 682, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant69"), "variant69")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 683, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant70"), "variant70")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 684, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant71"), "variant71")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 685, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant72"), "variant72")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 686, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant73"), "variant73")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 687, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant74"), "variant74")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 688, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant75"), "variant75")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 689, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant76"), "variant76")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 690, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant77"), "variant77")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 691, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant78"), "variant78")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 692, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant79"), "variant79")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 693, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant80"), "variant80")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 694, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant81"), "variant81")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 695, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant82"), "variant82")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 696, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant83"), "variant83")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 697, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant84"), "variant84")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 698, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant85"), "variant85")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 699, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant86"), "variant86")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 700, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant87"), "variant87")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 701, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant88"), "variant88")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 702, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant89"), "variant89")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 703, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant90"), "variant90")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 704, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant91"), "variant91")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 705, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant92"), "variant92")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 706, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant93"), "variant93")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 707, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant94"), "variant94")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 708, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant95"), "variant95")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 709, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant96"), "variant96")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 710, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant97"), "variant97")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 711, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant98"), "variant98")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 712, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant99"), "variant99")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 713, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant100"), "variant100")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 714, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant101"), "variant101")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 715, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant102"), "variant102")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 716, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant103"), "variant103")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 717, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant104"), "variant104")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 718, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant105"), "variant105")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 719, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant106"), "variant106")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 720, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant107"), "variant107")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 721, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant108"), "variant108")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 722, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant109"), "variant109")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 723, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant110"), "variant110")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 724, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant111"), "variant111")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 725, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant112"), "variant112")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 726, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant113"), "variant113")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 727, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant114"), "variant114")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 728, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant115"), "variant115")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 729, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant116"), "variant116")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 730, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant117"), "variant117")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 731, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant118"), "variant118")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 732, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant119"), "variant119")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 733, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant120"), "variant120")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 734, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant121"), "variant121")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 735, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant122"), "variant122")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 736, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant123"), "variant123")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 737, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant124"), "variant124")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 738, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant125"), "variant125")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 739, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant126"), "variant126")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 740, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant127"), "variant127")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 741, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant128"), "variant128")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 742, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant129"), "variant129")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 743, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant130"), "variant130")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 744, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant131"), "variant131")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 745, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant132"), "variant132")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 746, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant133"), "variant133")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 747, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant134"), "variant134")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 748, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant135"), "variant135")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 749, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant136"), "variant136")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 750, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant137"), "variant137")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 751, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant138"), "variant138")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 752, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant139"), "variant139")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 753, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant140"), "variant140")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 754, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant141"), "variant141")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 755, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant142"), "variant142")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 756, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant143"), "variant143")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 757, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant144"), "variant144")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 758, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant145"), "variant145")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 759, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant146"), "variant146")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 760, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant147"), "variant147")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 761, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant148"), "variant148")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 762, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant149"), "variant149")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 763, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant150"), "variant150")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 764, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant151"), "variant151")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 765, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant152"), "variant152")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 766, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant153"), "variant153")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 767, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant154"), "variant154")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 768, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant155"), "variant155")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 769, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant156"), "variant156")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 770, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant157"), "variant157")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 771, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant158"), "variant158")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 772, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant159"), "variant159")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 773, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant160"), "variant160")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 774, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant161"), "variant161")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 775, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant162"), "variant162")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 776, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant163"), "variant163")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 777, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant164"), "variant164")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 778, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant165"), "variant165")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 779, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant166"), "variant166")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 780, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant167"), "variant167")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 781, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant168"), "variant168")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 782, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant169"), "variant169")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 783, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant170"), "variant170")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 784, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant171"), "variant171")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 785, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant172"), "variant172")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 786, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant173"), "variant173")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 787, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant174"), "variant174")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 788, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant175"), "variant175")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 789, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant176"), "variant176")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 790, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant177"), "variant177")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 791, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant178"), "variant178")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 792, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant179"), "variant179")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 793, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant180"), "variant180")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 794, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant181"), "variant181")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 795, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant182"), "variant182")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 796, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant183"), "variant183")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 797, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant184"), "variant184")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 798, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant185"), "variant185")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 799, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant186"), "variant186")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 800, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant187"), "variant187")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 801, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant188"), "variant188")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 802, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant189"), "variant189")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 803, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant190"), "variant190")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 804, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant191"), "variant191")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 805, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant192"), "variant192")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 806, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant193"), "variant193")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 807, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant194"), "variant194")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 808, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant195"), "variant195")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 809, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant196"), "variant196")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 810, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant197"), "variant197")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 811, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant198"), "variant198")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 812, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant199"), "variant199")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 813, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant200"), "variant200")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 814, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant201"), "variant201")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 815, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant202"), "variant202")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 816, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant203"), "variant203")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 817, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant204"), "variant204")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 818, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant205"), "variant205")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 819, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant206"), "variant206")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 820, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant207"), "variant207")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 821, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant208"), "variant208")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 822, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant209"), "variant209")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 823, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant210"), "variant210")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 824, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant211"), "variant211")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 825, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant212"), "variant212")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 826, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant213"), "variant213")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 827, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant214"), "variant214")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 828, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant215"), "variant215")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 829, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant216"), "variant216")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 830, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant217"), "variant217")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 831, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant218"), "variant218")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 832, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant219"), "variant219")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 833, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant220"), "variant220")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 834, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant221"), "variant221")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 835, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant222"), "variant222")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 836, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant223"), "variant223")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 837, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant224"), "variant224")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 838, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant225"), "variant225")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 839, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant226"), "variant226")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 840, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant227"), "variant227")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 841, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant228"), "variant228")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 842, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant229"), "variant229")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 843, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant230"), "variant230")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 844, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant231"), "variant231")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 845, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant232"), "variant232")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 846, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant233"), "variant233")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 847, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant234"), "variant234")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 848, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant235"), "variant235")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 849, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant236"), "variant236")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 850, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant237"), "variant237")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 851, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant238"), "variant238")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 852, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant239"), "variant239")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 853, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant240"), "variant240")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 854, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant241"), "variant241")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 855, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant242"), "variant242")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 856, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant243"), "variant243")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 857, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant244"), "variant244")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 858, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant245"), "variant245")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 859, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant246"), "variant246")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 860, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant247"), "variant247")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 861, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant248"), "variant248")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 862, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant249"), "variant249")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 863, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant250"), "variant250")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 864, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant251"), "variant251")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 865, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant252"), "variant252")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 866, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant253"), "variant253")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 867, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant254"), "variant254")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 868, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant255"), "variant255")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 869, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant256"), "variant256")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 870, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant257"), "variant257")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 871, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant258"), "variant258")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 872, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant259"), "variant259")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 873, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant260"), "variant260")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 874, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant261"), "variant261")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 875, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant262"), "variant262")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 876, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant263"), "variant263")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 877, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant264"), "variant264")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 878, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant265"), "variant265")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 879, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant266"), "variant266")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 880, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant267"), "variant267")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 881, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant268"), "variant268")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 882, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant269"), "variant269")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 883, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant270"), "variant270")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 884, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant271"), "variant271")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 885, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant272"), "variant272")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 886, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant273"), "variant273")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 887, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant274"), "variant274")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 888, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant275"), "variant275")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 889, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant276"), "variant276")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 890, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant277"), "variant277")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 891, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant278"), "variant278")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 892, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant279"), "variant279")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 893, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant280"), "variant280")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 894, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant281"), "variant281")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 895, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant282"), "variant282")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 896, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant283"), "variant283")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 897, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant284"), "variant284")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 898, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant285"), "variant285")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 899, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant286"), "variant286")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 900, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant287"), "variant287")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 901, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant288"), "variant288")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 902, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant289"), "variant289")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 903, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant290"), "variant290")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 904, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant291"), "variant291")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 905, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant292"), "variant292")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 906, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant293"), "variant293")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 907, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant294"), "variant294")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 908, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant295"), "variant295")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 909, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant296"), "variant296")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 910, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant297"), "variant297")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 911, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant298"), "variant298")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 912, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("variant299"), "variant299")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 913, + 0 + ], + Error: new Error() + }; +} + +if (!eq(tFromJs("xx"), undefined)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "big_polyvar_test.res", + 914, + 0 + ], + Error: new Error() + }; +} + +export { + tToJs, + tFromJs, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/bigint_test.js b/tests/tests/src/bigint_test.js deleted file mode 100644 index 119f102f48..0000000000 --- a/tests/tests/src/bigint_test.js +++ /dev/null @@ -1,180 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Mt_global = require("./mt_global.js"); -let Primitive_bigint = require("rescript/lib/js/Primitive_bigint.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let test_id = { - contents: 0 -}; - -let suites = { - contents: /* [] */0 -}; - -function eq(loc, x, y) { - Mt_global.collect_eq(test_id, suites, loc, x, y); -} - -function approx(loc, x, y) { - Mt_global.collect_approx(test_id, suites, loc, x, y); -} - -let bigint_compare = Primitive_bigint.compare; - -let generic_compare = Primitive_object.compare; - -function bigint_equal(x, y) { - return x === y; -} - -let generic_equal = Primitive_object.equal; - -function bigint_notequal(x, y) { - return x !== y; -} - -let generic_notequal = Primitive_object.notequal; - -function bigint_lessthan(x, y) { - return x < y; -} - -let generic_lessthan = Primitive_object.lessthan; - -function bigint_greaterthan(x, y) { - return x > y; -} - -let generic_greaterthan = Primitive_object.greaterthan; - -function bigint_lessequal(x, y) { - return x <= y; -} - -let generic_lessequal = Primitive_object.lessequal; - -function bigint_greaterequal(x, y) { - return x >= y; -} - -let generic_greaterequal = Primitive_object.greaterequal; - -function bigint_land(prim0, prim1) { - return prim0 & prim1; -} - -function bigint_lor(prim0, prim1) { - return prim0 | prim1; -} - -function bigint_lxor(prim0, prim1) { - return prim0 ^ prim1; -} - -function bigint_lsl(prim0, prim1) { - return (prim0 << prim1); -} - -function bigint_asr(prim0, prim1) { - return (prim0 >> prim1); -} - -eq("File \"bigint_test.res\", line 26, characters 5-12", Primitive_bigint.compare(1n, 1n), 0); - -eq("File \"bigint_test.res\", line 27, characters 5-12", Primitive_object.compare(1n, 1n), 0); - -eq("File \"bigint_test.res\", line 28, characters 5-12", Primitive_bigint.compare(-0n, -1n), 1); - -eq("File \"bigint_test.res\", line 29, characters 5-12", Primitive_object.compare(-0n, -1n), 1); - -eq("File \"bigint_test.res\", line 30, characters 5-12", Primitive_bigint.compare(0n, -1n), 1); - -eq("File \"bigint_test.res\", line 31, characters 5-12", Primitive_object.compare(0n, -1n), 1); - -eq("File \"bigint_test.res\", line 32, characters 5-12", Primitive_bigint.compare(1n, 2n), -1); - -eq("File \"bigint_test.res\", line 33, characters 5-12", Primitive_object.compare(1n, 2n), -1); - -eq("File \"bigint_test.res\", line 34, characters 5-12", Primitive_bigint.compare(1n, 2n), -1); - -eq("File \"bigint_test.res\", line 35, characters 5-12", Primitive_object.compare(1n, 2n), -1); - -eq("File \"bigint_test.res\", line 36, characters 5-12", Primitive_bigint.compare(1n, 1n), 0); - -eq("File \"bigint_test.res\", line 37, characters 5-12", Primitive_object.compare(1n, 1n), 0); - -eq("File \"bigint_test.res\", line 39, characters 4-11", true, true); - -eq("File \"bigint_test.res\", line 47, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true); - -eq("File \"bigint_test.res\", line 55, characters 4-11", false, false); - -eq("File \"bigint_test.res\", line 63, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false); - -eq("File \"bigint_test.res\", line 71, characters 4-11", false, false); - -eq("File \"bigint_test.res\", line 79, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false); - -eq("File \"bigint_test.res\", line 87, characters 4-11", true, true); - -eq("File \"bigint_test.res\", line 99, characters 4-11", Primitive_object.equal(3n, 3n), true); - -eq("File \"bigint_test.res\", line 111, characters 4-11", true, true); - -eq("File \"bigint_test.res\", line 123, characters 4-11", Primitive_object.equal(3n, 3n), true); - -eq("File \"bigint_test.res\", line 135, characters 4-11", true, true); - -eq("File \"bigint_test.res\", line 147, characters 4-11", Primitive_object.equal(3n, 3n), true); - -eq("File \"bigint_test.res\", line 158, characters 5-12", 9n & 1n, 1n); - -eq("File \"bigint_test.res\", line 159, characters 5-12", 9n | 1n, 9n); - -eq("File \"bigint_test.res\", line 160, characters 5-12", 9n ^ 1n, 8n); - -eq("File \"bigint_test.res\", line 161, characters 5-12", (9n << 1n), 18n); - -eq("File \"bigint_test.res\", line 162, characters 5-12", (9n << -1n), 4n); - -eq("File \"bigint_test.res\", line 163, characters 5-12", (9n >> 1n), 4n); - -eq("File \"bigint_test.res\", line 164, characters 5-12", (9n >> -1n), 18n); - -eq("File \"bigint_test.res\", line 165, characters 5-12", (-9n >> 1n), -5n); - -eq("File \"bigint_test.res\", line 166, characters 5-12", (-9n >> -1n), -18n); - -eq("File \"bigint_test.res\", line 167, characters 5-12", 9n > 1n ? 9n : 1n, 9n); - -eq("File \"bigint_test.res\", line 168, characters 5-12", 9n < 1n ? 9n : 1n, 1n); - -Mt.from_pair_suites("Bigint_test", suites.contents); - -exports.test_id = test_id; -exports.suites = suites; -exports.eq = eq; -exports.approx = approx; -exports.bigint_compare = bigint_compare; -exports.generic_compare = generic_compare; -exports.bigint_equal = bigint_equal; -exports.generic_equal = generic_equal; -exports.bigint_notequal = bigint_notequal; -exports.generic_notequal = generic_notequal; -exports.bigint_lessthan = bigint_lessthan; -exports.generic_lessthan = generic_lessthan; -exports.bigint_greaterthan = bigint_greaterthan; -exports.generic_greaterthan = generic_greaterthan; -exports.bigint_lessequal = bigint_lessequal; -exports.generic_lessequal = generic_lessequal; -exports.bigint_greaterequal = bigint_greaterequal; -exports.generic_greaterequal = generic_greaterequal; -exports.bigint_land = bigint_land; -exports.bigint_lor = bigint_lor; -exports.bigint_lxor = bigint_lxor; -exports.bigint_lsl = bigint_lsl; -exports.bigint_asr = bigint_asr; -/* Not a pure module */ diff --git a/tests/tests/src/bigint_test.mjs b/tests/tests/src/bigint_test.mjs new file mode 100644 index 0000000000..70f398040d --- /dev/null +++ b/tests/tests/src/bigint_test.mjs @@ -0,0 +1,181 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Mt_global from "./mt_global.mjs"; +import * as Primitive_bigint from "rescript/lib/es6/Primitive_bigint.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let test_id = { + contents: 0 +}; + +let suites = { + contents: /* [] */0 +}; + +function eq(loc, x, y) { + Mt_global.collect_eq(test_id, suites, loc, x, y); +} + +function approx(loc, x, y) { + Mt_global.collect_approx(test_id, suites, loc, x, y); +} + +let bigint_compare = Primitive_bigint.compare; + +let generic_compare = Primitive_object.compare; + +function bigint_equal(x, y) { + return x === y; +} + +let generic_equal = Primitive_object.equal; + +function bigint_notequal(x, y) { + return x !== y; +} + +let generic_notequal = Primitive_object.notequal; + +function bigint_lessthan(x, y) { + return x < y; +} + +let generic_lessthan = Primitive_object.lessthan; + +function bigint_greaterthan(x, y) { + return x > y; +} + +let generic_greaterthan = Primitive_object.greaterthan; + +function bigint_lessequal(x, y) { + return x <= y; +} + +let generic_lessequal = Primitive_object.lessequal; + +function bigint_greaterequal(x, y) { + return x >= y; +} + +let generic_greaterequal = Primitive_object.greaterequal; + +function bigint_land(prim0, prim1) { + return prim0 & prim1; +} + +function bigint_lor(prim0, prim1) { + return prim0 | prim1; +} + +function bigint_lxor(prim0, prim1) { + return prim0 ^ prim1; +} + +function bigint_lsl(prim0, prim1) { + return (prim0 << prim1); +} + +function bigint_asr(prim0, prim1) { + return (prim0 >> prim1); +} + +eq("File \"bigint_test.res\", line 26, characters 5-12", Primitive_bigint.compare(1n, 1n), 0); + +eq("File \"bigint_test.res\", line 27, characters 5-12", Primitive_object.compare(1n, 1n), 0); + +eq("File \"bigint_test.res\", line 28, characters 5-12", Primitive_bigint.compare(-0n, -1n), 1); + +eq("File \"bigint_test.res\", line 29, characters 5-12", Primitive_object.compare(-0n, -1n), 1); + +eq("File \"bigint_test.res\", line 30, characters 5-12", Primitive_bigint.compare(0n, -1n), 1); + +eq("File \"bigint_test.res\", line 31, characters 5-12", Primitive_object.compare(0n, -1n), 1); + +eq("File \"bigint_test.res\", line 32, characters 5-12", Primitive_bigint.compare(1n, 2n), -1); + +eq("File \"bigint_test.res\", line 33, characters 5-12", Primitive_object.compare(1n, 2n), -1); + +eq("File \"bigint_test.res\", line 34, characters 5-12", Primitive_bigint.compare(1n, 2n), -1); + +eq("File \"bigint_test.res\", line 35, characters 5-12", Primitive_object.compare(1n, 2n), -1); + +eq("File \"bigint_test.res\", line 36, characters 5-12", Primitive_bigint.compare(1n, 1n), 0); + +eq("File \"bigint_test.res\", line 37, characters 5-12", Primitive_object.compare(1n, 1n), 0); + +eq("File \"bigint_test.res\", line 39, characters 4-11", true, true); + +eq("File \"bigint_test.res\", line 47, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), true); + +eq("File \"bigint_test.res\", line 55, characters 4-11", false, false); + +eq("File \"bigint_test.res\", line 63, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, 1000000000000000000000000000000000000000000000000000000000000000000000000000000000001n), false); + +eq("File \"bigint_test.res\", line 71, characters 4-11", false, false); + +eq("File \"bigint_test.res\", line 79, characters 4-11", Primitive_object.equal(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000n), false); + +eq("File \"bigint_test.res\", line 87, characters 4-11", true, true); + +eq("File \"bigint_test.res\", line 99, characters 4-11", Primitive_object.equal(3n, 3n), true); + +eq("File \"bigint_test.res\", line 111, characters 4-11", true, true); + +eq("File \"bigint_test.res\", line 123, characters 4-11", Primitive_object.equal(3n, 3n), true); + +eq("File \"bigint_test.res\", line 135, characters 4-11", true, true); + +eq("File \"bigint_test.res\", line 147, characters 4-11", Primitive_object.equal(3n, 3n), true); + +eq("File \"bigint_test.res\", line 158, characters 5-12", 9n & 1n, 1n); + +eq("File \"bigint_test.res\", line 159, characters 5-12", 9n | 1n, 9n); + +eq("File \"bigint_test.res\", line 160, characters 5-12", 9n ^ 1n, 8n); + +eq("File \"bigint_test.res\", line 161, characters 5-12", (9n << 1n), 18n); + +eq("File \"bigint_test.res\", line 162, characters 5-12", (9n << -1n), 4n); + +eq("File \"bigint_test.res\", line 163, characters 5-12", (9n >> 1n), 4n); + +eq("File \"bigint_test.res\", line 164, characters 5-12", (9n >> -1n), 18n); + +eq("File \"bigint_test.res\", line 165, characters 5-12", (-9n >> 1n), -5n); + +eq("File \"bigint_test.res\", line 166, characters 5-12", (-9n >> -1n), -18n); + +eq("File \"bigint_test.res\", line 167, characters 5-12", 9n > 1n ? 9n : 1n, 9n); + +eq("File \"bigint_test.res\", line 168, characters 5-12", 9n < 1n ? 9n : 1n, 1n); + +Mt.from_pair_suites("Bigint_test", suites.contents); + +export { + test_id, + suites, + eq, + approx, + bigint_compare, + generic_compare, + bigint_equal, + generic_equal, + bigint_notequal, + generic_notequal, + bigint_lessthan, + generic_lessthan, + bigint_greaterthan, + generic_greaterthan, + bigint_lessequal, + generic_lessequal, + bigint_greaterequal, + generic_greaterequal, + bigint_land, + bigint_lor, + bigint_lxor, + bigint_lsl, + bigint_asr, +} +/* Not a pure module */ diff --git a/tests/tests/src/block_alias_test.js b/tests/tests/src/block_alias_test.js deleted file mode 100644 index 269bf86b1c..0000000000 --- a/tests/tests/src/block_alias_test.js +++ /dev/null @@ -1,86 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.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); -} - -let Block = {}; - -let v0 = { - TAG: "A", - _0: 0, - _1: 1 -}; - -let Block$1 = {}; - -let v1 = { - TAG: "A", - _0: 0, - _1: 1 -}; - -let N = { - Block: Block$1, - v1: v1 -}; - -let Caml_obj = {}; - -let List = {}; - -let V = { - List: List -}; - -let f = Primitive_object.equal; - -eq("File \"block_alias_test.res\", line 27, characters 3-10", Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}), 2); - -b("File \"block_alias_test.res\", line 28, characters 2-9", Primitive_object.equal(v0, { - TAG: "A", - _0: 0, - _1: 1 -})); - -eq("File \"block_alias_test.res\", line 29, characters 3-10", v0, v1); - -Mt.from_pair_suites("Block_alias_test", suites.contents); - -let h = Belt_List.length; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.Block = Block; -exports.v0 = v0; -exports.N = N; -exports.Caml_obj = Caml_obj; -exports.V = V; -exports.f = f; -exports.h = h; -/* Not a pure module */ diff --git a/tests/tests/src/block_alias_test.mjs b/tests/tests/src/block_alias_test.mjs new file mode 100644 index 0000000000..082fe3f1a2 --- /dev/null +++ b/tests/tests/src/block_alias_test.mjs @@ -0,0 +1,87 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.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); +} + +let Block = {}; + +let v0 = { + TAG: "A", + _0: 0, + _1: 1 +}; + +let Block$1 = {}; + +let v1 = { + TAG: "A", + _0: 0, + _1: 1 +}; + +let N = { + Block: Block$1, + v1: v1 +}; + +let Caml_obj = {}; + +let List = {}; + +let V = { + List: List +}; + +let f = Primitive_object.equal; + +eq("File \"block_alias_test.res\", line 27, characters 3-10", Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}), 2); + +b("File \"block_alias_test.res\", line 28, characters 2-9", Primitive_object.equal(v0, { + TAG: "A", + _0: 0, + _1: 1 +})); + +eq("File \"block_alias_test.res\", line 29, characters 3-10", v0, v1); + +Mt.from_pair_suites("Block_alias_test", suites.contents); + +let h = Belt_List.length; + +export { + suites, + test_id, + eq, + b, + Block, + v0, + N, + Caml_obj, + V, + f, + h, +} +/* Not a pure module */ diff --git a/tests/tests/src/boolean_test.js b/tests/tests/src/boolean_test.js deleted file mode 100644 index ccf8ee22db..0000000000 --- a/tests/tests/src/boolean_test.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Test_bool_equal = require("./test_bool_equal.js"); - -Mt.from_suites("boolean", { - hd: [ - "bool_equal", - Test_bool_equal.assertions - ], - tl: /* [] */0 -}); - -/* Not a pure module */ diff --git a/tests/tests/src/boolean_test.mjs b/tests/tests/src/boolean_test.mjs new file mode 100644 index 0000000000..fe37c3cc45 --- /dev/null +++ b/tests/tests/src/boolean_test.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Test_bool_equal from "./test_bool_equal.mjs"; + +Mt.from_suites("boolean", { + hd: [ + "bool_equal", + Test_bool_equal.assertions + ], + tl: /* [] */0 +}); + +/* Not a pure module */ diff --git a/tests/tests/src/bs_abstract_test.js b/tests/tests/src/bs_abstract_test.js deleted file mode 100644 index 9ce29796a9..0000000000 --- a/tests/tests/src/bs_abstract_test.js +++ /dev/null @@ -1,58 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = { - hd: 3, - tl: null -}; - -v.tl = v; - -let f = { - k: (x, y) => x === y, - y: "x" -}; - -function uf(u) { - return u.y0(1); -} - -function uf1(u) { - return extra => u.y1(1, extra); -} - -function uf2(u) { - return u.y1(1, 2); -} - -function uff(f) { - return f.yyyy(1); -} - -function uff2(f) { - return f.yyyy1(1, 2); -} - -function uff3(f) { - let x = f.yyyy2; - if (x !== undefined) { - return x(0); - } else { - return 0; - } -} - -function fx(v) { - return v.x; -} - -exports.f = f; -exports.uf = uf; -exports.uf1 = uf1; -exports.uf2 = uf2; -exports.uff = uff; -exports.uff2 = uff2; -exports.uff3 = uff3; -exports.fx = fx; -/* Not a pure module */ diff --git a/tests/tests/src/bs_abstract_test.mjs b/tests/tests/src/bs_abstract_test.mjs new file mode 100644 index 0000000000..e18570117c --- /dev/null +++ b/tests/tests/src/bs_abstract_test.mjs @@ -0,0 +1,59 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = { + hd: 3, + tl: null +}; + +v.tl = v; + +let f = { + k: (x, y) => x === y, + y: "x" +}; + +function uf(u) { + return u.y0(1); +} + +function uf1(u) { + return extra => u.y1(1, extra); +} + +function uf2(u) { + return u.y1(1, 2); +} + +function uff(f) { + return f.yyyy(1); +} + +function uff2(f) { + return f.yyyy1(1, 2); +} + +function uff3(f) { + let x = f.yyyy2; + if (x !== undefined) { + return x(0); + } else { + return 0; + } +} + +function fx(v) { + return v.x; +} + +export { + f, + uf, + uf1, + uf2, + uff, + uff2, + uff3, + fx, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_array_test.js b/tests/tests/src/bs_array_test.js deleted file mode 100644 index 5b96a4e398..0000000000 --- a/tests/tests/src/bs_array_test.js +++ /dev/null @@ -1,1416 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.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 neq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Neq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function push(prim0, prim1) { - prim0.push(prim1); -} - -console.log([ - 1, - 2, - 3, - 4 -].filter(x => x > 2).map((x, i) => x + i | 0).reduce((x, y) => x + y | 0, 0)); - -let v = [ - 1, - 2 -]; - -eq("File \"bs_array_test.res\", line 31, characters 4-11", [ - Belt_Array.get(v, 0), - Belt_Array.get(v, 1), - Belt_Array.get(v, 2), - Belt_Array.get(v, 3), - Belt_Array.get(v, -1) -], [ - 1, - 2, - undefined, - undefined, - undefined -]); - -$$throw("File \"bs_array_test.res\", line 35, characters 8-15", () => { - Belt_Array.getExn([ - 0, - 1 - ], -1); -}); - -$$throw("File \"bs_array_test.res\", line 36, characters 8-15", () => { - Belt_Array.getExn([ - 0, - 1 - ], 2); -}); - -function f(extra) { - return Belt_Array.getExn([ - 0, - 1 - ], extra); -} - -b("File \"bs_array_test.res\", line 38, characters 4-11", Primitive_object.equal([ - f(0), - f(1) -], [ - 0, - 1 -])); - -$$throw("File \"bs_array_test.res\", line 44, characters 8-15", () => Belt_Array.setExn([ - 0, - 1 -], -1, 0)); - -$$throw("File \"bs_array_test.res\", line 45, characters 8-15", () => Belt_Array.setExn([ - 0, - 1 -], 2, 0)); - -b("File \"bs_array_test.res\", line 46, characters 4-11", !Belt_Array.set([ - 1, - 2 -], 2, 0)); - -let v$1 = [ - 1, - 2 -]; - -if (!Belt_Array.set(v$1, 0, 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 51, - 6 - ], - Error: new Error() - }; -} - -b("File \"bs_array_test.res\", line 48, characters 4-11", Belt_Array.getExn(v$1, 0) === 0); - -let v$2 = [ - 1, - 2 -]; - -if (!Belt_Array.set(v$2, 1, 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 59, - 6 - ], - Error: new Error() - }; -} - -b("File \"bs_array_test.res\", line 56, characters 4-11", Belt_Array.getExn(v$2, 1) === 0); - -let v$3 = [ - 1, - 2 -]; - -b("File \"bs_array_test.res\", line 64, characters 4-11", (Belt_Array.setExn(v$3, 0, 0), Belt_Array.getExn(v$3, 0) === 0)); - -let v$4 = [ - 1, - 2 -]; - -b("File \"bs_array_test.res\", line 72, characters 4-11", (Belt_Array.setExn(v$4, 1, 0), Belt_Array.getExn(v$4, 1) === 0)); - -function add(x, y) { - return x + y | 0; -} - -let v$5 = Belt_Array.makeBy(3000, i => i); - -let u = Belt_Array.shuffle(v$5); - -neq("File \"bs_array_test.res\", line 85, characters 6-13", u, v$5); - -eq("File \"bs_array_test.res\", line 87, characters 5-12", Belt_Array.reduce(u, 0, add), Belt_Array.reduce(v$5, 0, add)); - -b("File \"bs_array_test.res\", line 92, characters 4-11", Primitive_object.equal(Belt_Array.range(0, 3), [ - 0, - 1, - 2, - 3 -])); - -b("File \"bs_array_test.res\", line 93, characters 4-11", Primitive_object.equal(Belt_Array.range(3, 0), [])); - -b("File \"bs_array_test.res\", line 94, characters 4-11", Primitive_object.equal(Belt_Array.range(3, 3), [3])); - -b("File \"bs_array_test.res\", line 96, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(0, 10, 3), [ - 0, - 3, - 6, - 9 -])); - -b("File \"bs_array_test.res\", line 97, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(0, 12, 3), [ - 0, - 3, - 6, - 9, - 12 -])); - -b("File \"bs_array_test.res\", line 98, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(33, 0, 1), [])); - -b("File \"bs_array_test.res\", line 99, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(33, 0, -1), [])); - -b("File \"bs_array_test.res\", line 100, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 12, -1), [])); - -b("File \"bs_array_test.res\", line 101, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 3, 0), [])); - -b("File \"bs_array_test.res\", line 102, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 3, 1), [3])); - -eq("File \"bs_array_test.res\", line 106, characters 5-12", Belt_Array.reduceReverse([], 100, (prim0, prim1) => prim0 - prim1 | 0), 100); - -eq("File \"bs_array_test.res\", line 107, characters 5-12", Belt_Array.reduceReverse([ - 1, - 2 -], 100, (prim0, prim1) => prim0 - prim1 | 0), 97); - -eq("File \"bs_array_test.res\", line 108, characters 5-12", Belt_Array.reduceReverse([ - 1, - 2, - 3, - 4 -], 100, (prim0, prim1) => prim0 - prim1 | 0), 90); - -eq("File \"bs_array_test.res\", line 109, characters 5-12", Belt_Array.reduceWithIndex([ - 1, - 2, - 3, - 4 -], 0, (acc, x, i) => (acc + x | 0) + i | 0), 16); - -b("File \"bs_array_test.res\", line 110, characters 4-11", Belt_Array.reduceReverse2([ - 1, - 2, - 3 -], [ - 1, - 2 -], 0, (acc, x, y) => (acc + x | 0) + y | 0) === 6); - -function addone(x) { - return x + 1 | 0; -} - -function makeMatrixExn(sx, sy, init) { - if (!(sx >= 0 && sy >= 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_array_test.res", - 116, - 2 - ], - Error: new Error() - }; - } - let res = new Array(sx); - for (let x = 0; x < sx; ++x) { - let initY = new Array(sy); - for (let y = 0; y < sy; ++y) { - initY[y] = init; - } - res[x] = initY; - } - return res; -} - -eq("File \"bs_array_test.res\", line 129, characters 5-12", Belt_Array.makeBy(0, param => 1), []); - -eq("File \"bs_array_test.res\", line 130, characters 5-12", Belt_Array.makeBy(3, i => i), [ - 0, - 1, - 2 -]); - -eq("File \"bs_array_test.res\", line 131, characters 5-12", makeMatrixExn(3, 4, 1), [ - [ - 1, - 1, - 1, - 1 - ], - [ - 1, - 1, - 1, - 1 - ], - [ - 1, - 1, - 1, - 1 - ] -]); - -eq("File \"bs_array_test.res\", line 132, characters 5-12", makeMatrixExn(3, 0, 0), [ - [], - [], - [] -]); - -eq("File \"bs_array_test.res\", line 133, characters 5-12", makeMatrixExn(0, 3, 1), []); - -eq("File \"bs_array_test.res\", line 134, characters 5-12", makeMatrixExn(1, 1, 1), [[1]]); - -eq("File \"bs_array_test.res\", line 135, characters 5-12", [].slice(0), []); - -eq("File \"bs_array_test.res\", line 136, characters 5-12", Belt_Array.map([], prim => prim + 1 | 0), []); - -eq("File \"bs_array_test.res\", line 137, characters 5-12", Belt_Array.mapWithIndex([], add), []); - -eq("File \"bs_array_test.res\", line 138, characters 5-12", Belt_Array.mapWithIndex([ - 1, - 2, - 3 -], add), [ - 1, - 3, - 5 -]); - -eq("File \"bs_array_test.res\", line 139, characters 5-12", Belt_List.fromArray([]), /* [] */0); - -eq("File \"bs_array_test.res\", line 140, characters 5-12", Belt_List.fromArray([1]), { - hd: 1, - tl: /* [] */0 -}); - -eq("File \"bs_array_test.res\", line 141, characters 5-12", Belt_List.fromArray([ - 1, - 2, - 3 -]), { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}); - -eq("File \"bs_array_test.res\", line 142, characters 5-12", Belt_Array.map([ - 1, - 2, - 3 -], prim => prim + 1 | 0), [ - 2, - 3, - 4 -]); - -eq("File \"bs_array_test.res\", line 143, characters 5-12", Belt_List.toArray(/* [] */0), []); - -eq("File \"bs_array_test.res\", line 144, characters 5-12", Belt_List.toArray({ - hd: 1, - tl: /* [] */0 -}), [1]); - -eq("File \"bs_array_test.res\", line 145, characters 5-12", Belt_List.toArray({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}), [ - 1, - 2 -]); - -eq("File \"bs_array_test.res\", line 146, characters 5-12", Belt_List.toArray({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}), [ - 1, - 2, - 3 -]); - -let v$6 = Belt_Array.makeBy(10, i => i); - -let v0 = Belt_Array.keep(v$6, x => x % 2 === 0); - -let v1 = Belt_Array.keep(v$6, x => x % 3 === 0); - -let v2 = Belt_Array.keepMap(v$6, x => { - if (x % 2 === 0) { - return x + 1 | 0; - } - -}); - -eq("File \"bs_array_test.res\", line 160, characters 5-12", v0, [ - 0, - 2, - 4, - 6, - 8 -]); - -eq("File \"bs_array_test.res\", line 161, characters 5-12", v1, [ - 0, - 3, - 6, - 9 -]); - -eq("File \"bs_array_test.res\", line 162, characters 5-12", v2, [ - 1, - 3, - 5, - 7, - 9 -]); - -let a = [ - 1, - 2, - 3, - 4, - 5 -]; - -let match = Belt_Array.partition(a, x => x % 2 === 0); - -eq("File \"bs_array_test.res\", line 168, characters 5-12", match[0], [ - 2, - 4 -]); - -eq("File \"bs_array_test.res\", line 169, characters 5-12", match[1], [ - 1, - 3, - 5 -]); - -let match$1 = Belt_Array.partition(a, x => x === 2); - -eq("File \"bs_array_test.res\", line 171, characters 5-12", match$1[0], [2]); - -eq("File \"bs_array_test.res\", line 172, characters 5-12", match$1[1], [ - 1, - 3, - 4, - 5 -]); - -let match$2 = Belt_Array.partition([], x => false); - -eq("File \"bs_array_test.res\", line 174, characters 5-12", match$2[0], []); - -eq("File \"bs_array_test.res\", line 175, characters 5-12", match$2[1], []); - -let a$1 = [ - 1, - 2, - 3, - 4, - 5 -]; - -eq("File \"bs_array_test.res\", line 180, characters 5-12", Belt_Array.slice(a$1, 0, 2), [ - 1, - 2 -]); - -eq("File \"bs_array_test.res\", line 181, characters 5-12", Belt_Array.slice(a$1, 0, 5), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 182, characters 5-12", Belt_Array.slice(a$1, 0, 15), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 183, characters 5-12", Belt_Array.slice(a$1, 5, 1), []); - -eq("File \"bs_array_test.res\", line 184, characters 5-12", Belt_Array.slice(a$1, 4, 1), [5]); - -eq("File \"bs_array_test.res\", line 185, characters 5-12", Belt_Array.slice(a$1, -1, 1), [5]); - -eq("File \"bs_array_test.res\", line 186, characters 5-12", Belt_Array.slice(a$1, -1, 2), [5]); - -eq("File \"bs_array_test.res\", line 187, characters 5-12", Belt_Array.slice(a$1, -2, 1), [4]); - -eq("File \"bs_array_test.res\", line 188, characters 5-12", Belt_Array.slice(a$1, -2, 2), [ - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 189, characters 5-12", Belt_Array.slice(a$1, -2, 3), [ - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 190, characters 5-12", Belt_Array.slice(a$1, -10, 3), [ - 1, - 2, - 3 -]); - -eq("File \"bs_array_test.res\", line 191, characters 5-12", Belt_Array.slice(a$1, -10, 4), [ - 1, - 2, - 3, - 4 -]); - -eq("File \"bs_array_test.res\", line 192, characters 5-12", Belt_Array.slice(a$1, -10, 5), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 193, characters 5-12", Belt_Array.slice(a$1, -10, 6), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 194, characters 5-12", Belt_Array.slice(a$1, 0, 0), []); - -eq("File \"bs_array_test.res\", line 195, characters 5-12", Belt_Array.slice(a$1, 0, -1), []); - -let a$2 = [ - 1, - 2, - 3, - 4, - 5 -]; - -eq("File \"bs_array_test.res\", line 200, characters 5-12", Belt_Array.sliceToEnd(a$2, 0), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 201, characters 5-12", Belt_Array.sliceToEnd(a$2, 5), []); - -eq("File \"bs_array_test.res\", line 202, characters 5-12", Belt_Array.sliceToEnd(a$2, 4), [5]); - -eq("File \"bs_array_test.res\", line 203, characters 5-12", Belt_Array.sliceToEnd(a$2, -1), [5]); - -eq("File \"bs_array_test.res\", line 204, characters 5-12", Belt_Array.sliceToEnd(a$2, -2), [ - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 205, characters 5-12", Belt_Array.sliceToEnd(a$2, -10), [ - 1, - 2, - 3, - 4, - 5 -]); - -eq("File \"bs_array_test.res\", line 206, characters 5-12", Belt_Array.sliceToEnd(a$2, 6), []); - -let a$3 = Belt_Array.makeBy(10, x => x); - -Belt_Array.fill(a$3, 0, 3, 0); - -eq("File \"bs_array_test.res\", line 211, characters 5-12", a$3.slice(0), [ - 0, - 0, - 0, - 3, - 4, - 5, - 6, - 7, - 8, - 9 -]); - -Belt_Array.fill(a$3, 2, 8, 1); - -eq("File \"bs_array_test.res\", line 213, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 -]); - -Belt_Array.fill(a$3, 8, 1, 9); - -eq("File \"bs_array_test.res\", line 215, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 9, - 1 -]); - -Belt_Array.fill(a$3, 8, 2, 9); - -eq("File \"bs_array_test.res\", line 217, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 9, - 9 -]); - -Belt_Array.fill(a$3, 8, 3, 12); - -eq("File \"bs_array_test.res\", line 219, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 12, - 12 -]); - -Belt_Array.fill(a$3, -2, 3, 11); - -eq("File \"bs_array_test.res\", line 221, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 1, - 11, - 11 -]); - -Belt_Array.fill(a$3, -3, 3, 10); - -eq("File \"bs_array_test.res\", line 223, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 10, - 10, - 10 -]); - -Belt_Array.fill(a$3, -3, 1, 7); - -eq("File \"bs_array_test.res\", line 225, characters 5-12", a$3.slice(0), [ - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 7, - 10, - 10 -]); - -Belt_Array.fill(a$3, -13, 1, 7); - -eq("File \"bs_array_test.res\", line 227, characters 5-12", a$3.slice(0), [ - 7, - 0, - 1, - 1, - 1, - 1, - 1, - 7, - 10, - 10 -]); - -Belt_Array.fill(a$3, -13, 12, 7); - -eq("File \"bs_array_test.res\", line 229, characters 5-12", a$3.slice(0), Belt_Array.make(10, 7)); - -Belt_Array.fill(a$3, 0, -1, 2); - -eq("File \"bs_array_test.res\", line 231, characters 5-12", a$3.slice(0), Belt_Array.make(10, 7)); - -let b$1 = [ - 1, - 2, - 3 -]; - -Belt_Array.fill(b$1, 0, 0, 0); - -eq("File \"bs_array_test.res\", line 234, characters 5-12", b$1, [ - 1, - 2, - 3 -]); - -Belt_Array.fill(b$1, 4, 1, 0); - -eq("File \"bs_array_test.res\", line 236, characters 5-12", b$1, [ - 1, - 2, - 3 -]); - -let a0 = Belt_Array.makeBy(10, x => x); - -let b0 = Belt_Array.make(10, 3); - -Belt_Array.blit(a0, 1, b0, 2, 5); - -eq("File \"bs_array_test.res\", line 243, characters 5-12", b0.slice(0), [ - 3, - 3, - 1, - 2, - 3, - 4, - 5, - 3, - 3, - 3 -]); - -Belt_Array.blit(a0, -1, b0, 2, 5); - -eq("File \"bs_array_test.res\", line 245, characters 5-12", b0.slice(0), [ - 3, - 3, - 9, - 2, - 3, - 4, - 5, - 3, - 3, - 3 -]); - -Belt_Array.blit(a0, -1, b0, -2, 5); - -eq("File \"bs_array_test.res\", line 247, characters 5-12", b0.slice(0), [ - 3, - 3, - 9, - 2, - 3, - 4, - 5, - 3, - 9, - 3 -]); - -Belt_Array.blit(a0, -2, b0, -2, 2); - -eq("File \"bs_array_test.res\", line 249, characters 5-12", b0.slice(0), [ - 3, - 3, - 9, - 2, - 3, - 4, - 5, - 3, - 8, - 9 -]); - -Belt_Array.blit(a0, -11, b0, -11, 100); - -eq("File \"bs_array_test.res\", line 251, characters 5-12", b0.slice(0), a0); - -Belt_Array.blit(a0, -11, b0, -11, 2); - -eq("File \"bs_array_test.res\", line 253, characters 5-12", b0.slice(0), a0); - -let aa = Belt_Array.makeBy(10, x => x); - -Belt_Array.blit(aa, -1, aa, 1, 2); - -eq("File \"bs_array_test.res\", line 256, characters 5-12", aa.slice(0), [ - 0, - 9, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9 -]); - -Belt_Array.blit(aa, -2, aa, 1, 2); - -eq("File \"bs_array_test.res\", line 258, characters 5-12", aa.slice(0), [ - 0, - 8, - 9, - 3, - 4, - 5, - 6, - 7, - 8, - 9 -]); - -Belt_Array.blit(aa, -5, aa, 4, 3); - -eq("File \"bs_array_test.res\", line 260, characters 5-12", aa.slice(0), [ - 0, - 8, - 9, - 3, - 5, - 6, - 7, - 7, - 8, - 9 -]); - -Belt_Array.blit(aa, 4, aa, 5, 3); - -eq("File \"bs_array_test.res\", line 262, characters 5-12", aa.slice(0), [ - 0, - 8, - 9, - 3, - 5, - 5, - 6, - 7, - 8, - 9 -]); - -eq("File \"bs_array_test.res\", line 263, characters 5-12", Belt_Array.make(0, 3), []); - -eq("File \"bs_array_test.res\", line 264, characters 5-12", Belt_Array.make(-1, 3), []); - -let c = [ - 0, - 1, - 2 -]; - -Belt_Array.blit(c, 4, c, 1, 1); - -eq("File \"bs_array_test.res\", line 267, characters 5-12", c, [ - 0, - 1, - 2 -]); - -eq("File \"bs_array_test.res\", line 271, characters 5-12", Belt_Array.zip([ - 1, - 2, - 3 -], [ - 2, - 3, - 4, - 1 -]), [ - [ - 1, - 2 - ], - [ - 2, - 3 - ], - [ - 3, - 4 - ] -]); - -eq("File \"bs_array_test.res\", line 272, characters 5-12", Belt_Array.zip([ - 2, - 3, - 4, - 1 -], [ - 1, - 2, - 3 -]), [ - [ - 2, - 1 - ], - [ - 3, - 2 - ], - [ - 4, - 3 - ] -]); - -eq("File \"bs_array_test.res\", line 273, characters 5-12", Belt_Array.zipBy([ - 2, - 3, - 4, - 1 -], [ - 1, - 2, - 3 -], (prim0, prim1) => prim0 - prim1 | 0), [ - 1, - 1, - 1 -]); - -eq("File \"bs_array_test.res\", line 274, characters 5-12", Belt_Array.zipBy([ - 1, - 2, - 3 -], [ - 2, - 3, - 4, - 1 -], (prim0, prim1) => prim0 - prim1 | 0), Belt_Array.map([ - 1, - 1, - 1 -], x => -x | 0)); - -eq("File \"bs_array_test.res\", line 275, characters 5-12", Belt_Array.unzip([ - [ - 1, - 2 - ], - [ - 2, - 3 - ], - [ - 3, - 4 - ] -]), [ - [ - 1, - 2, - 3 - ], - [ - 2, - 3, - 4 - ] -]); - -function sumUsingForEach(xs) { - let v = { - contents: 0 - }; - Belt_Array.forEach(xs, x => { - v.contents = v.contents + x | 0; - }); - return v.contents; -} - -eq("File \"bs_array_test.res\", line 287, characters 5-12", sumUsingForEach([ - 0, - 1, - 2, - 3, - 4 -]), 10); - -b("File \"bs_array_test.res\", line 288, characters 4-11", !Belt_Array.every([ - 0, - 1, - 2, - 3, - 4 -], x => x > 2)); - -b("File \"bs_array_test.res\", line 289, characters 4-11", Belt_Array.some([ - 1, - 3, - 7, - 8 -], x => x % 2 === 0)); - -b("File \"bs_array_test.res\", line 290, characters 4-11", !Belt_Array.some([ - 1, - 3, - 7 -], x => x % 2 === 0)); - -b("File \"bs_array_test.res\", line 291, characters 4-11", !Belt_Array.eq([ - 0, - 1 -], [1], (prim0, prim1) => prim0 === prim1)); - -let c$1 = { - contents: 0 -}; - -b("File \"bs_array_test.res\", line 293, characters 4-11", (Belt_Array.forEachWithIndex([ - 1, - 1, - 1 -], (i, v) => { - c$1.contents = (c$1.contents + i | 0) + v | 0; -}), c$1.contents === 6)); - -function id(loc, x) { - let u = x.slice(0); - eq("File \"bs_array_test.res\", line 304, characters 4-11", Belt_Array.reverse(x), (Belt_Array.reverseInPlace(u), u)); -} - -id("File \"bs_array_test.res\", line 314, characters 5-12", []); - -id("File \"bs_array_test.res\", line 315, characters 5-12", [1]); - -id("File \"bs_array_test.res\", line 316, characters 5-12", [ - 1, - 2 -]); - -id("File \"bs_array_test.res\", line 317, characters 5-12", [ - 1, - 2, - 3 -]); - -id("File \"bs_array_test.res\", line 318, characters 5-12", [ - 1, - 2, - 3, - 4 -]); - -function every2(xs, ys, x) { - return Belt_Array.every2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); -} - -function some2(xs, ys, x) { - return Belt_Array.some2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); -} - -eq("File \"bs_array_test.res\", line 326, characters 5-12", every2(/* [] */0, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 327, characters 5-12", every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 328, characters 5-12", every2({ - hd: 2, - tl: /* [] */0 -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 329, characters 5-12", every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), false); - -eq("File \"bs_array_test.res\", line 330, characters 5-12", every2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 0, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 331, characters 5-12", some2(/* [] */0, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), false); - -eq("File \"bs_array_test.res\", line 332, characters 5-12", some2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: /* [] */0 -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 333, characters 5-12", some2({ - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 334, characters 5-12", some2({ - hd: 0, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 1, - tl: { - hd: 4, - tl: /* [] */0 - } -}, (x, y) => x > y), false); - -eq("File \"bs_array_test.res\", line 335, characters 5-12", some2({ - hd: 0, - tl: { - hd: 3, - tl: /* [] */0 - } -}, { - hd: 3, - tl: { - hd: 2, - tl: /* [] */0 - } -}, (x, y) => x > y), true); - -eq("File \"bs_array_test.res\", line 339, characters 5-12", Belt_Array.concat([], [ - 1, - 2, - 3 -]), [ - 1, - 2, - 3 -]); - -eq("File \"bs_array_test.res\", line 340, characters 5-12", Belt_Array.concat([], []), []); - -eq("File \"bs_array_test.res\", line 341, characters 5-12", Belt_Array.concat([ - 3, - 2 -], [ - 1, - 2, - 3 -]), [ - 3, - 2, - 1, - 2, - 3 -]); - -eq("File \"bs_array_test.res\", line 342, characters 5-12", Belt_Array.concatMany([ - [ - 3, - 2 - ], - [ - 1, - 2, - 3 - ] -]), [ - 3, - 2, - 1, - 2, - 3 -]); - -eq("File \"bs_array_test.res\", line 343, characters 5-12", Belt_Array.concatMany([ - [ - 3, - 2 - ], - [ - 1, - 2, - 3 - ], - [], - [0] -]), [ - 3, - 2, - 1, - 2, - 3, - 0 -]); - -eq("File \"bs_array_test.res\", line 344, characters 5-12", Belt_Array.concatMany([ - [], - [ - 3, - 2 - ], - [ - 1, - 2, - 3 - ], - [], - [0] -]), [ - 3, - 2, - 1, - 2, - 3, - 0 -]); - -eq("File \"bs_array_test.res\", line 345, characters 5-12", Belt_Array.concatMany([ - [], - [] -]), []); - -b("File \"bs_array_test.res\", line 349, characters 4-11", Belt_Array.cmp([ - 1, - 2, - 3 -], [ - 0, - 1, - 2, - 3 -], Primitive_int.compare) < 0); - -b("File \"bs_array_test.res\", line 350, characters 4-11", Belt_Array.cmp([ - 0, - 1, - 2, - 3 -], [ - 1, - 2, - 3 -], Primitive_int.compare) > 0); - -b("File \"bs_array_test.res\", line 351, characters 4-11", Belt_Array.cmp([ - 1, - 2, - 3 -], [ - 0, - 1, - 2 -], Primitive_int.compare) > 0); - -b("File \"bs_array_test.res\", line 352, characters 4-11", Belt_Array.cmp([ - 1, - 2, - 3 -], [ - 1, - 2, - 3 -], Primitive_int.compare) === 0); - -b("File \"bs_array_test.res\", line 353, characters 4-11", Belt_Array.cmp([ - 1, - 2, - 4 -], [ - 1, - 2, - 3 -], Primitive_int.compare) > 0); - -eq("File \"bs_array_test.res\", line 357, characters 5-12", Belt_Array.getBy([ - 1, - 2, - 3 -], x => x > 1), 2); - -eq("File \"bs_array_test.res\", line 358, characters 5-12", Belt_Array.getBy([ - 1, - 2, - 3 -], x => x > 3), undefined); - -eq("File \"bs_array_test.res\", line 362, characters 5-12", Belt_Array.getIndexBy([ - 1, - 2, - 3 -], x => x > 1), 1); - -eq("File \"bs_array_test.res\", line 363, characters 5-12", Belt_Array.getIndexBy([ - 1, - 2, - 3 -], x => x > 3), undefined); - -let arr = []; - -arr.push(3); - -arr.push(2); - -arr.push(1); - -eq("File \"bs_array_test.res\", line 371, characters 5-12", arr, [ - 3, - 2, - 1 -]); - -Mt.from_pair_suites("File \"bs_array_test.res\", line 374, characters 20-27", suites.contents); - -let A; - -let L; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.$$throw = $$throw; -exports.neq = neq; -exports.A = A; -exports.L = L; -exports.push = push; -exports.add = add; -exports.addone = addone; -exports.makeMatrixExn = makeMatrixExn; -exports.sumUsingForEach = sumUsingForEach; -exports.id = id; -/* Not a pure module */ diff --git a/tests/tests/src/bs_array_test.mjs b/tests/tests/src/bs_array_test.mjs new file mode 100644 index 0000000000..3aa3a01f3e --- /dev/null +++ b/tests/tests/src/bs_array_test.mjs @@ -0,0 +1,1417 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.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 neq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Neq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function push(prim0, prim1) { + prim0.push(prim1); +} + +console.log([ + 1, + 2, + 3, + 4 +].filter(x => x > 2).map((x, i) => x + i | 0).reduce((x, y) => x + y | 0, 0)); + +let v = [ + 1, + 2 +]; + +eq("File \"bs_array_test.res\", line 31, characters 4-11", [ + Belt_Array.get(v, 0), + Belt_Array.get(v, 1), + Belt_Array.get(v, 2), + Belt_Array.get(v, 3), + Belt_Array.get(v, -1) +], [ + 1, + 2, + undefined, + undefined, + undefined +]); + +$$throw("File \"bs_array_test.res\", line 35, characters 8-15", () => { + Belt_Array.getExn([ + 0, + 1 + ], -1); +}); + +$$throw("File \"bs_array_test.res\", line 36, characters 8-15", () => { + Belt_Array.getExn([ + 0, + 1 + ], 2); +}); + +function f(extra) { + return Belt_Array.getExn([ + 0, + 1 + ], extra); +} + +b("File \"bs_array_test.res\", line 38, characters 4-11", Primitive_object.equal([ + f(0), + f(1) +], [ + 0, + 1 +])); + +$$throw("File \"bs_array_test.res\", line 44, characters 8-15", () => Belt_Array.setExn([ + 0, + 1 +], -1, 0)); + +$$throw("File \"bs_array_test.res\", line 45, characters 8-15", () => Belt_Array.setExn([ + 0, + 1 +], 2, 0)); + +b("File \"bs_array_test.res\", line 46, characters 4-11", !Belt_Array.set([ + 1, + 2 +], 2, 0)); + +let v$1 = [ + 1, + 2 +]; + +if (!Belt_Array.set(v$1, 0, 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 51, + 6 + ], + Error: new Error() + }; +} + +b("File \"bs_array_test.res\", line 48, characters 4-11", Belt_Array.getExn(v$1, 0) === 0); + +let v$2 = [ + 1, + 2 +]; + +if (!Belt_Array.set(v$2, 1, 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 59, + 6 + ], + Error: new Error() + }; +} + +b("File \"bs_array_test.res\", line 56, characters 4-11", Belt_Array.getExn(v$2, 1) === 0); + +let v$3 = [ + 1, + 2 +]; + +b("File \"bs_array_test.res\", line 64, characters 4-11", (Belt_Array.setExn(v$3, 0, 0), Belt_Array.getExn(v$3, 0) === 0)); + +let v$4 = [ + 1, + 2 +]; + +b("File \"bs_array_test.res\", line 72, characters 4-11", (Belt_Array.setExn(v$4, 1, 0), Belt_Array.getExn(v$4, 1) === 0)); + +function add(x, y) { + return x + y | 0; +} + +let v$5 = Belt_Array.makeBy(3000, i => i); + +let u = Belt_Array.shuffle(v$5); + +neq("File \"bs_array_test.res\", line 85, characters 6-13", u, v$5); + +eq("File \"bs_array_test.res\", line 87, characters 5-12", Belt_Array.reduce(u, 0, add), Belt_Array.reduce(v$5, 0, add)); + +b("File \"bs_array_test.res\", line 92, characters 4-11", Primitive_object.equal(Belt_Array.range(0, 3), [ + 0, + 1, + 2, + 3 +])); + +b("File \"bs_array_test.res\", line 93, characters 4-11", Primitive_object.equal(Belt_Array.range(3, 0), [])); + +b("File \"bs_array_test.res\", line 94, characters 4-11", Primitive_object.equal(Belt_Array.range(3, 3), [3])); + +b("File \"bs_array_test.res\", line 96, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(0, 10, 3), [ + 0, + 3, + 6, + 9 +])); + +b("File \"bs_array_test.res\", line 97, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(0, 12, 3), [ + 0, + 3, + 6, + 9, + 12 +])); + +b("File \"bs_array_test.res\", line 98, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(33, 0, 1), [])); + +b("File \"bs_array_test.res\", line 99, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(33, 0, -1), [])); + +b("File \"bs_array_test.res\", line 100, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 12, -1), [])); + +b("File \"bs_array_test.res\", line 101, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 3, 0), [])); + +b("File \"bs_array_test.res\", line 102, characters 4-11", Primitive_object.equal(Belt_Array.rangeBy(3, 3, 1), [3])); + +eq("File \"bs_array_test.res\", line 106, characters 5-12", Belt_Array.reduceReverse([], 100, (prim0, prim1) => prim0 - prim1 | 0), 100); + +eq("File \"bs_array_test.res\", line 107, characters 5-12", Belt_Array.reduceReverse([ + 1, + 2 +], 100, (prim0, prim1) => prim0 - prim1 | 0), 97); + +eq("File \"bs_array_test.res\", line 108, characters 5-12", Belt_Array.reduceReverse([ + 1, + 2, + 3, + 4 +], 100, (prim0, prim1) => prim0 - prim1 | 0), 90); + +eq("File \"bs_array_test.res\", line 109, characters 5-12", Belt_Array.reduceWithIndex([ + 1, + 2, + 3, + 4 +], 0, (acc, x, i) => (acc + x | 0) + i | 0), 16); + +b("File \"bs_array_test.res\", line 110, characters 4-11", Belt_Array.reduceReverse2([ + 1, + 2, + 3 +], [ + 1, + 2 +], 0, (acc, x, y) => (acc + x | 0) + y | 0) === 6); + +function addone(x) { + return x + 1 | 0; +} + +function makeMatrixExn(sx, sy, init) { + if (!(sx >= 0 && sy >= 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_array_test.res", + 116, + 2 + ], + Error: new Error() + }; + } + let res = new Array(sx); + for (let x = 0; x < sx; ++x) { + let initY = new Array(sy); + for (let y = 0; y < sy; ++y) { + initY[y] = init; + } + res[x] = initY; + } + return res; +} + +eq("File \"bs_array_test.res\", line 129, characters 5-12", Belt_Array.makeBy(0, param => 1), []); + +eq("File \"bs_array_test.res\", line 130, characters 5-12", Belt_Array.makeBy(3, i => i), [ + 0, + 1, + 2 +]); + +eq("File \"bs_array_test.res\", line 131, characters 5-12", makeMatrixExn(3, 4, 1), [ + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ], + [ + 1, + 1, + 1, + 1 + ] +]); + +eq("File \"bs_array_test.res\", line 132, characters 5-12", makeMatrixExn(3, 0, 0), [ + [], + [], + [] +]); + +eq("File \"bs_array_test.res\", line 133, characters 5-12", makeMatrixExn(0, 3, 1), []); + +eq("File \"bs_array_test.res\", line 134, characters 5-12", makeMatrixExn(1, 1, 1), [[1]]); + +eq("File \"bs_array_test.res\", line 135, characters 5-12", [].slice(0), []); + +eq("File \"bs_array_test.res\", line 136, characters 5-12", Belt_Array.map([], prim => prim + 1 | 0), []); + +eq("File \"bs_array_test.res\", line 137, characters 5-12", Belt_Array.mapWithIndex([], add), []); + +eq("File \"bs_array_test.res\", line 138, characters 5-12", Belt_Array.mapWithIndex([ + 1, + 2, + 3 +], add), [ + 1, + 3, + 5 +]); + +eq("File \"bs_array_test.res\", line 139, characters 5-12", Belt_List.fromArray([]), /* [] */0); + +eq("File \"bs_array_test.res\", line 140, characters 5-12", Belt_List.fromArray([1]), { + hd: 1, + tl: /* [] */0 +}); + +eq("File \"bs_array_test.res\", line 141, characters 5-12", Belt_List.fromArray([ + 1, + 2, + 3 +]), { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}); + +eq("File \"bs_array_test.res\", line 142, characters 5-12", Belt_Array.map([ + 1, + 2, + 3 +], prim => prim + 1 | 0), [ + 2, + 3, + 4 +]); + +eq("File \"bs_array_test.res\", line 143, characters 5-12", Belt_List.toArray(/* [] */0), []); + +eq("File \"bs_array_test.res\", line 144, characters 5-12", Belt_List.toArray({ + hd: 1, + tl: /* [] */0 +}), [1]); + +eq("File \"bs_array_test.res\", line 145, characters 5-12", Belt_List.toArray({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}), [ + 1, + 2 +]); + +eq("File \"bs_array_test.res\", line 146, characters 5-12", Belt_List.toArray({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}), [ + 1, + 2, + 3 +]); + +let v$6 = Belt_Array.makeBy(10, i => i); + +let v0 = Belt_Array.keep(v$6, x => x % 2 === 0); + +let v1 = Belt_Array.keep(v$6, x => x % 3 === 0); + +let v2 = Belt_Array.keepMap(v$6, x => { + if (x % 2 === 0) { + return x + 1 | 0; + } + +}); + +eq("File \"bs_array_test.res\", line 160, characters 5-12", v0, [ + 0, + 2, + 4, + 6, + 8 +]); + +eq("File \"bs_array_test.res\", line 161, characters 5-12", v1, [ + 0, + 3, + 6, + 9 +]); + +eq("File \"bs_array_test.res\", line 162, characters 5-12", v2, [ + 1, + 3, + 5, + 7, + 9 +]); + +let a = [ + 1, + 2, + 3, + 4, + 5 +]; + +let match = Belt_Array.partition(a, x => x % 2 === 0); + +eq("File \"bs_array_test.res\", line 168, characters 5-12", match[0], [ + 2, + 4 +]); + +eq("File \"bs_array_test.res\", line 169, characters 5-12", match[1], [ + 1, + 3, + 5 +]); + +let match$1 = Belt_Array.partition(a, x => x === 2); + +eq("File \"bs_array_test.res\", line 171, characters 5-12", match$1[0], [2]); + +eq("File \"bs_array_test.res\", line 172, characters 5-12", match$1[1], [ + 1, + 3, + 4, + 5 +]); + +let match$2 = Belt_Array.partition([], x => false); + +eq("File \"bs_array_test.res\", line 174, characters 5-12", match$2[0], []); + +eq("File \"bs_array_test.res\", line 175, characters 5-12", match$2[1], []); + +let a$1 = [ + 1, + 2, + 3, + 4, + 5 +]; + +eq("File \"bs_array_test.res\", line 180, characters 5-12", Belt_Array.slice(a$1, 0, 2), [ + 1, + 2 +]); + +eq("File \"bs_array_test.res\", line 181, characters 5-12", Belt_Array.slice(a$1, 0, 5), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 182, characters 5-12", Belt_Array.slice(a$1, 0, 15), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 183, characters 5-12", Belt_Array.slice(a$1, 5, 1), []); + +eq("File \"bs_array_test.res\", line 184, characters 5-12", Belt_Array.slice(a$1, 4, 1), [5]); + +eq("File \"bs_array_test.res\", line 185, characters 5-12", Belt_Array.slice(a$1, -1, 1), [5]); + +eq("File \"bs_array_test.res\", line 186, characters 5-12", Belt_Array.slice(a$1, -1, 2), [5]); + +eq("File \"bs_array_test.res\", line 187, characters 5-12", Belt_Array.slice(a$1, -2, 1), [4]); + +eq("File \"bs_array_test.res\", line 188, characters 5-12", Belt_Array.slice(a$1, -2, 2), [ + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 189, characters 5-12", Belt_Array.slice(a$1, -2, 3), [ + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 190, characters 5-12", Belt_Array.slice(a$1, -10, 3), [ + 1, + 2, + 3 +]); + +eq("File \"bs_array_test.res\", line 191, characters 5-12", Belt_Array.slice(a$1, -10, 4), [ + 1, + 2, + 3, + 4 +]); + +eq("File \"bs_array_test.res\", line 192, characters 5-12", Belt_Array.slice(a$1, -10, 5), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 193, characters 5-12", Belt_Array.slice(a$1, -10, 6), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 194, characters 5-12", Belt_Array.slice(a$1, 0, 0), []); + +eq("File \"bs_array_test.res\", line 195, characters 5-12", Belt_Array.slice(a$1, 0, -1), []); + +let a$2 = [ + 1, + 2, + 3, + 4, + 5 +]; + +eq("File \"bs_array_test.res\", line 200, characters 5-12", Belt_Array.sliceToEnd(a$2, 0), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 201, characters 5-12", Belt_Array.sliceToEnd(a$2, 5), []); + +eq("File \"bs_array_test.res\", line 202, characters 5-12", Belt_Array.sliceToEnd(a$2, 4), [5]); + +eq("File \"bs_array_test.res\", line 203, characters 5-12", Belt_Array.sliceToEnd(a$2, -1), [5]); + +eq("File \"bs_array_test.res\", line 204, characters 5-12", Belt_Array.sliceToEnd(a$2, -2), [ + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 205, characters 5-12", Belt_Array.sliceToEnd(a$2, -10), [ + 1, + 2, + 3, + 4, + 5 +]); + +eq("File \"bs_array_test.res\", line 206, characters 5-12", Belt_Array.sliceToEnd(a$2, 6), []); + +let a$3 = Belt_Array.makeBy(10, x => x); + +Belt_Array.fill(a$3, 0, 3, 0); + +eq("File \"bs_array_test.res\", line 211, characters 5-12", a$3.slice(0), [ + 0, + 0, + 0, + 3, + 4, + 5, + 6, + 7, + 8, + 9 +]); + +Belt_Array.fill(a$3, 2, 8, 1); + +eq("File \"bs_array_test.res\", line 213, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 +]); + +Belt_Array.fill(a$3, 8, 1, 9); + +eq("File \"bs_array_test.res\", line 215, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 9, + 1 +]); + +Belt_Array.fill(a$3, 8, 2, 9); + +eq("File \"bs_array_test.res\", line 217, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 9, + 9 +]); + +Belt_Array.fill(a$3, 8, 3, 12); + +eq("File \"bs_array_test.res\", line 219, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 12, + 12 +]); + +Belt_Array.fill(a$3, -2, 3, 11); + +eq("File \"bs_array_test.res\", line 221, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 11, + 11 +]); + +Belt_Array.fill(a$3, -3, 3, 10); + +eq("File \"bs_array_test.res\", line 223, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 10, + 10, + 10 +]); + +Belt_Array.fill(a$3, -3, 1, 7); + +eq("File \"bs_array_test.res\", line 225, characters 5-12", a$3.slice(0), [ + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 7, + 10, + 10 +]); + +Belt_Array.fill(a$3, -13, 1, 7); + +eq("File \"bs_array_test.res\", line 227, characters 5-12", a$3.slice(0), [ + 7, + 0, + 1, + 1, + 1, + 1, + 1, + 7, + 10, + 10 +]); + +Belt_Array.fill(a$3, -13, 12, 7); + +eq("File \"bs_array_test.res\", line 229, characters 5-12", a$3.slice(0), Belt_Array.make(10, 7)); + +Belt_Array.fill(a$3, 0, -1, 2); + +eq("File \"bs_array_test.res\", line 231, characters 5-12", a$3.slice(0), Belt_Array.make(10, 7)); + +let b$1 = [ + 1, + 2, + 3 +]; + +Belt_Array.fill(b$1, 0, 0, 0); + +eq("File \"bs_array_test.res\", line 234, characters 5-12", b$1, [ + 1, + 2, + 3 +]); + +Belt_Array.fill(b$1, 4, 1, 0); + +eq("File \"bs_array_test.res\", line 236, characters 5-12", b$1, [ + 1, + 2, + 3 +]); + +let a0 = Belt_Array.makeBy(10, x => x); + +let b0 = Belt_Array.make(10, 3); + +Belt_Array.blit(a0, 1, b0, 2, 5); + +eq("File \"bs_array_test.res\", line 243, characters 5-12", b0.slice(0), [ + 3, + 3, + 1, + 2, + 3, + 4, + 5, + 3, + 3, + 3 +]); + +Belt_Array.blit(a0, -1, b0, 2, 5); + +eq("File \"bs_array_test.res\", line 245, characters 5-12", b0.slice(0), [ + 3, + 3, + 9, + 2, + 3, + 4, + 5, + 3, + 3, + 3 +]); + +Belt_Array.blit(a0, -1, b0, -2, 5); + +eq("File \"bs_array_test.res\", line 247, characters 5-12", b0.slice(0), [ + 3, + 3, + 9, + 2, + 3, + 4, + 5, + 3, + 9, + 3 +]); + +Belt_Array.blit(a0, -2, b0, -2, 2); + +eq("File \"bs_array_test.res\", line 249, characters 5-12", b0.slice(0), [ + 3, + 3, + 9, + 2, + 3, + 4, + 5, + 3, + 8, + 9 +]); + +Belt_Array.blit(a0, -11, b0, -11, 100); + +eq("File \"bs_array_test.res\", line 251, characters 5-12", b0.slice(0), a0); + +Belt_Array.blit(a0, -11, b0, -11, 2); + +eq("File \"bs_array_test.res\", line 253, characters 5-12", b0.slice(0), a0); + +let aa = Belt_Array.makeBy(10, x => x); + +Belt_Array.blit(aa, -1, aa, 1, 2); + +eq("File \"bs_array_test.res\", line 256, characters 5-12", aa.slice(0), [ + 0, + 9, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 +]); + +Belt_Array.blit(aa, -2, aa, 1, 2); + +eq("File \"bs_array_test.res\", line 258, characters 5-12", aa.slice(0), [ + 0, + 8, + 9, + 3, + 4, + 5, + 6, + 7, + 8, + 9 +]); + +Belt_Array.blit(aa, -5, aa, 4, 3); + +eq("File \"bs_array_test.res\", line 260, characters 5-12", aa.slice(0), [ + 0, + 8, + 9, + 3, + 5, + 6, + 7, + 7, + 8, + 9 +]); + +Belt_Array.blit(aa, 4, aa, 5, 3); + +eq("File \"bs_array_test.res\", line 262, characters 5-12", aa.slice(0), [ + 0, + 8, + 9, + 3, + 5, + 5, + 6, + 7, + 8, + 9 +]); + +eq("File \"bs_array_test.res\", line 263, characters 5-12", Belt_Array.make(0, 3), []); + +eq("File \"bs_array_test.res\", line 264, characters 5-12", Belt_Array.make(-1, 3), []); + +let c = [ + 0, + 1, + 2 +]; + +Belt_Array.blit(c, 4, c, 1, 1); + +eq("File \"bs_array_test.res\", line 267, characters 5-12", c, [ + 0, + 1, + 2 +]); + +eq("File \"bs_array_test.res\", line 271, characters 5-12", Belt_Array.zip([ + 1, + 2, + 3 +], [ + 2, + 3, + 4, + 1 +]), [ + [ + 1, + 2 + ], + [ + 2, + 3 + ], + [ + 3, + 4 + ] +]); + +eq("File \"bs_array_test.res\", line 272, characters 5-12", Belt_Array.zip([ + 2, + 3, + 4, + 1 +], [ + 1, + 2, + 3 +]), [ + [ + 2, + 1 + ], + [ + 3, + 2 + ], + [ + 4, + 3 + ] +]); + +eq("File \"bs_array_test.res\", line 273, characters 5-12", Belt_Array.zipBy([ + 2, + 3, + 4, + 1 +], [ + 1, + 2, + 3 +], (prim0, prim1) => prim0 - prim1 | 0), [ + 1, + 1, + 1 +]); + +eq("File \"bs_array_test.res\", line 274, characters 5-12", Belt_Array.zipBy([ + 1, + 2, + 3 +], [ + 2, + 3, + 4, + 1 +], (prim0, prim1) => prim0 - prim1 | 0), Belt_Array.map([ + 1, + 1, + 1 +], x => -x | 0)); + +eq("File \"bs_array_test.res\", line 275, characters 5-12", Belt_Array.unzip([ + [ + 1, + 2 + ], + [ + 2, + 3 + ], + [ + 3, + 4 + ] +]), [ + [ + 1, + 2, + 3 + ], + [ + 2, + 3, + 4 + ] +]); + +function sumUsingForEach(xs) { + let v = { + contents: 0 + }; + Belt_Array.forEach(xs, x => { + v.contents = v.contents + x | 0; + }); + return v.contents; +} + +eq("File \"bs_array_test.res\", line 287, characters 5-12", sumUsingForEach([ + 0, + 1, + 2, + 3, + 4 +]), 10); + +b("File \"bs_array_test.res\", line 288, characters 4-11", !Belt_Array.every([ + 0, + 1, + 2, + 3, + 4 +], x => x > 2)); + +b("File \"bs_array_test.res\", line 289, characters 4-11", Belt_Array.some([ + 1, + 3, + 7, + 8 +], x => x % 2 === 0)); + +b("File \"bs_array_test.res\", line 290, characters 4-11", !Belt_Array.some([ + 1, + 3, + 7 +], x => x % 2 === 0)); + +b("File \"bs_array_test.res\", line 291, characters 4-11", !Belt_Array.eq([ + 0, + 1 +], [1], (prim0, prim1) => prim0 === prim1)); + +let c$1 = { + contents: 0 +}; + +b("File \"bs_array_test.res\", line 293, characters 4-11", (Belt_Array.forEachWithIndex([ + 1, + 1, + 1 +], (i, v) => { + c$1.contents = (c$1.contents + i | 0) + v | 0; +}), c$1.contents === 6)); + +function id(loc, x) { + let u = x.slice(0); + eq("File \"bs_array_test.res\", line 304, characters 4-11", Belt_Array.reverse(x), (Belt_Array.reverseInPlace(u), u)); +} + +id("File \"bs_array_test.res\", line 314, characters 5-12", []); + +id("File \"bs_array_test.res\", line 315, characters 5-12", [1]); + +id("File \"bs_array_test.res\", line 316, characters 5-12", [ + 1, + 2 +]); + +id("File \"bs_array_test.res\", line 317, characters 5-12", [ + 1, + 2, + 3 +]); + +id("File \"bs_array_test.res\", line 318, characters 5-12", [ + 1, + 2, + 3, + 4 +]); + +function every2(xs, ys, x) { + return Belt_Array.every2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); +} + +function some2(xs, ys, x) { + return Belt_Array.some2(Belt_List.toArray(xs), Belt_List.toArray(ys), x); +} + +eq("File \"bs_array_test.res\", line 326, characters 5-12", every2(/* [] */0, { + hd: 1, + tl: /* [] */0 +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 327, characters 5-12", every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: /* [] */0 +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 328, characters 5-12", every2({ + hd: 2, + tl: /* [] */0 +}, { + hd: 1, + tl: /* [] */0 +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 329, characters 5-12", every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } +}, (x, y) => x > y), false); + +eq("File \"bs_array_test.res\", line 330, characters 5-12", every2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: { + hd: 0, + tl: /* [] */0 + } +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 331, characters 5-12", some2(/* [] */0, { + hd: 1, + tl: /* [] */0 +}, (x, y) => x > y), false); + +eq("File \"bs_array_test.res\", line 332, characters 5-12", some2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: /* [] */0 +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 333, characters 5-12", some2({ + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 334, characters 5-12", some2({ + hd: 0, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 1, + tl: { + hd: 4, + tl: /* [] */0 + } +}, (x, y) => x > y), false); + +eq("File \"bs_array_test.res\", line 335, characters 5-12", some2({ + hd: 0, + tl: { + hd: 3, + tl: /* [] */0 + } +}, { + hd: 3, + tl: { + hd: 2, + tl: /* [] */0 + } +}, (x, y) => x > y), true); + +eq("File \"bs_array_test.res\", line 339, characters 5-12", Belt_Array.concat([], [ + 1, + 2, + 3 +]), [ + 1, + 2, + 3 +]); + +eq("File \"bs_array_test.res\", line 340, characters 5-12", Belt_Array.concat([], []), []); + +eq("File \"bs_array_test.res\", line 341, characters 5-12", Belt_Array.concat([ + 3, + 2 +], [ + 1, + 2, + 3 +]), [ + 3, + 2, + 1, + 2, + 3 +]); + +eq("File \"bs_array_test.res\", line 342, characters 5-12", Belt_Array.concatMany([ + [ + 3, + 2 + ], + [ + 1, + 2, + 3 + ] +]), [ + 3, + 2, + 1, + 2, + 3 +]); + +eq("File \"bs_array_test.res\", line 343, characters 5-12", Belt_Array.concatMany([ + [ + 3, + 2 + ], + [ + 1, + 2, + 3 + ], + [], + [0] +]), [ + 3, + 2, + 1, + 2, + 3, + 0 +]); + +eq("File \"bs_array_test.res\", line 344, characters 5-12", Belt_Array.concatMany([ + [], + [ + 3, + 2 + ], + [ + 1, + 2, + 3 + ], + [], + [0] +]), [ + 3, + 2, + 1, + 2, + 3, + 0 +]); + +eq("File \"bs_array_test.res\", line 345, characters 5-12", Belt_Array.concatMany([ + [], + [] +]), []); + +b("File \"bs_array_test.res\", line 349, characters 4-11", Belt_Array.cmp([ + 1, + 2, + 3 +], [ + 0, + 1, + 2, + 3 +], Primitive_int.compare) < 0); + +b("File \"bs_array_test.res\", line 350, characters 4-11", Belt_Array.cmp([ + 0, + 1, + 2, + 3 +], [ + 1, + 2, + 3 +], Primitive_int.compare) > 0); + +b("File \"bs_array_test.res\", line 351, characters 4-11", Belt_Array.cmp([ + 1, + 2, + 3 +], [ + 0, + 1, + 2 +], Primitive_int.compare) > 0); + +b("File \"bs_array_test.res\", line 352, characters 4-11", Belt_Array.cmp([ + 1, + 2, + 3 +], [ + 1, + 2, + 3 +], Primitive_int.compare) === 0); + +b("File \"bs_array_test.res\", line 353, characters 4-11", Belt_Array.cmp([ + 1, + 2, + 4 +], [ + 1, + 2, + 3 +], Primitive_int.compare) > 0); + +eq("File \"bs_array_test.res\", line 357, characters 5-12", Belt_Array.getBy([ + 1, + 2, + 3 +], x => x > 1), 2); + +eq("File \"bs_array_test.res\", line 358, characters 5-12", Belt_Array.getBy([ + 1, + 2, + 3 +], x => x > 3), undefined); + +eq("File \"bs_array_test.res\", line 362, characters 5-12", Belt_Array.getIndexBy([ + 1, + 2, + 3 +], x => x > 1), 1); + +eq("File \"bs_array_test.res\", line 363, characters 5-12", Belt_Array.getIndexBy([ + 1, + 2, + 3 +], x => x > 3), undefined); + +let arr = []; + +arr.push(3); + +arr.push(2); + +arr.push(1); + +eq("File \"bs_array_test.res\", line 371, characters 5-12", arr, [ + 3, + 2, + 1 +]); + +Mt.from_pair_suites("File \"bs_array_test.res\", line 374, characters 20-27", suites.contents); + +let A; + +let L; + +export { + suites, + test_id, + eq, + b, + $$throw, + neq, + A, + L, + push, + add, + addone, + makeMatrixExn, + sumUsingForEach, + id, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_auto_uncurry.js b/tests/tests/src/bs_auto_uncurry.js deleted file mode 100644 index d9601239d7..0000000000 --- a/tests/tests/src/bs_auto_uncurry.js +++ /dev/null @@ -1,138 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let Curry = {}; - -let Block = {}; - -let xbs = Array.prototype.map.call([ - 1, - 2, - 3, - 5 -], x => x + 1 | 0); - -function f(cb) { - return Array.prototype.map.call([ - 1, - 2, - 3, - 4 - ], cb); -} - -let xs = Array.prototype.map.call([ - [ - 1, - 2 - ], - [ - 1, - 2 - ], - [ - 2, - 1 - ] -], param => (param[1] + param[0] | 0) + 1 | 0); - -function f_0() { - return hi(() => {}); -} - -function f_01() { - return hi(x => { - if (x === undefined) { - console.log("x"); - return; - } - - }); -} - -function f_02(xs) { - return hi(x => { - xs.contents = x; - console.log("x"); - }); -} - -function f_03(xs, u) { - return hi(u); -} - -function h(x, y, z) { - return map2(x, y, z); -} - -function h1(x, y, u, z) { - return map2(x, y, z(u)); -} - -function add3(x) { - return (y, z) => (x + y | 0) + z | 0; -} - -function h2(x) { - return ff(x, (prim0, prim1) => prim0 + prim1 | 0); -} - -function h3(x) { - return ff(x, (y, z) => (1 + y | 0) + z | 0); -} - -function h4(x) { - return ff1(x, 3, (y, z) => (1 + y | 0) + z | 0); -} - -function h5(x) { - return ff2(x, "3", (y, z) => (2 + y | 0) + z | 0); -} - -function add(x, y) { - console.log([ - x, - y - ]); - return x + y | 0; -} - -function h6(x) { - return ff2(x, "3", add); -} - -function unit_magic() { - console.log("noinline"); - console.log("noinline"); - return 3; -} - -let f_unit_magic = unit_magic(); - -function hh(xs, a) { - f_0002(xs, ...a); -} - -exports.Curry = Curry; -exports.Block = Block; -exports.xbs = xbs; -exports.f = f; -exports.xs = xs; -exports.f_0 = f_0; -exports.f_01 = f_01; -exports.f_02 = f_02; -exports.f_03 = f_03; -exports.h = h; -exports.h1 = h1; -exports.add3 = add3; -exports.h2 = h2; -exports.h3 = h3; -exports.h4 = h4; -exports.h5 = h5; -exports.add = add; -exports.h6 = h6; -exports.unit_magic = unit_magic; -exports.f_unit_magic = f_unit_magic; -exports.hh = hh; -/* xbs Not a pure module */ diff --git a/tests/tests/src/bs_auto_uncurry.mjs b/tests/tests/src/bs_auto_uncurry.mjs new file mode 100644 index 0000000000..92dcc6cafb --- /dev/null +++ b/tests/tests/src/bs_auto_uncurry.mjs @@ -0,0 +1,139 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let Curry = {}; + +let Block = {}; + +let xbs = Array.prototype.map.call([ + 1, + 2, + 3, + 5 +], x => x + 1 | 0); + +function f(cb) { + return Array.prototype.map.call([ + 1, + 2, + 3, + 4 + ], cb); +} + +let xs = Array.prototype.map.call([ + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 2, + 1 + ] +], param => (param[1] + param[0] | 0) + 1 | 0); + +function f_0() { + return hi(() => {}); +} + +function f_01() { + return hi(x => { + if (x === undefined) { + console.log("x"); + return; + } + + }); +} + +function f_02(xs) { + return hi(x => { + xs.contents = x; + console.log("x"); + }); +} + +function f_03(xs, u) { + return hi(u); +} + +function h(x, y, z) { + return map2(x, y, z); +} + +function h1(x, y, u, z) { + return map2(x, y, z(u)); +} + +function add3(x) { + return (y, z) => (x + y | 0) + z | 0; +} + +function h2(x) { + return ff(x, (prim0, prim1) => prim0 + prim1 | 0); +} + +function h3(x) { + return ff(x, (y, z) => (1 + y | 0) + z | 0); +} + +function h4(x) { + return ff1(x, 3, (y, z) => (1 + y | 0) + z | 0); +} + +function h5(x) { + return ff2(x, "3", (y, z) => (2 + y | 0) + z | 0); +} + +function add(x, y) { + console.log([ + x, + y + ]); + return x + y | 0; +} + +function h6(x) { + return ff2(x, "3", add); +} + +function unit_magic() { + console.log("noinline"); + console.log("noinline"); + return 3; +} + +let f_unit_magic = unit_magic(); + +function hh(xs, a) { + f_0002(xs, ...a); +} + +export { + Curry, + Block, + xbs, + f, + xs, + f_0, + f_01, + f_02, + f_03, + h, + h1, + add3, + h2, + h3, + h4, + h5, + add, + h6, + unit_magic, + f_unit_magic, + hh, +} +/* xbs Not a pure module */ diff --git a/tests/tests/src/bs_auto_uncurry_test.js b/tests/tests/src/bs_auto_uncurry_test.js deleted file mode 100644 index 3f46e7548d..0000000000 --- a/tests/tests/src/bs_auto_uncurry_test.js +++ /dev/null @@ -1,110 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function hi (cb){ - cb (); - return 0; -} -; - -let xs = { - contents: /* [] */0 -}; - -hi(x => { - xs.contents = { - hd: x, - tl: xs.contents - }; -}); - -hi(x => { - xs.contents = { - hd: x, - tl: xs.contents - }; -}); - -eq("File \"bs_auto_uncurry_test.res\", line 27, characters 5-12", xs.contents, { - hd: undefined, - tl: { - hd: undefined, - tl: /* [] */0 - } -}); - -eq("File \"bs_auto_uncurry_test.res\", line 31, characters 5-12", [ - 1, - 2, - 3 -].map(x => x + 1 | 0), [ - 2, - 3, - 4 -]); - -eq("File \"bs_auto_uncurry_test.res\", line 32, characters 5-12", [ - 1, - 2, - 3 -].map(x => x + 1 | 0), [ - 2, - 3, - 4 -]); - -eq("File \"bs_auto_uncurry_test.res\", line 34, characters 5-12", [ - 1, - 2, - 3 -].reduce((prim0, prim1) => prim0 + prim1 | 0, 0), 6); - -eq("File \"bs_auto_uncurry_test.res\", line 36, characters 5-12", [ - 1, - 2, - 3 -].reduce((x, y, i) => (x + y | 0) + i | 0, 0), 9); - -eq("File \"bs_auto_uncurry_test.res\", line 38, characters 5-12", [ - 1, - 2, - 3 -].some(x => x < 1), false); - -eq("File \"bs_auto_uncurry_test.res\", line 40, characters 5-12", [ - 1, - 2, - 3 -].every(x => x > 0), true); - -Mt.from_pair_suites("Bs_auto_uncurry_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/bs_auto_uncurry_test.mjs b/tests/tests/src/bs_auto_uncurry_test.mjs new file mode 100644 index 0000000000..c38b3e66e4 --- /dev/null +++ b/tests/tests/src/bs_auto_uncurry_test.mjs @@ -0,0 +1,111 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function hi (cb){ + cb (); + return 0; +} +; + +let xs = { + contents: /* [] */0 +}; + +hi(x => { + xs.contents = { + hd: x, + tl: xs.contents + }; +}); + +hi(x => { + xs.contents = { + hd: x, + tl: xs.contents + }; +}); + +eq("File \"bs_auto_uncurry_test.res\", line 27, characters 5-12", xs.contents, { + hd: undefined, + tl: { + hd: undefined, + tl: /* [] */0 + } +}); + +eq("File \"bs_auto_uncurry_test.res\", line 31, characters 5-12", [ + 1, + 2, + 3 +].map(x => x + 1 | 0), [ + 2, + 3, + 4 +]); + +eq("File \"bs_auto_uncurry_test.res\", line 32, characters 5-12", [ + 1, + 2, + 3 +].map(x => x + 1 | 0), [ + 2, + 3, + 4 +]); + +eq("File \"bs_auto_uncurry_test.res\", line 34, characters 5-12", [ + 1, + 2, + 3 +].reduce((prim0, prim1) => prim0 + prim1 | 0, 0), 6); + +eq("File \"bs_auto_uncurry_test.res\", line 36, characters 5-12", [ + 1, + 2, + 3 +].reduce((x, y, i) => (x + y | 0) + i | 0, 0), 9); + +eq("File \"bs_auto_uncurry_test.res\", line 38, characters 5-12", [ + 1, + 2, + 3 +].some(x => x < 1), false); + +eq("File \"bs_auto_uncurry_test.res\", line 40, characters 5-12", [ + 1, + 2, + 3 +].every(x => x > 0), true); + +Mt.from_pair_suites("Bs_auto_uncurry_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_ignore_effect.js b/tests/tests/src/bs_ignore_effect.js deleted file mode 100644 index 49ab49a706..0000000000 --- a/tests/tests/src/bs_ignore_effect.js +++ /dev/null @@ -1,57 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function add(x,y){ - return x + y -} -; - -let v = { - contents: 0 -}; - -let h = (v.contents = v.contents + 1 | 0, { - hi: 2, - lo: 0 -}); - -let z = (v.contents = v.contents + 1 | 0, "Float", add(3.0, 2.0)); - -eq("File \"bs_ignore_effect.res\", line 37, characters 5-12", v.contents, 2); - -eq("File \"bs_ignore_effect.res\", line 38, characters 5-12", z, 5.0); - -Mt.from_pair_suites("Bs_ignore_effect", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.h = h; -exports.z = z; -/* Not a pure module */ diff --git a/tests/tests/src/bs_ignore_effect.mjs b/tests/tests/src/bs_ignore_effect.mjs new file mode 100644 index 0000000000..9f7034b1e8 --- /dev/null +++ b/tests/tests/src/bs_ignore_effect.mjs @@ -0,0 +1,58 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function add(x,y){ + return x + y +} +; + +let v = { + contents: 0 +}; + +let h = (v.contents = v.contents + 1 | 0, { + hi: 2, + lo: 0 +}); + +let z = (v.contents = v.contents + 1 | 0, "Float", add(3.0, 2.0)); + +eq("File \"bs_ignore_effect.res\", line 37, characters 5-12", v.contents, 2); + +eq("File \"bs_ignore_effect.res\", line 38, characters 5-12", z, 5.0); + +Mt.from_pair_suites("Bs_ignore_effect", suites.contents); + +export { + suites, + test_id, + eq, + v, + h, + z, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_ignore_test.js b/tests/tests/src/bs_ignore_test.js deleted file mode 100644 index 91f0a7b25b..0000000000 --- a/tests/tests/src/bs_ignore_test.js +++ /dev/null @@ -1,40 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function add(x,y){ - return x + y -} -; - -console.log(add(3.0, 2.0)); - -console.log(add("x", "y")); - -function add_dyn(kind,x,y){ - switch(kind){ - case "string" : return x + y; - case "float" : return x + y; - } -} -; - -function string_of_kind(kind) { - if (kind === "Float") { - return "float"; - } else { - return "string"; - } -} - -function add2(k, x, y) { - return add_dyn(string_of_kind(k), x, y); -} - -console.log(add2("Float", 3.0, 2.0)); - -console.log(add2("String", "x", "y")); - -exports.string_of_kind = string_of_kind; -exports.add2 = add2; -/* Not a pure module */ diff --git a/tests/tests/src/bs_ignore_test.mjs b/tests/tests/src/bs_ignore_test.mjs new file mode 100644 index 0000000000..a9b4f77956 --- /dev/null +++ b/tests/tests/src/bs_ignore_test.mjs @@ -0,0 +1,41 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function add(x,y){ + return x + y +} +; + +console.log(add(3.0, 2.0)); + +console.log(add("x", "y")); + +function add_dyn(kind,x,y){ + switch(kind){ + case "string" : return x + y; + case "float" : return x + y; + } +} +; + +function string_of_kind(kind) { + if (kind === "Float") { + return "float"; + } else { + return "string"; + } +} + +function add2(k, x, y) { + return add_dyn(string_of_kind(k), x, y); +} + +console.log(add2("Float", 3.0, 2.0)); + +console.log(add2("String", "x", "y")); + +export { + string_of_kind, + add2, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_map_set_dict_test.js b/tests/tests/src/bs_map_set_dict_test.js deleted file mode 100644 index 7cc84928e0..0000000000 --- a/tests/tests/src/bs_map_set_dict_test.js +++ /dev/null @@ -1,178 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Map = require("rescript/lib/js/Belt_Map.js"); -let Belt_Set = require("rescript/lib/js/Belt_Set.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_MapDict = require("rescript/lib/js/Belt_MapDict.js"); -let Belt_SetDict = require("rescript/lib/js/Belt_SetDict.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Array_data_util = require("./array_data_util.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, v) { - Mt.bool_suites(test_id, suites, loc, v); -} - -let Icmp = Belt_Id.comparable(Primitive_int.compare); - -let Icmp2 = Belt_Id.comparable(Primitive_int.compare); - -let Ic3 = Belt_Id.comparable(Primitive_int.compare); - -let m0 = Belt_Map.make(Icmp); - -let m00 = Belt_Set.make(Ic3); - -let I2 = Belt_Id.comparable((x, y) => Primitive_int.compare(y, x)); - -let m = Belt_Map.make(Icmp2); - -let m2 = Belt_Map.make(I2); - -let data = Belt_Map.getData(m); - -Belt_Map.getId(m2); - -let m_dict = Belt_Map.getId(m); - -for (let i = 0; i <= 100000; ++i) { - data = Belt_MapDict.set(data, i, i, m_dict.cmp); -} - -let newm = Belt_Map.packIdData(m_dict, data); - -console.log(newm); - -let m11 = Belt_MapDict.set(undefined, 1, 1, Icmp.cmp); - -Belt_Map.make(Icmp); - -console.log(m11); - -let v = Belt_Set.make(Icmp2); - -let m_dict$1 = Belt_Map.getId(m); - -let cmp = m_dict$1.cmp; - -let data$1 = Belt_Set.getData(v); - -for (let i$1 = 0; i$1 <= 100000; ++i$1) { - data$1 = Belt_SetDict.add(data$1, i$1, cmp); -} - -console.log(data$1); - -function f(none) { - return Belt_Map.fromArray(none, Icmp); -} - -function $eq$tilde(a, b) { - return extra => Belt_Map.eq(a, b, extra); -} - -let u0 = Belt_Map.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 39), x => [ - x, - x -]), Icmp); - -let u1 = Belt_Map.set(u0, 39, 120); - -b("File \"bs_map_set_dict_test.res\", line 72, characters 4-11", Belt_Array.every2(Belt_Map.toArray(u0), Belt_Array.map(Array_data_util.range(0, 39), x => [ - x, - x -]), (param, param$1) => { - if (param[0] === param$1[0]) { - return param[1] === param$1[1]; - } else { - return false; - } -})); - -b("File \"bs_map_set_dict_test.res\", line 79, characters 4-11", Belt_List.every2(Belt_Map.toList(u0), Belt_List.fromArray(Belt_Array.map(Array_data_util.range(0, 39), x => [ - x, - x -])), (param, param$1) => { - if (param[0] === param$1[0]) { - return param[1] === param$1[1]; - } else { - return false; - } -})); - -eq("File \"bs_map_set_dict_test.res\", line 84, characters 5-12", Belt_Map.get(u0, 39), 39); - -eq("File \"bs_map_set_dict_test.res\", line 85, characters 5-12", Belt_Map.get(u1, 39), 120); - -let u = Belt_Map.fromArray(Belt_Array.makeByAndShuffle(10000, x => [ - x, - x -]), Icmp); - -eq("File \"bs_map_set_dict_test.res\", line 90, characters 5-12", Belt_Array.makeBy(10000, x => [ - x, - x -]), Belt_Map.toArray(u)); - -Mt.from_pair_suites("Bs_map_set_dict_test", suites.contents); - -let M; - -let MI; - -let I; - -let A; - -let L; - -let vv; - -let vv2; - -let Md0; - -let ISet; - -let S0; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.Icmp = Icmp; -exports.Icmp2 = Icmp2; -exports.Ic3 = Ic3; -exports.M = M; -exports.MI = MI; -exports.I = I; -exports.A = A; -exports.L = L; -exports.m0 = m0; -exports.m00 = m00; -exports.I2 = I2; -exports.m = m; -exports.m2 = m2; -exports.vv = vv; -exports.vv2 = vv2; -exports.Md0 = Md0; -exports.ISet = ISet; -exports.S0 = S0; -exports.f = f; -exports.$eq$tilde = $eq$tilde; -/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_map_set_dict_test.mjs b/tests/tests/src/bs_map_set_dict_test.mjs new file mode 100644 index 0000000000..a3dccfe565 --- /dev/null +++ b/tests/tests/src/bs_map_set_dict_test.mjs @@ -0,0 +1,179 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Map from "rescript/lib/es6/Belt_Map.js"; +import * as Belt_Set from "rescript/lib/es6/Belt_Set.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_MapDict from "rescript/lib/es6/Belt_MapDict.js"; +import * as Belt_SetDict from "rescript/lib/es6/Belt_SetDict.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Array_data_util from "./array_data_util.mjs"; + +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, v) { + Mt.bool_suites(test_id, suites, loc, v); +} + +let Icmp = Belt_Id.comparable(Primitive_int.compare); + +let Icmp2 = Belt_Id.comparable(Primitive_int.compare); + +let Ic3 = Belt_Id.comparable(Primitive_int.compare); + +let m0 = Belt_Map.make(Icmp); + +let m00 = Belt_Set.make(Ic3); + +let I2 = Belt_Id.comparable((x, y) => Primitive_int.compare(y, x)); + +let m = Belt_Map.make(Icmp2); + +let m2 = Belt_Map.make(I2); + +let data = Belt_Map.getData(m); + +Belt_Map.getId(m2); + +let m_dict = Belt_Map.getId(m); + +for (let i = 0; i <= 100000; ++i) { + data = Belt_MapDict.set(data, i, i, m_dict.cmp); +} + +let newm = Belt_Map.packIdData(m_dict, data); + +console.log(newm); + +let m11 = Belt_MapDict.set(undefined, 1, 1, Icmp.cmp); + +Belt_Map.make(Icmp); + +console.log(m11); + +let v = Belt_Set.make(Icmp2); + +let m_dict$1 = Belt_Map.getId(m); + +let cmp = m_dict$1.cmp; + +let data$1 = Belt_Set.getData(v); + +for (let i$1 = 0; i$1 <= 100000; ++i$1) { + data$1 = Belt_SetDict.add(data$1, i$1, cmp); +} + +console.log(data$1); + +function f(none) { + return Belt_Map.fromArray(none, Icmp); +} + +function $eq$tilde(a, b) { + return extra => Belt_Map.eq(a, b, extra); +} + +let u0 = Belt_Map.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 39), x => [ + x, + x +]), Icmp); + +let u1 = Belt_Map.set(u0, 39, 120); + +b("File \"bs_map_set_dict_test.res\", line 72, characters 4-11", Belt_Array.every2(Belt_Map.toArray(u0), Belt_Array.map(Array_data_util.range(0, 39), x => [ + x, + x +]), (param, param$1) => { + if (param[0] === param$1[0]) { + return param[1] === param$1[1]; + } else { + return false; + } +})); + +b("File \"bs_map_set_dict_test.res\", line 79, characters 4-11", Belt_List.every2(Belt_Map.toList(u0), Belt_List.fromArray(Belt_Array.map(Array_data_util.range(0, 39), x => [ + x, + x +])), (param, param$1) => { + if (param[0] === param$1[0]) { + return param[1] === param$1[1]; + } else { + return false; + } +})); + +eq("File \"bs_map_set_dict_test.res\", line 84, characters 5-12", Belt_Map.get(u0, 39), 39); + +eq("File \"bs_map_set_dict_test.res\", line 85, characters 5-12", Belt_Map.get(u1, 39), 120); + +let u = Belt_Map.fromArray(Belt_Array.makeByAndShuffle(10000, x => [ + x, + x +]), Icmp); + +eq("File \"bs_map_set_dict_test.res\", line 90, characters 5-12", Belt_Array.makeBy(10000, x => [ + x, + x +]), Belt_Map.toArray(u)); + +Mt.from_pair_suites("Bs_map_set_dict_test", suites.contents); + +let M; + +let MI; + +let I; + +let A; + +let L; + +let vv; + +let vv2; + +let Md0; + +let ISet; + +let S0; + +export { + suites, + test_id, + eq, + b, + Icmp, + Icmp2, + Ic3, + M, + MI, + I, + A, + L, + m0, + m00, + I2, + m, + m2, + vv, + vv2, + Md0, + ISet, + S0, + f, + $eq$tilde, +} +/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_map_test.js b/tests/tests/src/bs_map_test.js deleted file mode 100644 index 78862ccd5e..0000000000 --- a/tests/tests/src/bs_map_test.js +++ /dev/null @@ -1,89 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_MapInt = require("rescript/lib/js/Belt_MapInt.js"); -let Belt_SetInt = require("rescript/lib/js/Belt_SetInt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function b(loc, v) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Ok", - _0: v - }) - ], - tl: suites.contents - }; -} - -let mapOfArray = Belt_MapInt.fromArray; - -let setOfArray = Belt_SetInt.fromArray; - -function emptyMap() { - -} - -let v = Belt_Array.makeByAndShuffle(1000000, i => [ - i, - i -]); - -let u = Belt_MapInt.fromArray(v); - -Belt_MapInt.checkInvariantInternal(u); - -let firstHalf = Belt_Array.slice(v, 0, 2000); - -let xx = Belt_Array.reduce(firstHalf, u, (acc, param) => Belt_MapInt.remove(acc, param[0])); - -Belt_MapInt.checkInvariantInternal(u); - -Belt_MapInt.checkInvariantInternal(xx); - -Mt.from_pair_suites("Bs_map_test", suites.contents); - -let M; - -let N; - -let A; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.M = M; -exports.N = N; -exports.A = A; -exports.mapOfArray = mapOfArray; -exports.setOfArray = setOfArray; -exports.emptyMap = emptyMap; -/* v Not a pure module */ diff --git a/tests/tests/src/bs_map_test.mjs b/tests/tests/src/bs_map_test.mjs new file mode 100644 index 0000000000..b00c10c028 --- /dev/null +++ b/tests/tests/src/bs_map_test.mjs @@ -0,0 +1,90 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_MapInt from "rescript/lib/es6/Belt_MapInt.js"; +import * as Belt_SetInt from "rescript/lib/es6/Belt_SetInt.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function b(loc, v) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Ok", + _0: v + }) + ], + tl: suites.contents + }; +} + +let mapOfArray = Belt_MapInt.fromArray; + +let setOfArray = Belt_SetInt.fromArray; + +function emptyMap() { + +} + +let v = Belt_Array.makeByAndShuffle(1000000, i => [ + i, + i +]); + +let u = Belt_MapInt.fromArray(v); + +Belt_MapInt.checkInvariantInternal(u); + +let firstHalf = Belt_Array.slice(v, 0, 2000); + +let xx = Belt_Array.reduce(firstHalf, u, (acc, param) => Belt_MapInt.remove(acc, param[0])); + +Belt_MapInt.checkInvariantInternal(u); + +Belt_MapInt.checkInvariantInternal(xx); + +Mt.from_pair_suites("Bs_map_test", suites.contents); + +let M; + +let N; + +let A; + +export { + suites, + test_id, + eq, + b, + M, + N, + A, + mapOfArray, + setOfArray, + emptyMap, +} +/* v Not a pure module */ diff --git a/tests/tests/src/bs_min_max_test.js b/tests/tests/src/bs_min_max_test.js deleted file mode 100644 index 6bfb702b13..0000000000 --- a/tests/tests/src/bs_min_max_test.js +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.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(extra, extra$1) { - return Mt.bool_suites(test_id, suites, extra, extra$1); -} - -function f(x, y) { - return Primitive_int.compare(x + y | 0, y + x | 0); -} - -function f2(x, y) { - return Primitive_int.compare(x + y | 0, y); -} - -let f3 = Primitive_int.compare; - -let f4 = Primitive_int.min; - -let f5_min = Primitive_object.min; - -let f5_max = Primitive_object.max; - -eq("File \"bs_min_max_test.res\", line 19, characters 5-12", Primitive_object.min(undefined, 3), undefined); - -eq("File \"bs_min_max_test.res\", line 20, characters 5-12", Primitive_object.min(3, undefined), undefined); - -eq("File \"bs_min_max_test.res\", line 21, characters 5-12", Primitive_object.max(3, undefined), 3); - -eq("File \"bs_min_max_test.res\", line 22, characters 5-12", Primitive_object.max(undefined, 3), 3); - -b("File \"bs_min_max_test.res\", line 23, characters 4-11", Primitive_object.greaterequal(5, undefined)); - -b("File \"bs_min_max_test.res\", line 24, characters 4-11", Primitive_object.lessequal(undefined, 5)); - -b("File \"bs_min_max_test.res\", line 25, characters 4-11", true); - -b("File \"bs_min_max_test.res\", line 26, characters 4-11", true); - -Mt.from_pair_suites("Bs_min_max_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.f = f; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -exports.f5_min = f5_min; -exports.f5_max = f5_max; -/* Not a pure module */ diff --git a/tests/tests/src/bs_min_max_test.mjs b/tests/tests/src/bs_min_max_test.mjs new file mode 100644 index 0000000000..4304874a7a --- /dev/null +++ b/tests/tests/src/bs_min_max_test.mjs @@ -0,0 +1,69 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.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(extra, extra$1) { + return Mt.bool_suites(test_id, suites, extra, extra$1); +} + +function f(x, y) { + return Primitive_int.compare(x + y | 0, y + x | 0); +} + +function f2(x, y) { + return Primitive_int.compare(x + y | 0, y); +} + +let f3 = Primitive_int.compare; + +let f4 = Primitive_int.min; + +let f5_min = Primitive_object.min; + +let f5_max = Primitive_object.max; + +eq("File \"bs_min_max_test.res\", line 19, characters 5-12", Primitive_object.min(undefined, 3), undefined); + +eq("File \"bs_min_max_test.res\", line 20, characters 5-12", Primitive_object.min(3, undefined), undefined); + +eq("File \"bs_min_max_test.res\", line 21, characters 5-12", Primitive_object.max(3, undefined), 3); + +eq("File \"bs_min_max_test.res\", line 22, characters 5-12", Primitive_object.max(undefined, 3), 3); + +b("File \"bs_min_max_test.res\", line 23, characters 4-11", Primitive_object.greaterequal(5, undefined)); + +b("File \"bs_min_max_test.res\", line 24, characters 4-11", Primitive_object.lessequal(undefined, 5)); + +b("File \"bs_min_max_test.res\", line 25, characters 4-11", true); + +b("File \"bs_min_max_test.res\", line 26, characters 4-11", true); + +Mt.from_pair_suites("Bs_min_max_test", suites.contents); + +export { + suites, + test_id, + eq, + b, + f, + f2, + f3, + f4, + f5_min, + f5_max, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_mutable_set_test.js b/tests/tests/src/bs_mutable_set_test.js deleted file mode 100644 index 68c62db52d..0000000000 --- a/tests/tests/src/bs_mutable_set_test.js +++ /dev/null @@ -1,565 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_Range = require("rescript/lib/js/Belt_Range.js"); -let Array_data_util = require("./array_data_util.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Belt_MutableSetInt = require("rescript/lib/js/Belt_MutableSetInt.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); -} - -let u = Belt_MutableSetInt.fromArray(Array_data_util.range(0, 30)); - -b("File \"bs_mutable_set_test.res\", line 22, characters 8-15", Belt_MutableSetInt.removeCheck(u, 0)); - -b("File \"bs_mutable_set_test.res\", line 23, characters 8-15", !Belt_MutableSetInt.removeCheck(u, 0)); - -b("File \"bs_mutable_set_test.res\", line 24, characters 8-15", Belt_MutableSetInt.removeCheck(u, 30)); - -b("File \"bs_mutable_set_test.res\", line 25, characters 8-15", Belt_MutableSetInt.removeCheck(u, 20)); - -eq("File \"bs_mutable_set_test.res\", line 26, characters 9-16", Belt_MutableSetInt.size(u), 28); - -let r = Array_data_util.randomRange(0, 30); - -b("File \"bs_mutable_set_test.res\", line 28, characters 8-15", 29 === Belt_MutableSetInt.maxUndefined(u)); - -b("File \"bs_mutable_set_test.res\", line 29, characters 8-15", 1 === Belt_MutableSetInt.minUndefined(u)); - -Belt_MutableSetInt.add(u, 3); - -for (let i = 0, i_finish = r.length; i < i_finish; ++i) { - Belt_MutableSetInt.remove(u, r[i]); -} - -b("File \"bs_mutable_set_test.res\", line 34, characters 8-15", Belt_MutableSetInt.isEmpty(u)); - -Belt_MutableSetInt.add(u, 0); - -Belt_MutableSetInt.add(u, 1); - -Belt_MutableSetInt.add(u, 2); - -Belt_MutableSetInt.add(u, 0); - -eq("File \"bs_mutable_set_test.res\", line 39, characters 9-16", Belt_MutableSetInt.size(u), 3); - -b("File \"bs_mutable_set_test.res\", line 40, characters 8-15", !Belt_MutableSetInt.isEmpty(u)); - -for (let i$1 = 0; i$1 <= 3; ++i$1) { - Belt_MutableSetInt.remove(u, i$1); -} - -b("File \"bs_mutable_set_test.res\", line 44, characters 8-15", Belt_MutableSetInt.isEmpty(u)); - -Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); - -Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_mutable_set_test.res\", line 47, characters 9-16", Belt_MutableSetInt.size(u), 20001); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_mutable_set_test.res\", line 49, characters 9-16", Belt_MutableSetInt.size(u), 19800); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_mutable_set_test.res\", line 51, characters 9-16", Belt_MutableSetInt.size(u), 19000); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_mutable_set_test.res\", line 53, characters 9-16", Belt_MutableSetInt.size(u), 19000); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(1000, 10000)); - -eq("File \"bs_mutable_set_test.res\", line 55, characters 9-16", Belt_MutableSetInt.size(u), 10000); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 19999)); - -eq("File \"bs_mutable_set_test.res\", line 57, characters 9-16", Belt_MutableSetInt.size(u), 1); - -b("File \"bs_mutable_set_test.res\", line 58, characters 8-15", Belt_MutableSetInt.has(u, 20000)); - -Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 30000)); - -b("File \"bs_mutable_set_test.res\", line 60, characters 8-15", Belt_MutableSetInt.isEmpty(u)); - -let v = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(1000, 2000)); - -let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), x => Belt_MutableSetInt.removeCheck(v, x)); - -let indeedRemoved = Belt_Array.reduce(bs, 0, (acc, x) => { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -}); - -eq("File \"bs_mutable_set_test.res\", line 73, characters 9-16", indeedRemoved, 500); - -eq("File \"bs_mutable_set_test.res\", line 74, characters 9-16", Belt_MutableSetInt.size(v), 501); - -let cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), x => Belt_MutableSetInt.addCheck(v, x)); - -let indeedAded = Belt_Array.reduce(cs, 0, (acc, x) => { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -}); - -eq("File \"bs_mutable_set_test.res\", line 83, characters 9-16", indeedAded, 1000); - -eq("File \"bs_mutable_set_test.res\", line 84, characters 9-16", Belt_MutableSetInt.size(v), 1501); - -b("File \"bs_mutable_set_test.res\", line 85, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.make())); - -eq("File \"bs_mutable_set_test.res\", line 86, characters 9-16", Belt_MutableSetInt.minimum(v), 500); - -eq("File \"bs_mutable_set_test.res\", line 87, characters 9-16", Belt_MutableSetInt.maximum(v), 2000); - -eq("File \"bs_mutable_set_test.res\", line 88, characters 9-16", Belt_MutableSetInt.minUndefined(v), 500); - -eq("File \"bs_mutable_set_test.res\", line 89, characters 9-16", Belt_MutableSetInt.maxUndefined(v), 2000); - -eq("File \"bs_mutable_set_test.res\", line 90, characters 9-16", Belt_MutableSetInt.reduce(v, 0, (x, y) => x + y | 0), 1876250); - -b("File \"bs_mutable_set_test.res\", line 91, characters 8-15", Belt_List.eq(Belt_MutableSetInt.toList(v), Belt_List.makeBy(1501, i => i + 500 | 0), (x, y) => x === y)); - -eq("File \"bs_mutable_set_test.res\", line 92, characters 9-16", Belt_MutableSetInt.toArray(v), Array_data_util.range(500, 2000)); - -Belt_MutableSetInt.checkInvariantInternal(v); - -eq("File \"bs_mutable_set_test.res\", line 94, characters 9-16", Belt_MutableSetInt.get(v, 3), undefined); - -eq("File \"bs_mutable_set_test.res\", line 95, characters 9-16", Belt_MutableSetInt.get(v, 1200), 1200); - -let match = Belt_MutableSetInt.split(v, 1000); - -let match$1 = match[0]; - -let bb = match$1[1]; - -let aa = match$1[0]; - -b("File \"bs_mutable_set_test.res\", line 97, characters 8-15", match[1]); - -b("File \"bs_mutable_set_test.res\", line 98, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(aa), Array_data_util.range(500, 999), (x, y) => x === y)); - -b("File \"bs_mutable_set_test.res\", line 99, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(bb), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_mutable_set_test.res\", line 100, characters 8-15", Belt_MutableSetInt.subset(aa, v)); - -b("File \"bs_mutable_set_test.res\", line 101, characters 8-15", Belt_MutableSetInt.subset(bb, v)); - -b("File \"bs_mutable_set_test.res\", line 102, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa, bb))); - -let c = Belt_MutableSetInt.removeCheck(v, 1000); - -b("File \"bs_mutable_set_test.res\", line 104, characters 8-15", c); - -let match$2 = Belt_MutableSetInt.split(v, 1000); - -let match$3 = match$2[0]; - -let bb$1 = match$3[1]; - -let aa$1 = match$3[0]; - -b("File \"bs_mutable_set_test.res\", line 106, characters 8-15", !match$2[1]); - -b("File \"bs_mutable_set_test.res\", line 107, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(aa$1), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_mutable_set_test.res\", line 108, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(bb$1), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_mutable_set_test.res\", line 109, characters 8-15", Belt_MutableSetInt.subset(aa$1, v)); - -b("File \"bs_mutable_set_test.res\", line 110, characters 8-15", Belt_MutableSetInt.subset(bb$1, v)); - -b("File \"bs_mutable_set_test.res\", line 111, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa$1, bb$1))); - -let aa$2 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 100)); - -let bb$2 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 120)); - -let cc = Belt_MutableSetInt.union(aa$2, bb$2); - -b("File \"bs_mutable_set_test.res\", line 121, characters 8-15", Belt_MutableSetInt.eq(cc, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 120)))); - -b("File \"bs_mutable_set_test.res\", line 124, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.union(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40)))); - -let dd = Belt_MutableSetInt.intersect(aa$2, bb$2); - -b("File \"bs_mutable_set_test.res\", line 128, characters 8-15", Belt_MutableSetInt.eq(dd, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 100)))); - -b("File \"bs_mutable_set_test.res\", line 130, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.make())); - -b("File \"bs_mutable_set_test.res\", line 137, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.make())); - -b("File \"bs_mutable_set_test.res\", line 143, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray([ - 1, - 3, - 4, - 5, - 7, - 9 -]), Belt_MutableSetInt.fromArray([ - 2, - 4, - 5, - 6, - 8, - 10 -])), Belt_MutableSetInt.fromArray([ - 4, - 5 -]))); - -b("File \"bs_mutable_set_test.res\", line 144, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$2, bb$2), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 39)))); - -b("File \"bs_mutable_set_test.res\", line 145, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$2, aa$2), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(101, 120)))); - -b("File \"bs_mutable_set_test.res\", line 147, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)))); - -b("File \"bs_mutable_set_test.res\", line 154, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)))); - -b("File \"bs_mutable_set_test.res\", line 162, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, -1)))); - -let a0 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); - -let a1 = Belt_MutableSetInt.keep(a0, x => x % 2 === 0); - -let a2 = Belt_MutableSetInt.keep(a0, x => x % 2 !== 0); - -let match$4 = Belt_MutableSetInt.partition(a0, x => x % 2 === 0); - -let a4 = match$4[1]; - -let a3 = match$4[0]; - -b("File \"bs_mutable_set_test.res\", line 174, characters 8-15", Belt_MutableSetInt.eq(a1, a3)); - -b("File \"bs_mutable_set_test.res\", line 175, characters 8-15", Belt_MutableSetInt.eq(a2, a4)); - -Belt_List.forEach({ - hd: a0, - tl: { - hd: a1, - tl: { - hd: a2, - tl: { - hd: a3, - tl: { - hd: a4, - tl: /* [] */0 - } - } - } - } -}, Belt_MutableSetInt.checkInvariantInternal); - -let v$1 = Belt_MutableSetInt.make(); - -for (let i$2 = 0; i$2 <= 100000; ++i$2) { - Belt_MutableSetInt.add(v$1, i$2); -} - -Belt_MutableSetInt.checkInvariantInternal(v$1); - -b("File \"bs_mutable_set_test.res\", line 189, characters 10-17", Belt_Range.every(0, 100000, i => Belt_MutableSetInt.has(v$1, i))); - -eq("File \"bs_mutable_set_test.res\", line 190, characters 5-12", Belt_MutableSetInt.size(v$1), 100001); - -let u$1 = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); - -let v$2 = Belt_MutableSetInt.make(); - -Belt_MutableSetInt.mergeMany(v$2, u$1); - -eq("File \"bs_mutable_set_test.res\", line 197, characters 5-12", Belt_MutableSetInt.size(v$2), 91); - -eq("File \"bs_mutable_set_test.res\", line 198, characters 5-12", Belt_MutableSetInt.toArray(v$2), Array_data_util.range(30, 120)); - -let u$2 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); - -let v$3 = Belt_MutableSetInt.fromArray(u$2); - -eq("File \"bs_mutable_set_test.res\", line 204, characters 5-12", Belt_MutableSetInt.size(v$3), 100001); - -let u$3 = Array_data_util.randomRange(50000, 80000); - -for (let i$3 = 0, i_finish$1 = u$3.length; i$3 < i_finish$1; ++i$3) { - Belt_MutableSetInt.remove(v$3, i$3); -} - -eq("File \"bs_mutable_set_test.res\", line 211, characters 5-12", Belt_MutableSetInt.size(v$3), 70000); - -let vv = Array_data_util.randomRange(0, 100000); - -for (let i$4 = 0, i_finish$2 = vv.length; i$4 < i_finish$2; ++i$4) { - Belt_MutableSetInt.remove(v$3, Primitive_array.get(vv, i$4)); -} - -eq("File \"bs_mutable_set_test.res\", line 217, characters 5-12", Belt_MutableSetInt.size(v$3), 0); - -b("File \"bs_mutable_set_test.res\", line 218, characters 4-11", Belt_MutableSetInt.isEmpty(v$3)); - -let v$4 = Belt_MutableSetInt.fromArray(Belt_Array.makeBy(30, i => i)); - -Belt_MutableSetInt.remove(v$4, 30); - -Belt_MutableSetInt.remove(v$4, 29); - -b("File \"bs_mutable_set_test.res\", line 225, characters 4-11", 28 === Belt_MutableSetInt.maxUndefined(v$4)); - -Belt_MutableSetInt.remove(v$4, 0); - -b("File \"bs_mutable_set_test.res\", line 227, characters 4-11", 1 === Belt_MutableSetInt.minUndefined(v$4)); - -eq("File \"bs_mutable_set_test.res\", line 228, characters 5-12", Belt_MutableSetInt.size(v$4), 28); - -let vv$1 = Array_data_util.randomRange(1, 28); - -for (let i$5 = 0, i_finish$3 = vv$1.length; i$5 < i_finish$3; ++i$5) { - Belt_MutableSetInt.remove(v$4, Primitive_array.get(vv$1, i$5)); -} - -eq("File \"bs_mutable_set_test.res\", line 233, characters 5-12", Belt_MutableSetInt.size(v$4), 0); - -function id(loc, x) { - let u = Belt_MutableSetInt.fromSortedArrayUnsafe(x); - Belt_MutableSetInt.checkInvariantInternal(u); - b(loc, Belt_Array.every2(Belt_MutableSetInt.toArray(u), x, (prim0, prim1) => prim0 === prim1)); -} - -id("File \"bs_mutable_set_test.res\", line 243, characters 5-12", []); - -id("File \"bs_mutable_set_test.res\", line 244, characters 5-12", [0]); - -id("File \"bs_mutable_set_test.res\", line 245, characters 5-12", [ - 0, - 1 -]); - -id("File \"bs_mutable_set_test.res\", line 246, characters 5-12", [ - 0, - 1, - 2 -]); - -id("File \"bs_mutable_set_test.res\", line 247, characters 5-12", [ - 0, - 1, - 2, - 3 -]); - -id("File \"bs_mutable_set_test.res\", line 248, characters 5-12", [ - 0, - 1, - 2, - 3, - 4 -]); - -id("File \"bs_mutable_set_test.res\", line 249, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 5 -]); - -id("File \"bs_mutable_set_test.res\", line 250, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6 -]); - -id("File \"bs_mutable_set_test.res\", line 251, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7 -]); - -id("File \"bs_mutable_set_test.res\", line 252, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7, - 8 -]); - -id("File \"bs_mutable_set_test.res\", line 253, characters 5-12", [ - 0, - 1, - 2, - 3, - 4, - 6, - 7, - 8, - 9 -]); - -id("File \"bs_mutable_set_test.res\", line 254, characters 5-12", Array_data_util.range(0, 1000)); - -let v$5 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); - -let copyV = Belt_MutableSetInt.keep(v$5, x => x % 8 === 0); - -let match$5 = Belt_MutableSetInt.partition(v$5, x => x % 8 === 0); - -let cc$1 = Belt_MutableSetInt.keep(v$5, x => x % 8 !== 0); - -for (let i$6 = 0; i$6 <= 200; ++i$6) { - Belt_MutableSetInt.remove(v$5, i$6); -} - -eq("File \"bs_mutable_set_test.res\", line 265, characters 5-12", Belt_MutableSetInt.size(copyV), 126); - -eq("File \"bs_mutable_set_test.res\", line 266, characters 5-12", Belt_MutableSetInt.toArray(copyV), Belt_Array.makeBy(126, i => (i << 3))); - -eq("File \"bs_mutable_set_test.res\", line 267, characters 5-12", Belt_MutableSetInt.size(v$5), 800); - -b("File \"bs_mutable_set_test.res\", line 268, characters 4-11", Belt_MutableSetInt.eq(copyV, match$5[0])); - -b("File \"bs_mutable_set_test.res\", line 269, characters 4-11", Belt_MutableSetInt.eq(cc$1, match$5[1])); - -let v$6 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); - -let match$6 = Belt_MutableSetInt.split(v$6, 400); - -let match$7 = match$6[0]; - -b("File \"bs_mutable_set_test.res\", line 275, characters 4-11", Belt_MutableSetInt.eq(match$7[0], Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 399)))); - -b("File \"bs_mutable_set_test.res\", line 276, characters 4-11", Belt_MutableSetInt.eq(match$7[1], Belt_MutableSetInt.fromArray(Array_data_util.randomRange(401, 1000)))); - -let d = Belt_MutableSetInt.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 1000), x => (x << 1))); - -let match$8 = Belt_MutableSetInt.split(d, 1001); - -let match$9 = match$8[0]; - -b("File \"bs_mutable_set_test.res\", line 279, characters 4-11", Belt_MutableSetInt.eq(match$9[0], Belt_MutableSetInt.fromArray(Belt_Array.makeBy(501, x => (x << 1))))); - -b("File \"bs_mutable_set_test.res\", line 280, characters 4-11", Belt_MutableSetInt.eq(match$9[1], Belt_MutableSetInt.fromArray(Belt_Array.makeBy(500, x => 1002 + (x << 1) | 0)))); - -let aa$3 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 100)); - -let bb$3 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 120)); - -let cc$2 = Belt_MutableSetInt.union(aa$3, bb$3); - -b("File \"bs_mutable_set_test.res\", line 290, characters 4-11", Belt_MutableSetInt.eq(cc$2, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 120)))); - -b("File \"bs_mutable_set_test.res\", line 293, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.union(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40)))); - -let dd$1 = Belt_MutableSetInt.intersect(aa$3, bb$3); - -b("File \"bs_mutable_set_test.res\", line 297, characters 4-11", Belt_MutableSetInt.eq(dd$1, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 100)))); - -b("File \"bs_mutable_set_test.res\", line 299, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.make())); - -b("File \"bs_mutable_set_test.res\", line 303, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.make())); - -b("File \"bs_mutable_set_test.res\", line 306, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray([ - 1, - 3, - 4, - 5, - 7, - 9 -]), Belt_MutableSetInt.fromArray([ - 2, - 4, - 5, - 6, - 8, - 10 -])), Belt_MutableSetInt.fromArray([ - 4, - 5 -]))); - -b("File \"bs_mutable_set_test.res\", line 307, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$3, bb$3), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 39)))); - -b("File \"bs_mutable_set_test.res\", line 308, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$3, aa$3), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(101, 120)))); - -b("File \"bs_mutable_set_test.res\", line 310, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)))); - -b("File \"bs_mutable_set_test.res\", line 317, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)))); - -b("File \"bs_mutable_set_test.res\", line 325, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, -1)))); - -Mt.from_pair_suites("Bs_mutable_set_test", suites.contents); - -let N; - -let $$Array; - -let I; - -let R; - -let A; - -let L; - -let empty = Belt_MutableSetInt.make; - -let fromArray = Belt_MutableSetInt.fromArray; - -let $plus$plus = Belt_MutableSetInt.union; - -let f = Belt_MutableSetInt.fromArray; - -let $eq$tilde = Belt_MutableSetInt.eq; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.N = N; -exports.$$Array = $$Array; -exports.I = I; -exports.R = R; -exports.A = A; -exports.L = L; -exports.empty = empty; -exports.fromArray = fromArray; -exports.$plus$plus = $plus$plus; -exports.f = f; -exports.$eq$tilde = $eq$tilde; -/* u Not a pure module */ diff --git a/tests/tests/src/bs_mutable_set_test.mjs b/tests/tests/src/bs_mutable_set_test.mjs new file mode 100644 index 0000000000..60390f5ff3 --- /dev/null +++ b/tests/tests/src/bs_mutable_set_test.mjs @@ -0,0 +1,566 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_Range from "rescript/lib/es6/Belt_Range.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; +import * as Belt_MutableSetInt from "rescript/lib/es6/Belt_MutableSetInt.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); +} + +let u = Belt_MutableSetInt.fromArray(Array_data_util.range(0, 30)); + +b("File \"bs_mutable_set_test.res\", line 22, characters 8-15", Belt_MutableSetInt.removeCheck(u, 0)); + +b("File \"bs_mutable_set_test.res\", line 23, characters 8-15", !Belt_MutableSetInt.removeCheck(u, 0)); + +b("File \"bs_mutable_set_test.res\", line 24, characters 8-15", Belt_MutableSetInt.removeCheck(u, 30)); + +b("File \"bs_mutable_set_test.res\", line 25, characters 8-15", Belt_MutableSetInt.removeCheck(u, 20)); + +eq("File \"bs_mutable_set_test.res\", line 26, characters 9-16", Belt_MutableSetInt.size(u), 28); + +let r = Array_data_util.randomRange(0, 30); + +b("File \"bs_mutable_set_test.res\", line 28, characters 8-15", 29 === Belt_MutableSetInt.maxUndefined(u)); + +b("File \"bs_mutable_set_test.res\", line 29, characters 8-15", 1 === Belt_MutableSetInt.minUndefined(u)); + +Belt_MutableSetInt.add(u, 3); + +for (let i = 0, i_finish = r.length; i < i_finish; ++i) { + Belt_MutableSetInt.remove(u, r[i]); +} + +b("File \"bs_mutable_set_test.res\", line 34, characters 8-15", Belt_MutableSetInt.isEmpty(u)); + +Belt_MutableSetInt.add(u, 0); + +Belt_MutableSetInt.add(u, 1); + +Belt_MutableSetInt.add(u, 2); + +Belt_MutableSetInt.add(u, 0); + +eq("File \"bs_mutable_set_test.res\", line 39, characters 9-16", Belt_MutableSetInt.size(u), 3); + +b("File \"bs_mutable_set_test.res\", line 40, characters 8-15", !Belt_MutableSetInt.isEmpty(u)); + +for (let i$1 = 0; i$1 <= 3; ++i$1) { + Belt_MutableSetInt.remove(u, i$1); +} + +b("File \"bs_mutable_set_test.res\", line 44, characters 8-15", Belt_MutableSetInt.isEmpty(u)); + +Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 20000)); + +Belt_MutableSetInt.mergeMany(u, Array_data_util.randomRange(0, 200)); + +eq("File \"bs_mutable_set_test.res\", line 47, characters 9-16", Belt_MutableSetInt.size(u), 20001); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 200)); + +eq("File \"bs_mutable_set_test.res\", line 49, characters 9-16", Belt_MutableSetInt.size(u), 19800); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); + +eq("File \"bs_mutable_set_test.res\", line 51, characters 9-16", Belt_MutableSetInt.size(u), 19000); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(0, 1000)); + +eq("File \"bs_mutable_set_test.res\", line 53, characters 9-16", Belt_MutableSetInt.size(u), 19000); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(1000, 10000)); + +eq("File \"bs_mutable_set_test.res\", line 55, characters 9-16", Belt_MutableSetInt.size(u), 10000); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 19999)); + +eq("File \"bs_mutable_set_test.res\", line 57, characters 9-16", Belt_MutableSetInt.size(u), 1); + +b("File \"bs_mutable_set_test.res\", line 58, characters 8-15", Belt_MutableSetInt.has(u, 20000)); + +Belt_MutableSetInt.removeMany(u, Array_data_util.randomRange(10000, 30000)); + +b("File \"bs_mutable_set_test.res\", line 60, characters 8-15", Belt_MutableSetInt.isEmpty(u)); + +let v = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(1000, 2000)); + +let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), x => Belt_MutableSetInt.removeCheck(v, x)); + +let indeedRemoved = Belt_Array.reduce(bs, 0, (acc, x) => { + if (x) { + return acc + 1 | 0; + } else { + return acc; + } +}); + +eq("File \"bs_mutable_set_test.res\", line 73, characters 9-16", indeedRemoved, 500); + +eq("File \"bs_mutable_set_test.res\", line 74, characters 9-16", Belt_MutableSetInt.size(v), 501); + +let cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), x => Belt_MutableSetInt.addCheck(v, x)); + +let indeedAded = Belt_Array.reduce(cs, 0, (acc, x) => { + if (x) { + return acc + 1 | 0; + } else { + return acc; + } +}); + +eq("File \"bs_mutable_set_test.res\", line 83, characters 9-16", indeedAded, 1000); + +eq("File \"bs_mutable_set_test.res\", line 84, characters 9-16", Belt_MutableSetInt.size(v), 1501); + +b("File \"bs_mutable_set_test.res\", line 85, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.make())); + +eq("File \"bs_mutable_set_test.res\", line 86, characters 9-16", Belt_MutableSetInt.minimum(v), 500); + +eq("File \"bs_mutable_set_test.res\", line 87, characters 9-16", Belt_MutableSetInt.maximum(v), 2000); + +eq("File \"bs_mutable_set_test.res\", line 88, characters 9-16", Belt_MutableSetInt.minUndefined(v), 500); + +eq("File \"bs_mutable_set_test.res\", line 89, characters 9-16", Belt_MutableSetInt.maxUndefined(v), 2000); + +eq("File \"bs_mutable_set_test.res\", line 90, characters 9-16", Belt_MutableSetInt.reduce(v, 0, (x, y) => x + y | 0), 1876250); + +b("File \"bs_mutable_set_test.res\", line 91, characters 8-15", Belt_List.eq(Belt_MutableSetInt.toList(v), Belt_List.makeBy(1501, i => i + 500 | 0), (x, y) => x === y)); + +eq("File \"bs_mutable_set_test.res\", line 92, characters 9-16", Belt_MutableSetInt.toArray(v), Array_data_util.range(500, 2000)); + +Belt_MutableSetInt.checkInvariantInternal(v); + +eq("File \"bs_mutable_set_test.res\", line 94, characters 9-16", Belt_MutableSetInt.get(v, 3), undefined); + +eq("File \"bs_mutable_set_test.res\", line 95, characters 9-16", Belt_MutableSetInt.get(v, 1200), 1200); + +let match = Belt_MutableSetInt.split(v, 1000); + +let match$1 = match[0]; + +let bb = match$1[1]; + +let aa = match$1[0]; + +b("File \"bs_mutable_set_test.res\", line 97, characters 8-15", match[1]); + +b("File \"bs_mutable_set_test.res\", line 98, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(aa), Array_data_util.range(500, 999), (x, y) => x === y)); + +b("File \"bs_mutable_set_test.res\", line 99, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(bb), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_mutable_set_test.res\", line 100, characters 8-15", Belt_MutableSetInt.subset(aa, v)); + +b("File \"bs_mutable_set_test.res\", line 101, characters 8-15", Belt_MutableSetInt.subset(bb, v)); + +b("File \"bs_mutable_set_test.res\", line 102, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa, bb))); + +let c = Belt_MutableSetInt.removeCheck(v, 1000); + +b("File \"bs_mutable_set_test.res\", line 104, characters 8-15", c); + +let match$2 = Belt_MutableSetInt.split(v, 1000); + +let match$3 = match$2[0]; + +let bb$1 = match$3[1]; + +let aa$1 = match$3[0]; + +b("File \"bs_mutable_set_test.res\", line 106, characters 8-15", !match$2[1]); + +b("File \"bs_mutable_set_test.res\", line 107, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(aa$1), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_mutable_set_test.res\", line 108, characters 8-15", Belt_Array.eq(Belt_MutableSetInt.toArray(bb$1), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_mutable_set_test.res\", line 109, characters 8-15", Belt_MutableSetInt.subset(aa$1, v)); + +b("File \"bs_mutable_set_test.res\", line 110, characters 8-15", Belt_MutableSetInt.subset(bb$1, v)); + +b("File \"bs_mutable_set_test.res\", line 111, characters 8-15", Belt_MutableSetInt.isEmpty(Belt_MutableSetInt.intersect(aa$1, bb$1))); + +let aa$2 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 100)); + +let bb$2 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 120)); + +let cc = Belt_MutableSetInt.union(aa$2, bb$2); + +b("File \"bs_mutable_set_test.res\", line 121, characters 8-15", Belt_MutableSetInt.eq(cc, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 120)))); + +b("File \"bs_mutable_set_test.res\", line 124, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.union(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40)))); + +let dd = Belt_MutableSetInt.intersect(aa$2, bb$2); + +b("File \"bs_mutable_set_test.res\", line 128, characters 8-15", Belt_MutableSetInt.eq(dd, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 100)))); + +b("File \"bs_mutable_set_test.res\", line 130, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.make())); + +b("File \"bs_mutable_set_test.res\", line 137, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.make())); + +b("File \"bs_mutable_set_test.res\", line 143, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray([ + 1, + 3, + 4, + 5, + 7, + 9 +]), Belt_MutableSetInt.fromArray([ + 2, + 4, + 5, + 6, + 8, + 10 +])), Belt_MutableSetInt.fromArray([ + 4, + 5 +]))); + +b("File \"bs_mutable_set_test.res\", line 144, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$2, bb$2), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 39)))); + +b("File \"bs_mutable_set_test.res\", line 145, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$2, aa$2), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(101, 120)))); + +b("File \"bs_mutable_set_test.res\", line 147, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)))); + +b("File \"bs_mutable_set_test.res\", line 154, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)))); + +b("File \"bs_mutable_set_test.res\", line 162, characters 8-15", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, -1)))); + +let a0 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); + +let a1 = Belt_MutableSetInt.keep(a0, x => x % 2 === 0); + +let a2 = Belt_MutableSetInt.keep(a0, x => x % 2 !== 0); + +let match$4 = Belt_MutableSetInt.partition(a0, x => x % 2 === 0); + +let a4 = match$4[1]; + +let a3 = match$4[0]; + +b("File \"bs_mutable_set_test.res\", line 174, characters 8-15", Belt_MutableSetInt.eq(a1, a3)); + +b("File \"bs_mutable_set_test.res\", line 175, characters 8-15", Belt_MutableSetInt.eq(a2, a4)); + +Belt_List.forEach({ + hd: a0, + tl: { + hd: a1, + tl: { + hd: a2, + tl: { + hd: a3, + tl: { + hd: a4, + tl: /* [] */0 + } + } + } + } +}, Belt_MutableSetInt.checkInvariantInternal); + +let v$1 = Belt_MutableSetInt.make(); + +for (let i$2 = 0; i$2 <= 100000; ++i$2) { + Belt_MutableSetInt.add(v$1, i$2); +} + +Belt_MutableSetInt.checkInvariantInternal(v$1); + +b("File \"bs_mutable_set_test.res\", line 189, characters 10-17", Belt_Range.every(0, 100000, i => Belt_MutableSetInt.has(v$1, i))); + +eq("File \"bs_mutable_set_test.res\", line 190, characters 5-12", Belt_MutableSetInt.size(v$1), 100001); + +let u$1 = Belt_Array.concat(Array_data_util.randomRange(30, 100), Array_data_util.randomRange(40, 120)); + +let v$2 = Belt_MutableSetInt.make(); + +Belt_MutableSetInt.mergeMany(v$2, u$1); + +eq("File \"bs_mutable_set_test.res\", line 197, characters 5-12", Belt_MutableSetInt.size(v$2), 91); + +eq("File \"bs_mutable_set_test.res\", line 198, characters 5-12", Belt_MutableSetInt.toArray(v$2), Array_data_util.range(30, 120)); + +let u$2 = Belt_Array.concat(Array_data_util.randomRange(0, 100000), Array_data_util.randomRange(0, 100)); + +let v$3 = Belt_MutableSetInt.fromArray(u$2); + +eq("File \"bs_mutable_set_test.res\", line 204, characters 5-12", Belt_MutableSetInt.size(v$3), 100001); + +let u$3 = Array_data_util.randomRange(50000, 80000); + +for (let i$3 = 0, i_finish$1 = u$3.length; i$3 < i_finish$1; ++i$3) { + Belt_MutableSetInt.remove(v$3, i$3); +} + +eq("File \"bs_mutable_set_test.res\", line 211, characters 5-12", Belt_MutableSetInt.size(v$3), 70000); + +let vv = Array_data_util.randomRange(0, 100000); + +for (let i$4 = 0, i_finish$2 = vv.length; i$4 < i_finish$2; ++i$4) { + Belt_MutableSetInt.remove(v$3, Primitive_array.get(vv, i$4)); +} + +eq("File \"bs_mutable_set_test.res\", line 217, characters 5-12", Belt_MutableSetInt.size(v$3), 0); + +b("File \"bs_mutable_set_test.res\", line 218, characters 4-11", Belt_MutableSetInt.isEmpty(v$3)); + +let v$4 = Belt_MutableSetInt.fromArray(Belt_Array.makeBy(30, i => i)); + +Belt_MutableSetInt.remove(v$4, 30); + +Belt_MutableSetInt.remove(v$4, 29); + +b("File \"bs_mutable_set_test.res\", line 225, characters 4-11", 28 === Belt_MutableSetInt.maxUndefined(v$4)); + +Belt_MutableSetInt.remove(v$4, 0); + +b("File \"bs_mutable_set_test.res\", line 227, characters 4-11", 1 === Belt_MutableSetInt.minUndefined(v$4)); + +eq("File \"bs_mutable_set_test.res\", line 228, characters 5-12", Belt_MutableSetInt.size(v$4), 28); + +let vv$1 = Array_data_util.randomRange(1, 28); + +for (let i$5 = 0, i_finish$3 = vv$1.length; i$5 < i_finish$3; ++i$5) { + Belt_MutableSetInt.remove(v$4, Primitive_array.get(vv$1, i$5)); +} + +eq("File \"bs_mutable_set_test.res\", line 233, characters 5-12", Belt_MutableSetInt.size(v$4), 0); + +function id(loc, x) { + let u = Belt_MutableSetInt.fromSortedArrayUnsafe(x); + Belt_MutableSetInt.checkInvariantInternal(u); + b(loc, Belt_Array.every2(Belt_MutableSetInt.toArray(u), x, (prim0, prim1) => prim0 === prim1)); +} + +id("File \"bs_mutable_set_test.res\", line 243, characters 5-12", []); + +id("File \"bs_mutable_set_test.res\", line 244, characters 5-12", [0]); + +id("File \"bs_mutable_set_test.res\", line 245, characters 5-12", [ + 0, + 1 +]); + +id("File \"bs_mutable_set_test.res\", line 246, characters 5-12", [ + 0, + 1, + 2 +]); + +id("File \"bs_mutable_set_test.res\", line 247, characters 5-12", [ + 0, + 1, + 2, + 3 +]); + +id("File \"bs_mutable_set_test.res\", line 248, characters 5-12", [ + 0, + 1, + 2, + 3, + 4 +]); + +id("File \"bs_mutable_set_test.res\", line 249, characters 5-12", [ + 0, + 1, + 2, + 3, + 4, + 5 +]); + +id("File \"bs_mutable_set_test.res\", line 250, characters 5-12", [ + 0, + 1, + 2, + 3, + 4, + 6 +]); + +id("File \"bs_mutable_set_test.res\", line 251, characters 5-12", [ + 0, + 1, + 2, + 3, + 4, + 6, + 7 +]); + +id("File \"bs_mutable_set_test.res\", line 252, characters 5-12", [ + 0, + 1, + 2, + 3, + 4, + 6, + 7, + 8 +]); + +id("File \"bs_mutable_set_test.res\", line 253, characters 5-12", [ + 0, + 1, + 2, + 3, + 4, + 6, + 7, + 8, + 9 +]); + +id("File \"bs_mutable_set_test.res\", line 254, characters 5-12", Array_data_util.range(0, 1000)); + +let v$5 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); + +let copyV = Belt_MutableSetInt.keep(v$5, x => x % 8 === 0); + +let match$5 = Belt_MutableSetInt.partition(v$5, x => x % 8 === 0); + +let cc$1 = Belt_MutableSetInt.keep(v$5, x => x % 8 !== 0); + +for (let i$6 = 0; i$6 <= 200; ++i$6) { + Belt_MutableSetInt.remove(v$5, i$6); +} + +eq("File \"bs_mutable_set_test.res\", line 265, characters 5-12", Belt_MutableSetInt.size(copyV), 126); + +eq("File \"bs_mutable_set_test.res\", line 266, characters 5-12", Belt_MutableSetInt.toArray(copyV), Belt_Array.makeBy(126, i => (i << 3))); + +eq("File \"bs_mutable_set_test.res\", line 267, characters 5-12", Belt_MutableSetInt.size(v$5), 800); + +b("File \"bs_mutable_set_test.res\", line 268, characters 4-11", Belt_MutableSetInt.eq(copyV, match$5[0])); + +b("File \"bs_mutable_set_test.res\", line 269, characters 4-11", Belt_MutableSetInt.eq(cc$1, match$5[1])); + +let v$6 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 1000)); + +let match$6 = Belt_MutableSetInt.split(v$6, 400); + +let match$7 = match$6[0]; + +b("File \"bs_mutable_set_test.res\", line 275, characters 4-11", Belt_MutableSetInt.eq(match$7[0], Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 399)))); + +b("File \"bs_mutable_set_test.res\", line 276, characters 4-11", Belt_MutableSetInt.eq(match$7[1], Belt_MutableSetInt.fromArray(Array_data_util.randomRange(401, 1000)))); + +let d = Belt_MutableSetInt.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 1000), x => (x << 1))); + +let match$8 = Belt_MutableSetInt.split(d, 1001); + +let match$9 = match$8[0]; + +b("File \"bs_mutable_set_test.res\", line 279, characters 4-11", Belt_MutableSetInt.eq(match$9[0], Belt_MutableSetInt.fromArray(Belt_Array.makeBy(501, x => (x << 1))))); + +b("File \"bs_mutable_set_test.res\", line 280, characters 4-11", Belt_MutableSetInt.eq(match$9[1], Belt_MutableSetInt.fromArray(Belt_Array.makeBy(500, x => 1002 + (x << 1) | 0)))); + +let aa$3 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 100)); + +let bb$3 = Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 120)); + +let cc$2 = Belt_MutableSetInt.union(aa$3, bb$3); + +b("File \"bs_mutable_set_test.res\", line 290, characters 4-11", Belt_MutableSetInt.eq(cc$2, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 120)))); + +b("File \"bs_mutable_set_test.res\", line 293, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.union(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40)))); + +let dd$1 = Belt_MutableSetInt.intersect(aa$3, bb$3); + +b("File \"bs_mutable_set_test.res\", line 297, characters 4-11", Belt_MutableSetInt.eq(dd$1, Belt_MutableSetInt.fromArray(Array_data_util.randomRange(40, 100)))); + +b("File \"bs_mutable_set_test.res\", line 299, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.make())); + +b("File \"bs_mutable_set_test.res\", line 303, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.make())); + +b("File \"bs_mutable_set_test.res\", line 306, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.intersect(Belt_MutableSetInt.fromArray([ + 1, + 3, + 4, + 5, + 7, + 9 +]), Belt_MutableSetInt.fromArray([ + 2, + 4, + 5, + 6, + 8, + 10 +])), Belt_MutableSetInt.fromArray([ + 4, + 5 +]))); + +b("File \"bs_mutable_set_test.res\", line 307, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(aa$3, bb$3), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 39)))); + +b("File \"bs_mutable_set_test.res\", line 308, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(bb$3, aa$3), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(101, 120)))); + +b("File \"bs_mutable_set_test.res\", line 310, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40)))); + +b("File \"bs_mutable_set_test.res\", line 317, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(21, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)))); + +b("File \"bs_mutable_set_test.res\", line 325, characters 4-11", Belt_MutableSetInt.eq(Belt_MutableSetInt.diff(Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 20)), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, 40))), Belt_MutableSetInt.fromArray(Array_data_util.randomRange(0, -1)))); + +Mt.from_pair_suites("Bs_mutable_set_test", suites.contents); + +let N; + +let $$Array; + +let I; + +let R; + +let A; + +let L; + +let empty = Belt_MutableSetInt.make; + +let fromArray = Belt_MutableSetInt.fromArray; + +let $plus$plus = Belt_MutableSetInt.union; + +let f = Belt_MutableSetInt.fromArray; + +let $eq$tilde = Belt_MutableSetInt.eq; + +export { + suites, + test_id, + eq, + b, + N, + $$Array, + I, + R, + A, + L, + empty, + fromArray, + $plus$plus, + f, + $eq$tilde, +} +/* u Not a pure module */ diff --git a/tests/tests/src/bs_poly_map_test.js b/tests/tests/src/bs_poly_map_test.js deleted file mode 100644 index 73e4fc45c3..0000000000 --- a/tests/tests/src/bs_poly_map_test.js +++ /dev/null @@ -1,273 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Map = require("rescript/lib/js/Belt_Map.js"); -let Belt_Set = require("rescript/lib/js/Belt_Set.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Array_data_util = require("./array_data_util.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.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, v) { - Mt.bool_suites(test_id, suites, loc, v); -} - -let Icmp = Belt_Id.comparable(Primitive_int.compare); - -function mapOfArray(x) { - return Belt_Map.fromArray(x, Icmp); -} - -function setOfArray(x) { - return Belt_Set.fromArray(x, Icmp); -} - -function emptyMap() { - return Belt_Map.make(Icmp); -} - -function mergeInter(s1, s2) { - return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { - if (v1 !== undefined && v2 !== undefined) { - return Primitive_option.some(undefined); - } - - })), Icmp); -} - -function mergeUnion(s1, s2) { - return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { - if (v1 !== undefined || v2 !== undefined) { - return Primitive_option.some(undefined); - } - - })), Icmp); -} - -function mergeDiff(s1, s2) { - return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { - if (v1 !== undefined && v2 === undefined) { - return Primitive_option.some(undefined); - } - - })), Icmp); -} - -function randomRange(i, j) { - return Belt_Array.map(Array_data_util.randomRange(i, j), x => [ - x, - x - ]); -} - -let u0 = Belt_Map.fromArray(randomRange(0, 100), Icmp); - -let u1 = Belt_Map.fromArray(randomRange(30, 120), Icmp); - -b("File \"bs_poly_map_test.res\", line 64, characters 4-11", Belt_Set.eq(mergeInter(u0, u1), Belt_Set.fromArray(Array_data_util.range(30, 100), Icmp))); - -b("File \"bs_poly_map_test.res\", line 65, characters 4-11", Belt_Set.eq(mergeUnion(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 120), Icmp))); - -b("File \"bs_poly_map_test.res\", line 66, characters 4-11", Belt_Set.eq(mergeDiff(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 29), Icmp))); - -b("File \"bs_poly_map_test.res\", line 67, characters 4-11", Belt_Set.eq(mergeDiff(u1, u0), Belt_Set.fromArray(Array_data_util.range(101, 120), Icmp))); - -let a0 = Belt_Map.fromArray(randomRange(0, 10), Icmp); - -let a1 = Belt_Map.set(a0, 3, 33); - -let a2 = Belt_Map.remove(a1, 3); - -let a3 = Belt_Map.update(a2, 3, k => { - if (k !== undefined) { - return k + 1 | 0; - } else { - return 11; - } -}); - -let a4 = Belt_Map.update(a2, 3, k => { - if (k !== undefined) { - return k + 1 | 0; - } - -}); - -let a5 = Belt_Map.remove(a0, 3); - -let a6 = Belt_Map.remove(a5, 3); - -b("File \"bs_poly_map_test.res\", line 88, characters 4-11", a5 === a6); - -b("File \"bs_poly_map_test.res\", line 89, characters 4-11", Belt_Map.has(a0, 3)); - -b("File \"bs_poly_map_test.res\", line 90, characters 4-11", !Belt_Map.has(a5, 3)); - -b("File \"bs_poly_map_test.res\", line 91, characters 4-11", 3 === Belt_Map.getUndefined(a0, 3)); - -b("File \"bs_poly_map_test.res\", line 92, characters 4-11", 33 === Belt_Map.getUndefined(a1, 3)); - -b("File \"bs_poly_map_test.res\", line 93, characters 4-11", Belt_Map.getUndefined(a2, 3) === undefined); - -b("File \"bs_poly_map_test.res\", line 95, characters 4-11", 11 === Belt_Map.getUndefined(a3, 3)); - -b("File \"bs_poly_map_test.res\", line 96, characters 4-11", Belt_Map.getUndefined(a4, 3) === undefined); - -let a7 = Belt_Map.removeMany(a0, [ - 7, - 8, - 0, - 1, - 3, - 2, - 4, - 922, - 4, - 5, - 6 -]); - -eq("File \"bs_poly_map_test.res\", line 99, characters 5-12", Belt_Map.keysToArray(a7), [ - 9, - 10 -]); - -let a8 = Belt_Map.removeMany(a7, Array_data_util.randomRange(0, 100)); - -b("File \"bs_poly_map_test.res\", line 101, characters 4-11", Belt_Map.isEmpty(a8)); - -let u0$1 = Belt_Map.fromArray(randomRange(0, 100), Icmp); - -let u1$1 = Belt_Map.set(u0$1, 3, 32); - -eq("File \"bs_poly_map_test.res\", line 107, characters 5-12", Belt_Map.get(u1$1, 3), 32); - -eq("File \"bs_poly_map_test.res\", line 108, characters 5-12", Belt_Map.get(u0$1, 3), 3); - -function acc(m, is) { - return Belt_Array.reduce(is, m, (a, i) => Belt_Map.update(a, i, n => { - if (n !== undefined) { - return n + 1 | 0; - } else { - return 1; - } - })); -} - -let m = Belt_Map.make(Icmp); - -let m1 = acc(m, Belt_Array.concat(Array_data_util.randomRange(0, 20), Array_data_util.randomRange(10, 30))); - -b("File \"bs_poly_map_test.res\", line 125, characters 4-11", Belt_Map.eq(m1, Belt_Map.fromArray(Belt_Array.makeBy(31, i => [ - i, - i >= 10 && i <= 20 ? 2 : 1 -]), Icmp), (x, y) => x === y)); - -let v0 = Belt_Map.make(Icmp); - -let v1 = Belt_Map.mergeMany(v0, Belt_Array.map(Array_data_util.randomRange(0, 10000), x => [ - x, - x -])); - -let v2 = Belt_Map.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 10000), x => [ - x, - x -]), Icmp); - -b("File \"bs_poly_map_test.res\", line 149, characters 4-11", Belt_Map.eq(v1, v2, (x, y) => x === y)); - -function inc(x) { - if (x !== undefined) { - return x + 1 | 0; - } else { - return 0; - } -} - -let v3 = Belt_Map.update(v1, 10, inc); - -let v4 = Belt_Map.update(v3, -10, inc); - -let match = Belt_Map.split(v3, 5000); - -let pres = match[1]; - -let match$1 = match[0]; - -let match$2 = Belt_Map.get(v3, 10); - -b("File \"bs_poly_map_test.res\", line 160, characters 4-11", match$2 !== undefined ? match$2 === 11 : false); - -let match$3 = Belt_Map.get(v3, -10); - -b("File \"bs_poly_map_test.res\", line 167, characters 4-11", match$3 === undefined); - -let match$4 = Belt_Map.get(v4, -10); - -b("File \"bs_poly_map_test.res\", line 174, characters 4-11", match$4 !== undefined ? match$4 === 0 : false); - -b("File \"bs_poly_map_test.res\", line 180, characters 4-11", Belt_Map.isEmpty(Belt_Map.remove(Belt_Map.make(Icmp), 0))); - -b("File \"bs_poly_map_test.res\", line 181, characters 4-11", Belt_Map.isEmpty(Belt_Map.removeMany(Belt_Map.make(Icmp), [0]))); - -b("File \"bs_poly_map_test.res\", line 183, characters 4-11", pres !== undefined ? pres === 5000 : false); - -b("File \"bs_poly_map_test.res\", line 189, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$1[0]), Belt_Array.makeBy(5000, i => i), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_map_test.res\", line 190, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$1[1]), Belt_Array.makeBy(5000, i => 5001 + i | 0), (prim0, prim1) => prim0 === prim1)); - -let v7 = Belt_Map.remove(v3, 5000); - -let match$5 = Belt_Map.split(v7, 5000); - -let match$6 = match$5[0]; - -b("File \"bs_poly_map_test.res\", line 195, characters 4-11", match$5[1] === undefined); - -b("File \"bs_poly_map_test.res\", line 201, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$6[0]), Belt_Array.makeBy(5000, i => i), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_map_test.res\", line 202, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$6[1]), Belt_Array.makeBy(5000, i => 5001 + i | 0), (prim0, prim1) => prim0 === prim1)); - -Mt.from_pair_suites("Bs_poly_map_test", suites.contents); - -let M; - -let N; - -let A; - -let I; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.Icmp = Icmp; -exports.M = M; -exports.N = N; -exports.A = A; -exports.I = I; -exports.mapOfArray = mapOfArray; -exports.setOfArray = setOfArray; -exports.emptyMap = emptyMap; -exports.mergeInter = mergeInter; -exports.mergeUnion = mergeUnion; -exports.mergeDiff = mergeDiff; -exports.randomRange = randomRange; -exports.acc = acc; -/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_map_test.mjs b/tests/tests/src/bs_poly_map_test.mjs new file mode 100644 index 0000000000..3497df028e --- /dev/null +++ b/tests/tests/src/bs_poly_map_test.mjs @@ -0,0 +1,274 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Map from "rescript/lib/es6/Belt_Map.js"; +import * as Belt_Set from "rescript/lib/es6/Belt_Set.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.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, v) { + Mt.bool_suites(test_id, suites, loc, v); +} + +let Icmp = Belt_Id.comparable(Primitive_int.compare); + +function mapOfArray(x) { + return Belt_Map.fromArray(x, Icmp); +} + +function setOfArray(x) { + return Belt_Set.fromArray(x, Icmp); +} + +function emptyMap() { + return Belt_Map.make(Icmp); +} + +function mergeInter(s1, s2) { + return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { + if (v1 !== undefined && v2 !== undefined) { + return Primitive_option.some(undefined); + } + + })), Icmp); +} + +function mergeUnion(s1, s2) { + return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { + if (v1 !== undefined || v2 !== undefined) { + return Primitive_option.some(undefined); + } + + })), Icmp); +} + +function mergeDiff(s1, s2) { + return Belt_Set.fromArray(Belt_Map.keysToArray(Belt_Map.merge(s1, s2, (k, v1, v2) => { + if (v1 !== undefined && v2 === undefined) { + return Primitive_option.some(undefined); + } + + })), Icmp); +} + +function randomRange(i, j) { + return Belt_Array.map(Array_data_util.randomRange(i, j), x => [ + x, + x + ]); +} + +let u0 = Belt_Map.fromArray(randomRange(0, 100), Icmp); + +let u1 = Belt_Map.fromArray(randomRange(30, 120), Icmp); + +b("File \"bs_poly_map_test.res\", line 64, characters 4-11", Belt_Set.eq(mergeInter(u0, u1), Belt_Set.fromArray(Array_data_util.range(30, 100), Icmp))); + +b("File \"bs_poly_map_test.res\", line 65, characters 4-11", Belt_Set.eq(mergeUnion(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 120), Icmp))); + +b("File \"bs_poly_map_test.res\", line 66, characters 4-11", Belt_Set.eq(mergeDiff(u0, u1), Belt_Set.fromArray(Array_data_util.range(0, 29), Icmp))); + +b("File \"bs_poly_map_test.res\", line 67, characters 4-11", Belt_Set.eq(mergeDiff(u1, u0), Belt_Set.fromArray(Array_data_util.range(101, 120), Icmp))); + +let a0 = Belt_Map.fromArray(randomRange(0, 10), Icmp); + +let a1 = Belt_Map.set(a0, 3, 33); + +let a2 = Belt_Map.remove(a1, 3); + +let a3 = Belt_Map.update(a2, 3, k => { + if (k !== undefined) { + return k + 1 | 0; + } else { + return 11; + } +}); + +let a4 = Belt_Map.update(a2, 3, k => { + if (k !== undefined) { + return k + 1 | 0; + } + +}); + +let a5 = Belt_Map.remove(a0, 3); + +let a6 = Belt_Map.remove(a5, 3); + +b("File \"bs_poly_map_test.res\", line 88, characters 4-11", a5 === a6); + +b("File \"bs_poly_map_test.res\", line 89, characters 4-11", Belt_Map.has(a0, 3)); + +b("File \"bs_poly_map_test.res\", line 90, characters 4-11", !Belt_Map.has(a5, 3)); + +b("File \"bs_poly_map_test.res\", line 91, characters 4-11", 3 === Belt_Map.getUndefined(a0, 3)); + +b("File \"bs_poly_map_test.res\", line 92, characters 4-11", 33 === Belt_Map.getUndefined(a1, 3)); + +b("File \"bs_poly_map_test.res\", line 93, characters 4-11", Belt_Map.getUndefined(a2, 3) === undefined); + +b("File \"bs_poly_map_test.res\", line 95, characters 4-11", 11 === Belt_Map.getUndefined(a3, 3)); + +b("File \"bs_poly_map_test.res\", line 96, characters 4-11", Belt_Map.getUndefined(a4, 3) === undefined); + +let a7 = Belt_Map.removeMany(a0, [ + 7, + 8, + 0, + 1, + 3, + 2, + 4, + 922, + 4, + 5, + 6 +]); + +eq("File \"bs_poly_map_test.res\", line 99, characters 5-12", Belt_Map.keysToArray(a7), [ + 9, + 10 +]); + +let a8 = Belt_Map.removeMany(a7, Array_data_util.randomRange(0, 100)); + +b("File \"bs_poly_map_test.res\", line 101, characters 4-11", Belt_Map.isEmpty(a8)); + +let u0$1 = Belt_Map.fromArray(randomRange(0, 100), Icmp); + +let u1$1 = Belt_Map.set(u0$1, 3, 32); + +eq("File \"bs_poly_map_test.res\", line 107, characters 5-12", Belt_Map.get(u1$1, 3), 32); + +eq("File \"bs_poly_map_test.res\", line 108, characters 5-12", Belt_Map.get(u0$1, 3), 3); + +function acc(m, is) { + return Belt_Array.reduce(is, m, (a, i) => Belt_Map.update(a, i, n => { + if (n !== undefined) { + return n + 1 | 0; + } else { + return 1; + } + })); +} + +let m = Belt_Map.make(Icmp); + +let m1 = acc(m, Belt_Array.concat(Array_data_util.randomRange(0, 20), Array_data_util.randomRange(10, 30))); + +b("File \"bs_poly_map_test.res\", line 125, characters 4-11", Belt_Map.eq(m1, Belt_Map.fromArray(Belt_Array.makeBy(31, i => [ + i, + i >= 10 && i <= 20 ? 2 : 1 +]), Icmp), (x, y) => x === y)); + +let v0 = Belt_Map.make(Icmp); + +let v1 = Belt_Map.mergeMany(v0, Belt_Array.map(Array_data_util.randomRange(0, 10000), x => [ + x, + x +])); + +let v2 = Belt_Map.fromArray(Belt_Array.map(Array_data_util.randomRange(0, 10000), x => [ + x, + x +]), Icmp); + +b("File \"bs_poly_map_test.res\", line 149, characters 4-11", Belt_Map.eq(v1, v2, (x, y) => x === y)); + +function inc(x) { + if (x !== undefined) { + return x + 1 | 0; + } else { + return 0; + } +} + +let v3 = Belt_Map.update(v1, 10, inc); + +let v4 = Belt_Map.update(v3, -10, inc); + +let match = Belt_Map.split(v3, 5000); + +let pres = match[1]; + +let match$1 = match[0]; + +let match$2 = Belt_Map.get(v3, 10); + +b("File \"bs_poly_map_test.res\", line 160, characters 4-11", match$2 !== undefined ? match$2 === 11 : false); + +let match$3 = Belt_Map.get(v3, -10); + +b("File \"bs_poly_map_test.res\", line 167, characters 4-11", match$3 === undefined); + +let match$4 = Belt_Map.get(v4, -10); + +b("File \"bs_poly_map_test.res\", line 174, characters 4-11", match$4 !== undefined ? match$4 === 0 : false); + +b("File \"bs_poly_map_test.res\", line 180, characters 4-11", Belt_Map.isEmpty(Belt_Map.remove(Belt_Map.make(Icmp), 0))); + +b("File \"bs_poly_map_test.res\", line 181, characters 4-11", Belt_Map.isEmpty(Belt_Map.removeMany(Belt_Map.make(Icmp), [0]))); + +b("File \"bs_poly_map_test.res\", line 183, characters 4-11", pres !== undefined ? pres === 5000 : false); + +b("File \"bs_poly_map_test.res\", line 189, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$1[0]), Belt_Array.makeBy(5000, i => i), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_map_test.res\", line 190, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$1[1]), Belt_Array.makeBy(5000, i => 5001 + i | 0), (prim0, prim1) => prim0 === prim1)); + +let v7 = Belt_Map.remove(v3, 5000); + +let match$5 = Belt_Map.split(v7, 5000); + +let match$6 = match$5[0]; + +b("File \"bs_poly_map_test.res\", line 195, characters 4-11", match$5[1] === undefined); + +b("File \"bs_poly_map_test.res\", line 201, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$6[0]), Belt_Array.makeBy(5000, i => i), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_map_test.res\", line 202, characters 4-11", Belt_Array.eq(Belt_Map.keysToArray(match$6[1]), Belt_Array.makeBy(5000, i => 5001 + i | 0), (prim0, prim1) => prim0 === prim1)); + +Mt.from_pair_suites("Bs_poly_map_test", suites.contents); + +let M; + +let N; + +let A; + +let I; + +export { + suites, + test_id, + eq, + b, + Icmp, + M, + N, + A, + I, + mapOfArray, + setOfArray, + emptyMap, + mergeInter, + mergeUnion, + mergeDiff, + randomRange, + acc, +} +/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_mutable_map_test.js b/tests/tests/src/bs_poly_mutable_map_test.js deleted file mode 100644 index 1d716df63a..0000000000 --- a/tests/tests/src/bs_poly_mutable_map_test.js +++ /dev/null @@ -1,119 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Set = require("rescript/lib/js/Belt_Set.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_MutableMap = require("rescript/lib/js/Belt_MutableMap.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, v) { - Mt.bool_suites(test_id, suites, loc, v); -} - -let Icmp = Belt_Id.comparable(Primitive_int.compare); - -function f(x) { - return Belt_MutableMap.fromArray(x, Icmp); -} - -function ff(x) { - return Belt_Set.fromArray(x, Icmp); -} - -function randomRange(i, j) { - return Belt_Array.map(Array_data_util.randomRange(i, j), x => [ - x, - x - ]); -} - -let a0 = Belt_MutableMap.fromArray(randomRange(0, 10), Icmp); - -Belt_MutableMap.set(a0, 3, 33); - -eq("File \"bs_poly_mutable_map_test.res\", line 27, characters 5-12", Belt_MutableMap.getExn(a0, 3), 33); - -Belt_MutableMap.removeMany(a0, [ - 7, - 8, - 0, - 1, - 3, - 2, - 4, - 922, - 4, - 5, - 6 -]); - -eq("File \"bs_poly_mutable_map_test.res\", line 29, characters 5-12", Belt_MutableMap.keysToArray(a0), [ - 9, - 10 -]); - -Belt_MutableMap.removeMany(a0, Array_data_util.randomRange(0, 100)); - -b("File \"bs_poly_mutable_map_test.res\", line 31, characters 4-11", Belt_MutableMap.isEmpty(a0)); - -let a0$1 = Belt_MutableMap.fromArray(randomRange(0, 10000), Icmp); - -Belt_MutableMap.set(a0$1, 2000, 33); - -Belt_MutableMap.removeMany(a0$1, Belt_Array.map(randomRange(0, 1998), prim => prim[0])); - -Belt_MutableMap.removeMany(a0$1, Belt_Array.map(randomRange(2002, 11000), prim => prim[0])); - -eq("File \"bs_poly_mutable_map_test.res\", line 39, characters 5-12", Belt_MutableMap.toArray(a0$1), [ - [ - 1999, - 1999 - ], - [ - 2000, - 33 - ], - [ - 2001, - 2001 - ] -]); - -Mt.from_pair_suites("Bs_poly_mutable_map_test", suites.contents); - -let M; - -let N; - -let A; - -let I; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.Icmp = Icmp; -exports.M = M; -exports.N = N; -exports.A = A; -exports.I = I; -exports.f = f; -exports.ff = ff; -exports.randomRange = randomRange; -/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_mutable_map_test.mjs b/tests/tests/src/bs_poly_mutable_map_test.mjs new file mode 100644 index 0000000000..0889bd339c --- /dev/null +++ b/tests/tests/src/bs_poly_mutable_map_test.mjs @@ -0,0 +1,120 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Set from "rescript/lib/es6/Belt_Set.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Belt_MutableMap from "rescript/lib/es6/Belt_MutableMap.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, v) { + Mt.bool_suites(test_id, suites, loc, v); +} + +let Icmp = Belt_Id.comparable(Primitive_int.compare); + +function f(x) { + return Belt_MutableMap.fromArray(x, Icmp); +} + +function ff(x) { + return Belt_Set.fromArray(x, Icmp); +} + +function randomRange(i, j) { + return Belt_Array.map(Array_data_util.randomRange(i, j), x => [ + x, + x + ]); +} + +let a0 = Belt_MutableMap.fromArray(randomRange(0, 10), Icmp); + +Belt_MutableMap.set(a0, 3, 33); + +eq("File \"bs_poly_mutable_map_test.res\", line 27, characters 5-12", Belt_MutableMap.getExn(a0, 3), 33); + +Belt_MutableMap.removeMany(a0, [ + 7, + 8, + 0, + 1, + 3, + 2, + 4, + 922, + 4, + 5, + 6 +]); + +eq("File \"bs_poly_mutable_map_test.res\", line 29, characters 5-12", Belt_MutableMap.keysToArray(a0), [ + 9, + 10 +]); + +Belt_MutableMap.removeMany(a0, Array_data_util.randomRange(0, 100)); + +b("File \"bs_poly_mutable_map_test.res\", line 31, characters 4-11", Belt_MutableMap.isEmpty(a0)); + +let a0$1 = Belt_MutableMap.fromArray(randomRange(0, 10000), Icmp); + +Belt_MutableMap.set(a0$1, 2000, 33); + +Belt_MutableMap.removeMany(a0$1, Belt_Array.map(randomRange(0, 1998), prim => prim[0])); + +Belt_MutableMap.removeMany(a0$1, Belt_Array.map(randomRange(2002, 11000), prim => prim[0])); + +eq("File \"bs_poly_mutable_map_test.res\", line 39, characters 5-12", Belt_MutableMap.toArray(a0$1), [ + [ + 1999, + 1999 + ], + [ + 2000, + 33 + ], + [ + 2001, + 2001 + ] +]); + +Mt.from_pair_suites("Bs_poly_mutable_map_test", suites.contents); + +let M; + +let N; + +let A; + +let I; + +export { + suites, + test_id, + eq, + b, + Icmp, + M, + N, + A, + I, + f, + ff, + randomRange, +} +/* Icmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_mutable_set_test.js b/tests/tests/src/bs_poly_mutable_set_test.js deleted file mode 100644 index c227292fac..0000000000 --- a/tests/tests/src/bs_poly_mutable_set_test.js +++ /dev/null @@ -1,320 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Array_data_util = require("./array_data_util.js"); -let Belt_MutableSet = require("rescript/lib/js/Belt_MutableSet.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); -} - -let IntCmp = Belt_Id.comparable(Primitive_int.compare); - -function fromArray(none) { - return Belt_MutableSet.fromArray(none, IntCmp); -} - -function empty() { - return Belt_MutableSet.make(IntCmp); -} - -let u = Belt_MutableSet.fromArray(Array_data_util.range(0, 30), IntCmp); - -b("File \"bs_poly_mutable_set_test.res\", line 16, characters 4-11", Belt_MutableSet.removeCheck(u, 0)); - -b("File \"bs_poly_mutable_set_test.res\", line 17, characters 4-11", !Belt_MutableSet.removeCheck(u, 0)); - -b("File \"bs_poly_mutable_set_test.res\", line 18, characters 4-11", Belt_MutableSet.removeCheck(u, 30)); - -b("File \"bs_poly_mutable_set_test.res\", line 19, characters 4-11", Belt_MutableSet.removeCheck(u, 20)); - -eq("File \"bs_poly_mutable_set_test.res\", line 20, characters 5-12", Belt_MutableSet.size(u), 28); - -let r = Array_data_util.randomRange(0, 30); - -b("File \"bs_poly_mutable_set_test.res\", line 22, characters 4-11", 29 === Belt_MutableSet.maxUndefined(u)); - -b("File \"bs_poly_mutable_set_test.res\", line 23, characters 4-11", 1 === Belt_MutableSet.minUndefined(u)); - -Belt_MutableSet.add(u, 3); - -for (let i = 0, i_finish = r.length; i < i_finish; ++i) { - Belt_MutableSet.remove(u, r[i]); -} - -b("File \"bs_poly_mutable_set_test.res\", line 28, characters 4-11", Belt_MutableSet.isEmpty(u)); - -Belt_MutableSet.add(u, 0); - -Belt_MutableSet.add(u, 1); - -Belt_MutableSet.add(u, 2); - -Belt_MutableSet.add(u, 0); - -eq("File \"bs_poly_mutable_set_test.res\", line 33, characters 5-12", Belt_MutableSet.size(u), 3); - -b("File \"bs_poly_mutable_set_test.res\", line 34, characters 4-11", !Belt_MutableSet.isEmpty(u)); - -for (let i$1 = 0; i$1 <= 3; ++i$1) { - Belt_MutableSet.remove(u, i$1); -} - -b("File \"bs_poly_mutable_set_test.res\", line 38, characters 4-11", Belt_MutableSet.isEmpty(u)); - -Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 20000)); - -Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_poly_mutable_set_test.res\", line 41, characters 5-12", Belt_MutableSet.size(u), 20001); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 200)); - -eq("File \"bs_poly_mutable_set_test.res\", line 43, characters 5-12", Belt_MutableSet.size(u), 19800); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_poly_mutable_set_test.res\", line 45, characters 5-12", Belt_MutableSet.size(u), 19000); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); - -eq("File \"bs_poly_mutable_set_test.res\", line 47, characters 5-12", Belt_MutableSet.size(u), 19000); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(1000, 10000)); - -eq("File \"bs_poly_mutable_set_test.res\", line 49, characters 5-12", Belt_MutableSet.size(u), 10000); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 19999)); - -eq("File \"bs_poly_mutable_set_test.res\", line 51, characters 5-12", Belt_MutableSet.size(u), 1); - -b("File \"bs_poly_mutable_set_test.res\", line 52, characters 4-11", Belt_MutableSet.has(u, 20000)); - -Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 30000)); - -b("File \"bs_poly_mutable_set_test.res\", line 54, characters 4-11", Belt_MutableSet.isEmpty(u)); - -let v = Belt_MutableSet.fromArray(Array_data_util.randomRange(1000, 2000), IntCmp); - -let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), x => Belt_MutableSet.removeCheck(v, x)); - -let indeedRemoved = Belt_Array.reduce(bs, 0, (acc, x) => { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -}); - -eq("File \"bs_poly_mutable_set_test.res\", line 67, characters 5-12", indeedRemoved, 500); - -eq("File \"bs_poly_mutable_set_test.res\", line 68, characters 5-12", Belt_MutableSet.size(v), 501); - -let cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), x => Belt_MutableSet.addCheck(v, x)); - -let indeedAded = Belt_Array.reduce(cs, 0, (acc, x) => { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -}); - -eq("File \"bs_poly_mutable_set_test.res\", line 77, characters 5-12", indeedAded, 1000); - -eq("File \"bs_poly_mutable_set_test.res\", line 78, characters 5-12", Belt_MutableSet.size(v), 1501); - -b("File \"bs_poly_mutable_set_test.res\", line 79, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.make(IntCmp))); - -eq("File \"bs_poly_mutable_set_test.res\", line 80, characters 5-12", Belt_MutableSet.minimum(v), 500); - -eq("File \"bs_poly_mutable_set_test.res\", line 81, characters 5-12", Belt_MutableSet.maximum(v), 2000); - -eq("File \"bs_poly_mutable_set_test.res\", line 82, characters 5-12", Belt_MutableSet.minUndefined(v), 500); - -eq("File \"bs_poly_mutable_set_test.res\", line 83, characters 5-12", Belt_MutableSet.maxUndefined(v), 2000); - -eq("File \"bs_poly_mutable_set_test.res\", line 84, characters 5-12", Belt_MutableSet.reduce(v, 0, (x, y) => x + y | 0), 1876250); - -b("File \"bs_poly_mutable_set_test.res\", line 85, characters 4-11", Belt_List.eq(Belt_MutableSet.toList(v), Belt_List.makeBy(1501, i => i + 500 | 0), (x, y) => x === y)); - -eq("File \"bs_poly_mutable_set_test.res\", line 86, characters 5-12", Belt_MutableSet.toArray(v), Array_data_util.range(500, 2000)); - -Belt_MutableSet.checkInvariantInternal(v); - -eq("File \"bs_poly_mutable_set_test.res\", line 88, characters 5-12", Belt_MutableSet.get(v, 3), undefined); - -eq("File \"bs_poly_mutable_set_test.res\", line 89, characters 5-12", Belt_MutableSet.get(v, 1200), 1200); - -let match = Belt_MutableSet.split(v, 1000); - -let match$1 = match[0]; - -let bb = match$1[1]; - -let aa = match$1[0]; - -b("File \"bs_poly_mutable_set_test.res\", line 91, characters 4-11", match[1]); - -b("File \"bs_poly_mutable_set_test.res\", line 92, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(aa), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_mutable_set_test.res\", line 93, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(bb), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_mutable_set_test.res\", line 94, characters 4-11", Belt_MutableSet.subset(aa, v)); - -b("File \"bs_poly_mutable_set_test.res\", line 95, characters 4-11", Belt_MutableSet.subset(bb, v)); - -b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa, bb))); - -let c = Belt_MutableSet.removeCheck(v, 1000); - -b("File \"bs_poly_mutable_set_test.res\", line 98, characters 4-11", c); - -let match$2 = Belt_MutableSet.split(v, 1000); - -let match$3 = match$2[0]; - -let bb$1 = match$3[1]; - -let aa$1 = match$3[0]; - -b("File \"bs_poly_mutable_set_test.res\", line 100, characters 4-11", !match$2[1]); - -b("File \"bs_poly_mutable_set_test.res\", line 101, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(aa$1), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_mutable_set_test.res\", line 102, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(bb$1), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); - -b("File \"bs_poly_mutable_set_test.res\", line 103, characters 4-11", Belt_MutableSet.subset(aa$1, v)); - -b("File \"bs_poly_mutable_set_test.res\", line 104, characters 4-11", Belt_MutableSet.subset(bb$1, v)); - -b("File \"bs_poly_mutable_set_test.res\", line 105, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa$1, bb$1))); - -let aa$2 = Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 100), IntCmp); - -let bb$2 = Belt_MutableSet.fromArray(Array_data_util.randomRange(40, 120), IntCmp); - -let cc = Belt_MutableSet.union(aa$2, bb$2); - -b("File \"bs_poly_mutable_set_test.res\", line 115, characters 4-11", Belt_MutableSet.eq(cc, Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 120), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 118, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.union(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 40), IntCmp))); - -let dd = Belt_MutableSet.intersect(aa$2, bb$2); - -b("File \"bs_poly_mutable_set_test.res\", line 122, characters 4-11", Belt_MutableSet.eq(dd, Belt_MutableSet.fromArray(Array_data_util.randomRange(40, 100), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 124, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.make(IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 128, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp)), Belt_MutableSet.make(IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 131, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray([ - 1, - 3, - 4, - 5, - 7, - 9 -], IntCmp), Belt_MutableSet.fromArray([ - 2, - 4, - 5, - 6, - 8, - 10 -], IntCmp)), Belt_MutableSet.fromArray([ - 4, - 5 -], IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 132, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(aa$2, bb$2), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 39), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 133, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(bb$2, aa$2), Belt_MutableSet.fromArray(Array_data_util.randomRange(101, 120), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 135, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 142, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp))); - -b("File \"bs_poly_mutable_set_test.res\", line 150, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, -1), IntCmp))); - -let a0 = Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 1000), IntCmp); - -let a1 = Belt_MutableSet.keep(a0, x => x % 2 === 0); - -let a2 = Belt_MutableSet.keep(a0, x => x % 2 !== 0); - -let match$4 = Belt_MutableSet.partition(a0, x => x % 2 === 0); - -let a4 = match$4[1]; - -let a3 = match$4[0]; - -b("File \"bs_poly_mutable_set_test.res\", line 162, characters 4-11", Belt_MutableSet.eq(a1, a3)); - -b("File \"bs_poly_mutable_set_test.res\", line 163, characters 4-11", Belt_MutableSet.eq(a2, a4)); - -Belt_List.forEach({ - hd: a0, - tl: { - hd: a1, - tl: { - hd: a2, - tl: { - hd: a3, - tl: { - hd: a4, - tl: /* [] */0 - } - } - } - } -}, Belt_MutableSet.checkInvariantInternal); - -Mt.from_pair_suites("Bs_poly_mutable_set_test", suites.contents); - -let N; - -let I; - -let A; - -let L; - -let $plus$plus = Belt_MutableSet.union; - -let f = fromArray; - -let $eq$tilde = Belt_MutableSet.eq; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.N = N; -exports.I = I; -exports.A = A; -exports.IntCmp = IntCmp; -exports.L = L; -exports.fromArray = fromArray; -exports.empty = empty; -exports.$plus$plus = $plus$plus; -exports.f = f; -exports.$eq$tilde = $eq$tilde; -/* IntCmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_mutable_set_test.mjs b/tests/tests/src/bs_poly_mutable_set_test.mjs new file mode 100644 index 0000000000..4b5d186f68 --- /dev/null +++ b/tests/tests/src/bs_poly_mutable_set_test.mjs @@ -0,0 +1,321 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Belt_MutableSet from "rescript/lib/es6/Belt_MutableSet.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); +} + +let IntCmp = Belt_Id.comparable(Primitive_int.compare); + +function fromArray(none) { + return Belt_MutableSet.fromArray(none, IntCmp); +} + +function empty() { + return Belt_MutableSet.make(IntCmp); +} + +let u = Belt_MutableSet.fromArray(Array_data_util.range(0, 30), IntCmp); + +b("File \"bs_poly_mutable_set_test.res\", line 16, characters 4-11", Belt_MutableSet.removeCheck(u, 0)); + +b("File \"bs_poly_mutable_set_test.res\", line 17, characters 4-11", !Belt_MutableSet.removeCheck(u, 0)); + +b("File \"bs_poly_mutable_set_test.res\", line 18, characters 4-11", Belt_MutableSet.removeCheck(u, 30)); + +b("File \"bs_poly_mutable_set_test.res\", line 19, characters 4-11", Belt_MutableSet.removeCheck(u, 20)); + +eq("File \"bs_poly_mutable_set_test.res\", line 20, characters 5-12", Belt_MutableSet.size(u), 28); + +let r = Array_data_util.randomRange(0, 30); + +b("File \"bs_poly_mutable_set_test.res\", line 22, characters 4-11", 29 === Belt_MutableSet.maxUndefined(u)); + +b("File \"bs_poly_mutable_set_test.res\", line 23, characters 4-11", 1 === Belt_MutableSet.minUndefined(u)); + +Belt_MutableSet.add(u, 3); + +for (let i = 0, i_finish = r.length; i < i_finish; ++i) { + Belt_MutableSet.remove(u, r[i]); +} + +b("File \"bs_poly_mutable_set_test.res\", line 28, characters 4-11", Belt_MutableSet.isEmpty(u)); + +Belt_MutableSet.add(u, 0); + +Belt_MutableSet.add(u, 1); + +Belt_MutableSet.add(u, 2); + +Belt_MutableSet.add(u, 0); + +eq("File \"bs_poly_mutable_set_test.res\", line 33, characters 5-12", Belt_MutableSet.size(u), 3); + +b("File \"bs_poly_mutable_set_test.res\", line 34, characters 4-11", !Belt_MutableSet.isEmpty(u)); + +for (let i$1 = 0; i$1 <= 3; ++i$1) { + Belt_MutableSet.remove(u, i$1); +} + +b("File \"bs_poly_mutable_set_test.res\", line 38, characters 4-11", Belt_MutableSet.isEmpty(u)); + +Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 20000)); + +Belt_MutableSet.mergeMany(u, Array_data_util.randomRange(0, 200)); + +eq("File \"bs_poly_mutable_set_test.res\", line 41, characters 5-12", Belt_MutableSet.size(u), 20001); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 200)); + +eq("File \"bs_poly_mutable_set_test.res\", line 43, characters 5-12", Belt_MutableSet.size(u), 19800); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); + +eq("File \"bs_poly_mutable_set_test.res\", line 45, characters 5-12", Belt_MutableSet.size(u), 19000); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(0, 1000)); + +eq("File \"bs_poly_mutable_set_test.res\", line 47, characters 5-12", Belt_MutableSet.size(u), 19000); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(1000, 10000)); + +eq("File \"bs_poly_mutable_set_test.res\", line 49, characters 5-12", Belt_MutableSet.size(u), 10000); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 19999)); + +eq("File \"bs_poly_mutable_set_test.res\", line 51, characters 5-12", Belt_MutableSet.size(u), 1); + +b("File \"bs_poly_mutable_set_test.res\", line 52, characters 4-11", Belt_MutableSet.has(u, 20000)); + +Belt_MutableSet.removeMany(u, Array_data_util.randomRange(10000, 30000)); + +b("File \"bs_poly_mutable_set_test.res\", line 54, characters 4-11", Belt_MutableSet.isEmpty(u)); + +let v = Belt_MutableSet.fromArray(Array_data_util.randomRange(1000, 2000), IntCmp); + +let bs = Belt_Array.map(Array_data_util.randomRange(500, 1499), x => Belt_MutableSet.removeCheck(v, x)); + +let indeedRemoved = Belt_Array.reduce(bs, 0, (acc, x) => { + if (x) { + return acc + 1 | 0; + } else { + return acc; + } +}); + +eq("File \"bs_poly_mutable_set_test.res\", line 67, characters 5-12", indeedRemoved, 500); + +eq("File \"bs_poly_mutable_set_test.res\", line 68, characters 5-12", Belt_MutableSet.size(v), 501); + +let cs = Belt_Array.map(Array_data_util.randomRange(500, 2000), x => Belt_MutableSet.addCheck(v, x)); + +let indeedAded = Belt_Array.reduce(cs, 0, (acc, x) => { + if (x) { + return acc + 1 | 0; + } else { + return acc; + } +}); + +eq("File \"bs_poly_mutable_set_test.res\", line 77, characters 5-12", indeedAded, 1000); + +eq("File \"bs_poly_mutable_set_test.res\", line 78, characters 5-12", Belt_MutableSet.size(v), 1501); + +b("File \"bs_poly_mutable_set_test.res\", line 79, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.make(IntCmp))); + +eq("File \"bs_poly_mutable_set_test.res\", line 80, characters 5-12", Belt_MutableSet.minimum(v), 500); + +eq("File \"bs_poly_mutable_set_test.res\", line 81, characters 5-12", Belt_MutableSet.maximum(v), 2000); + +eq("File \"bs_poly_mutable_set_test.res\", line 82, characters 5-12", Belt_MutableSet.minUndefined(v), 500); + +eq("File \"bs_poly_mutable_set_test.res\", line 83, characters 5-12", Belt_MutableSet.maxUndefined(v), 2000); + +eq("File \"bs_poly_mutable_set_test.res\", line 84, characters 5-12", Belt_MutableSet.reduce(v, 0, (x, y) => x + y | 0), 1876250); + +b("File \"bs_poly_mutable_set_test.res\", line 85, characters 4-11", Belt_List.eq(Belt_MutableSet.toList(v), Belt_List.makeBy(1501, i => i + 500 | 0), (x, y) => x === y)); + +eq("File \"bs_poly_mutable_set_test.res\", line 86, characters 5-12", Belt_MutableSet.toArray(v), Array_data_util.range(500, 2000)); + +Belt_MutableSet.checkInvariantInternal(v); + +eq("File \"bs_poly_mutable_set_test.res\", line 88, characters 5-12", Belt_MutableSet.get(v, 3), undefined); + +eq("File \"bs_poly_mutable_set_test.res\", line 89, characters 5-12", Belt_MutableSet.get(v, 1200), 1200); + +let match = Belt_MutableSet.split(v, 1000); + +let match$1 = match[0]; + +let bb = match$1[1]; + +let aa = match$1[0]; + +b("File \"bs_poly_mutable_set_test.res\", line 91, characters 4-11", match[1]); + +b("File \"bs_poly_mutable_set_test.res\", line 92, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(aa), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_mutable_set_test.res\", line 93, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(bb), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_mutable_set_test.res\", line 94, characters 4-11", Belt_MutableSet.subset(aa, v)); + +b("File \"bs_poly_mutable_set_test.res\", line 95, characters 4-11", Belt_MutableSet.subset(bb, v)); + +b("File \"bs_poly_mutable_set_test.res\", line 96, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa, bb))); + +let c = Belt_MutableSet.removeCheck(v, 1000); + +b("File \"bs_poly_mutable_set_test.res\", line 98, characters 4-11", c); + +let match$2 = Belt_MutableSet.split(v, 1000); + +let match$3 = match$2[0]; + +let bb$1 = match$3[1]; + +let aa$1 = match$3[0]; + +b("File \"bs_poly_mutable_set_test.res\", line 100, characters 4-11", !match$2[1]); + +b("File \"bs_poly_mutable_set_test.res\", line 101, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(aa$1), Array_data_util.range(500, 999), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_mutable_set_test.res\", line 102, characters 4-11", Belt_Array.eq(Belt_MutableSet.toArray(bb$1), Array_data_util.range(1001, 2000), (prim0, prim1) => prim0 === prim1)); + +b("File \"bs_poly_mutable_set_test.res\", line 103, characters 4-11", Belt_MutableSet.subset(aa$1, v)); + +b("File \"bs_poly_mutable_set_test.res\", line 104, characters 4-11", Belt_MutableSet.subset(bb$1, v)); + +b("File \"bs_poly_mutable_set_test.res\", line 105, characters 4-11", Belt_MutableSet.isEmpty(Belt_MutableSet.intersect(aa$1, bb$1))); + +let aa$2 = Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 100), IntCmp); + +let bb$2 = Belt_MutableSet.fromArray(Array_data_util.randomRange(40, 120), IntCmp); + +let cc = Belt_MutableSet.union(aa$2, bb$2); + +b("File \"bs_poly_mutable_set_test.res\", line 115, characters 4-11", Belt_MutableSet.eq(cc, Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 120), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 118, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.union(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 40), IntCmp))); + +let dd = Belt_MutableSet.intersect(aa$2, bb$2); + +b("File \"bs_poly_mutable_set_test.res\", line 122, characters 4-11", Belt_MutableSet.eq(dd, Belt_MutableSet.fromArray(Array_data_util.randomRange(40, 100), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 124, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.make(IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 128, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp)), Belt_MutableSet.make(IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 131, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.intersect(Belt_MutableSet.fromArray([ + 1, + 3, + 4, + 5, + 7, + 9 +], IntCmp), Belt_MutableSet.fromArray([ + 2, + 4, + 5, + 6, + 8, + 10 +], IntCmp)), Belt_MutableSet.fromArray([ + 4, + 5 +], IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 132, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(aa$2, bb$2), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 39), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 133, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(bb$2, aa$2), Belt_MutableSet.fromArray(Array_data_util.randomRange(101, 120), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 135, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 142, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(21, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp))); + +b("File \"bs_poly_mutable_set_test.res\", line 150, characters 4-11", Belt_MutableSet.eq(Belt_MutableSet.diff(Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 20), IntCmp), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 40), IntCmp)), Belt_MutableSet.fromArray(Array_data_util.randomRange(0, -1), IntCmp))); + +let a0 = Belt_MutableSet.fromArray(Array_data_util.randomRange(0, 1000), IntCmp); + +let a1 = Belt_MutableSet.keep(a0, x => x % 2 === 0); + +let a2 = Belt_MutableSet.keep(a0, x => x % 2 !== 0); + +let match$4 = Belt_MutableSet.partition(a0, x => x % 2 === 0); + +let a4 = match$4[1]; + +let a3 = match$4[0]; + +b("File \"bs_poly_mutable_set_test.res\", line 162, characters 4-11", Belt_MutableSet.eq(a1, a3)); + +b("File \"bs_poly_mutable_set_test.res\", line 163, characters 4-11", Belt_MutableSet.eq(a2, a4)); + +Belt_List.forEach({ + hd: a0, + tl: { + hd: a1, + tl: { + hd: a2, + tl: { + hd: a3, + tl: { + hd: a4, + tl: /* [] */0 + } + } + } + } +}, Belt_MutableSet.checkInvariantInternal); + +Mt.from_pair_suites("Bs_poly_mutable_set_test", suites.contents); + +let N; + +let I; + +let A; + +let L; + +let $plus$plus = Belt_MutableSet.union; + +let f = fromArray; + +let $eq$tilde = Belt_MutableSet.eq; + +export { + suites, + test_id, + eq, + b, + N, + I, + A, + IntCmp, + L, + fromArray, + empty, + $plus$plus, + f, + $eq$tilde, +} +/* IntCmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_set_test.js b/tests/tests/src/bs_poly_set_test.js deleted file mode 100644 index aec7fd3860..0000000000 --- a/tests/tests/src/bs_poly_set_test.js +++ /dev/null @@ -1,372 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Set = require("rescript/lib/js/Belt_Set.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_SetDict = require("rescript/lib/js/Belt_SetDict.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Belt_SortArray = require("rescript/lib/js/Belt_SortArray.js"); -let Array_data_util = require("./array_data_util.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.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 t(loc, x) { - Mt.throw_suites(test_id, suites, loc, x); -} - -let IntCmp = Belt_Id.comparable(Primitive_int.compare); - -let u0 = Belt_Set.fromArray(Array_data_util.range(0, 30), IntCmp); - -let u1 = Belt_Set.remove(u0, 0); - -let u2 = Belt_Set.remove(u1, 0); - -let u3 = Belt_Set.remove(u2, 30); - -let u4 = Belt_Set.remove(u3, 20); - -let r = Array_data_util.randomRange(0, 30); - -let u5 = Belt_Set.add(u4, 3); - -let u6 = Belt_Set.removeMany(u5, r); - -let u7 = Belt_Set.mergeMany(u6, [ - 0, - 1, - 2, - 0 -]); - -let u8 = Belt_Set.removeMany(u7, [ - 0, - 1, - 2, - 3 -]); - -let u9 = Belt_Set.mergeMany(u8, Array_data_util.randomRange(0, 20000)); - -let u10 = Belt_Set.mergeMany(u9, Array_data_util.randomRange(0, 200)); - -let u11 = Belt_Set.removeMany(u10, Array_data_util.randomRange(0, 200)); - -let u12 = Belt_Set.removeMany(u11, Array_data_util.randomRange(0, 1000)); - -let u13 = Belt_Set.removeMany(u12, Array_data_util.randomRange(0, 1000)); - -let u14 = Belt_Set.removeMany(u13, Array_data_util.randomRange(1000, 10000)); - -let u15 = Belt_Set.removeMany(u14, Array_data_util.randomRange(10000, 19999)); - -let u16 = Belt_Set.removeMany(u15, Array_data_util.randomRange(20000, 21000)); - -b("File \"bs_poly_set_test.res\", line 34, characters 4-11", u0 !== u1); - -b("File \"bs_poly_set_test.res\", line 35, characters 4-11", u2 === u1); - -eq("File \"bs_poly_set_test.res\", line 36, characters 5-12", Belt_Set.size(u4), 28); - -b("File \"bs_poly_set_test.res\", line 37, characters 4-11", 29 === Belt_Set.maxUndefined(u4)); - -b("File \"bs_poly_set_test.res\", line 38, characters 4-11", 1 === Belt_Set.minUndefined(u4)); - -b("File \"bs_poly_set_test.res\", line 39, characters 4-11", u4 === u5); - -b("File \"bs_poly_set_test.res\", line 40, characters 4-11", Belt_Set.isEmpty(u6)); - -eq("File \"bs_poly_set_test.res\", line 41, characters 5-12", Belt_Set.size(u7), 3); - -b("File \"bs_poly_set_test.res\", line 42, characters 4-11", !Belt_Set.isEmpty(u7)); - -b("File \"bs_poly_set_test.res\", line 43, characters 4-11", Belt_Set.isEmpty(u8)); - -b("File \"bs_poly_set_test.res\", line 46, characters 4-11", Belt_Set.has(u10, 20)); - -b("File \"bs_poly_set_test.res\", line 47, characters 4-11", Belt_Set.has(u10, 21)); - -eq("File \"bs_poly_set_test.res\", line 48, characters 5-12", Belt_Set.size(u10), 20001); - -eq("File \"bs_poly_set_test.res\", line 49, characters 5-12", Belt_Set.size(u11), 19800); - -eq("File \"bs_poly_set_test.res\", line 50, characters 5-12", Belt_Set.size(u12), 19000); - -eq("File \"bs_poly_set_test.res\", line 52, characters 5-12", Belt_Set.size(u13), Belt_Set.size(u12)); - -eq("File \"bs_poly_set_test.res\", line 53, characters 5-12", Belt_Set.size(u14), 10000); - -eq("File \"bs_poly_set_test.res\", line 54, characters 5-12", Belt_Set.size(u15), 1); - -b("File \"bs_poly_set_test.res\", line 55, characters 4-11", Belt_Set.has(u15, 20000)); - -b("File \"bs_poly_set_test.res\", line 56, characters 4-11", !Belt_Set.has(u15, 2000)); - -b("File \"bs_poly_set_test.res\", line 57, characters 4-11", Belt_Set.isEmpty(u16)); - -let u17 = Belt_Set.fromArray(Array_data_util.randomRange(0, 100), IntCmp); - -let u18 = Belt_Set.fromArray(Array_data_util.randomRange(59, 200), IntCmp); - -let u19 = Belt_Set.union(u17, u18); - -let u20 = Belt_Set.fromArray(Array_data_util.randomRange(0, 200), IntCmp); - -let u21 = Belt_Set.intersect(u17, u18); - -let u22 = Belt_Set.diff(u17, u18); - -let u23 = Belt_Set.diff(u18, u17); - -let u24 = Belt_Set.union(u18, u17); - -let u25 = Belt_Set.add(u22, 59); - -let u26 = Belt_Set.add(Belt_Set.make(IntCmp), 3); - -let ss = Belt_Array.makeByAndShuffle(100, i => (i << 1)); - -let u27 = Belt_Set.fromArray(ss, IntCmp); - -let u28 = Belt_Set.union(u27, u26); - -let u29 = Belt_Set.union(u26, u27); - -b("File \"bs_poly_set_test.res\", line 71, characters 4-11", Belt_Set.eq(u28, u29)); - -b("File \"bs_poly_set_test.res\", line 72, characters 4-11", Primitive_object.equal(Belt_Set.toArray(u29), Belt_SortArray.stableSortBy(Belt_Array.concat(ss, [3]), Primitive_int.compare))); - -b("File \"bs_poly_set_test.res\", line 73, characters 4-11", Belt_Set.eq(u19, u20)); - -eq("File \"bs_poly_set_test.res\", line 74, characters 5-12", Belt_Set.toArray(u21), Array_data_util.range(59, 100)); - -eq("File \"bs_poly_set_test.res\", line 75, characters 5-12", Belt_Set.toArray(u22), Array_data_util.range(0, 58)); - -b("File \"bs_poly_set_test.res\", line 76, characters 4-11", Belt_Set.eq(u24, u19)); - -eq("File \"bs_poly_set_test.res\", line 77, characters 5-12", Belt_Set.toArray(u23), Array_data_util.range(101, 200)); - -b("File \"bs_poly_set_test.res\", line 78, characters 4-11", Belt_Set.subset(u23, u18)); - -b("File \"bs_poly_set_test.res\", line 79, characters 4-11", !Belt_Set.subset(u18, u23)); - -b("File \"bs_poly_set_test.res\", line 80, characters 4-11", Belt_Set.subset(u22, u17)); - -b("File \"bs_poly_set_test.res\", line 81, characters 4-11", Belt_Set.subset(u21, u17) && Belt_Set.subset(u21, u18)); - -b("File \"bs_poly_set_test.res\", line 82, characters 4-11", 47 === Belt_Set.getUndefined(u22, 47)); - -b("File \"bs_poly_set_test.res\", line 83, characters 4-11", Primitive_object.equal(47, Belt_Set.get(u22, 47))); - -b("File \"bs_poly_set_test.res\", line 84, characters 4-11", Belt_Set.getUndefined(u22, 59) === undefined); - -b("File \"bs_poly_set_test.res\", line 85, characters 4-11", undefined === Belt_Set.get(u22, 59)); - -eq("File \"bs_poly_set_test.res\", line 87, characters 5-12", Belt_Set.size(u25), 60); - -b("File \"bs_poly_set_test.res\", line 88, characters 4-11", Belt_Set.minimum(Belt_Set.make(IntCmp)) === undefined); - -b("File \"bs_poly_set_test.res\", line 89, characters 4-11", Belt_Set.maximum(Belt_Set.make(IntCmp)) === undefined); - -b("File \"bs_poly_set_test.res\", line 90, characters 4-11", Belt_Set.minUndefined(Belt_Set.make(IntCmp)) === undefined); - -b("File \"bs_poly_set_test.res\", line 91, characters 4-11", Belt_Set.maxUndefined(Belt_Set.make(IntCmp)) === undefined); - -function testIterToList(xs) { - let v = { - contents: /* [] */0 - }; - Belt_Set.forEach(xs, x => { - v.contents = { - hd: x, - tl: v.contents - }; - }); - return Belt_List.reverse(v.contents); -} - -function testIterToList2(xs) { - let v = { - contents: /* [] */0 - }; - Belt_SetDict.forEach(Belt_Set.getData(xs), x => { - v.contents = { - hd: x, - tl: v.contents - }; - }); - return Belt_List.reverse(v.contents); -} - -let u0$1 = Belt_Set.fromArray(Array_data_util.randomRange(0, 20), IntCmp); - -let u1$1 = Belt_Set.remove(u0$1, 17); - -let u2$1 = Belt_Set.add(u1$1, 33); - -b("File \"bs_poly_set_test.res\", line 110, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_List.makeBy(21, i => i), (x, y) => x === y)); - -b("File \"bs_poly_set_test.res\", line 111, characters 4-11", Belt_List.every2(testIterToList2(u0$1), Belt_List.makeBy(21, i => i), (x, y) => x === y)); - -b("File \"bs_poly_set_test.res\", line 112, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_Set.toList(u0$1), (x, y) => x === y)); - -b("File \"bs_poly_set_test.res\", line 113, characters 4-11", Belt_Set.some(u0$1, x => x === 17)); - -b("File \"bs_poly_set_test.res\", line 114, characters 4-11", !Belt_Set.some(u1$1, x => x === 17)); - -b("File \"bs_poly_set_test.res\", line 115, characters 4-11", Belt_Set.every(u0$1, x => x < 24)); - -b("File \"bs_poly_set_test.res\", line 116, characters 4-11", Belt_SetDict.every(Belt_Set.getData(u0$1), x => x < 24)); - -b("File \"bs_poly_set_test.res\", line 117, characters 4-11", !Belt_Set.every(u2$1, x => x < 24)); - -b("File \"bs_poly_set_test.res\", line 118, characters 4-11", !Belt_Set.every(Belt_Set.fromArray([ - 1, - 2, - 3 -], IntCmp), x => x === 2)); - -b("File \"bs_poly_set_test.res\", line 119, characters 4-11", Belt_Set.cmp(u1$1, u0$1) < 0); - -b("File \"bs_poly_set_test.res\", line 120, characters 4-11", Belt_Set.cmp(u0$1, u1$1) > 0); - -let a0 = Belt_Set.fromArray(Array_data_util.randomRange(0, 1000), IntCmp); - -let a1 = Belt_Set.keep(a0, x => x % 2 === 0); - -let a2 = Belt_Set.keep(a0, x => x % 2 !== 0); - -let match = Belt_Set.partition(a0, x => x % 2 === 0); - -let a4 = match[1]; - -let a3 = match[0]; - -b("File \"bs_poly_set_test.res\", line 127, characters 4-11", Belt_Set.eq(a1, a3)); - -b("File \"bs_poly_set_test.res\", line 128, characters 4-11", Belt_Set.eq(a2, a4)); - -eq("File \"bs_poly_set_test.res\", line 129, characters 5-12", Belt_Set.getExn(a0, 3), 3); - -eq("File \"bs_poly_set_test.res\", line 130, characters 5-12", Belt_Set.getExn(a0, 4), 4); - -t("File \"bs_poly_set_test.res\", line 131, characters 4-11", () => { - Belt_Set.getExn(a0, 1002); -}); - -t("File \"bs_poly_set_test.res\", line 132, characters 4-11", () => { - Belt_Set.getExn(a0, -1); -}); - -eq("File \"bs_poly_set_test.res\", line 133, characters 5-12", Belt_Set.size(a0), 1001); - -b("File \"bs_poly_set_test.res\", line 134, characters 4-11", !Belt_Set.isEmpty(a0)); - -let match$1 = Belt_Set.split(a0, 200); - -let match$2 = match$1[0]; - -b("File \"bs_poly_set_test.res\", line 136, characters 4-11", match$1[1]); - -eq("File \"bs_poly_set_test.res\", line 137, characters 5-12", Belt_Set.toArray(match$2[0]), Belt_Array.makeBy(200, i => i)); - -eq("File \"bs_poly_set_test.res\", line 138, characters 5-12", Belt_Set.toList(match$2[1]), Belt_List.makeBy(800, i => i + 201 | 0)); - -let a7 = Belt_Set.remove(a0, 200); - -let match$3 = Belt_Set.split(a7, 200); - -let match$4 = match$3[0]; - -let a9 = match$4[1]; - -let a8 = match$4[0]; - -b("File \"bs_poly_set_test.res\", line 141, characters 4-11", !match$3[1]); - -eq("File \"bs_poly_set_test.res\", line 142, characters 5-12", Belt_Set.toArray(a8), Belt_Array.makeBy(200, i => i)); - -eq("File \"bs_poly_set_test.res\", line 143, characters 5-12", Belt_Set.toList(a9), Belt_List.makeBy(800, i => i + 201 | 0)); - -eq("File \"bs_poly_set_test.res\", line 144, characters 5-12", Belt_Set.minimum(a8), 0); - -eq("File \"bs_poly_set_test.res\", line 145, characters 5-12", Belt_Set.minimum(a9), 201); - -Belt_List.forEach({ - hd: a0, - tl: { - hd: a1, - tl: { - hd: a2, - tl: { - hd: a3, - tl: { - hd: a4, - tl: /* [] */0 - } - } - } - } -}, Belt_Set.checkInvariantInternal); - -let a = Belt_Set.fromArray([], IntCmp); - -b("File \"bs_poly_set_test.res\", line 151, characters 4-11", Belt_Set.isEmpty(Belt_Set.keep(a, x => x % 2 === 0))); - -let match$5 = Belt_Set.split(Belt_Set.make(IntCmp), 0); - -let match$6 = match$5[0]; - -b("File \"bs_poly_set_test.res\", line 156, characters 4-11", Belt_Set.isEmpty(match$6[0])); - -b("File \"bs_poly_set_test.res\", line 157, characters 4-11", Belt_Set.isEmpty(match$6[1])); - -b("File \"bs_poly_set_test.res\", line 158, characters 4-11", !match$5[1]); - -Mt.from_pair_suites("Bs_poly_set_test", suites.contents); - -let N; - -let D; - -let I; - -let A; - -let S; - -let L; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.t = t; -exports.N = N; -exports.D = D; -exports.I = I; -exports.A = A; -exports.S = S; -exports.IntCmp = IntCmp; -exports.L = L; -exports.testIterToList = testIterToList; -exports.testIterToList2 = testIterToList2; -/* IntCmp Not a pure module */ diff --git a/tests/tests/src/bs_poly_set_test.mjs b/tests/tests/src/bs_poly_set_test.mjs new file mode 100644 index 0000000000..8812401be4 --- /dev/null +++ b/tests/tests/src/bs_poly_set_test.mjs @@ -0,0 +1,373 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Set from "rescript/lib/es6/Belt_Set.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_SetDict from "rescript/lib/es6/Belt_SetDict.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Belt_SortArray from "rescript/lib/es6/Belt_SortArray.js"; +import * as Array_data_util from "./array_data_util.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.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 t(loc, x) { + Mt.throw_suites(test_id, suites, loc, x); +} + +let IntCmp = Belt_Id.comparable(Primitive_int.compare); + +let u0 = Belt_Set.fromArray(Array_data_util.range(0, 30), IntCmp); + +let u1 = Belt_Set.remove(u0, 0); + +let u2 = Belt_Set.remove(u1, 0); + +let u3 = Belt_Set.remove(u2, 30); + +let u4 = Belt_Set.remove(u3, 20); + +let r = Array_data_util.randomRange(0, 30); + +let u5 = Belt_Set.add(u4, 3); + +let u6 = Belt_Set.removeMany(u5, r); + +let u7 = Belt_Set.mergeMany(u6, [ + 0, + 1, + 2, + 0 +]); + +let u8 = Belt_Set.removeMany(u7, [ + 0, + 1, + 2, + 3 +]); + +let u9 = Belt_Set.mergeMany(u8, Array_data_util.randomRange(0, 20000)); + +let u10 = Belt_Set.mergeMany(u9, Array_data_util.randomRange(0, 200)); + +let u11 = Belt_Set.removeMany(u10, Array_data_util.randomRange(0, 200)); + +let u12 = Belt_Set.removeMany(u11, Array_data_util.randomRange(0, 1000)); + +let u13 = Belt_Set.removeMany(u12, Array_data_util.randomRange(0, 1000)); + +let u14 = Belt_Set.removeMany(u13, Array_data_util.randomRange(1000, 10000)); + +let u15 = Belt_Set.removeMany(u14, Array_data_util.randomRange(10000, 19999)); + +let u16 = Belt_Set.removeMany(u15, Array_data_util.randomRange(20000, 21000)); + +b("File \"bs_poly_set_test.res\", line 34, characters 4-11", u0 !== u1); + +b("File \"bs_poly_set_test.res\", line 35, characters 4-11", u2 === u1); + +eq("File \"bs_poly_set_test.res\", line 36, characters 5-12", Belt_Set.size(u4), 28); + +b("File \"bs_poly_set_test.res\", line 37, characters 4-11", 29 === Belt_Set.maxUndefined(u4)); + +b("File \"bs_poly_set_test.res\", line 38, characters 4-11", 1 === Belt_Set.minUndefined(u4)); + +b("File \"bs_poly_set_test.res\", line 39, characters 4-11", u4 === u5); + +b("File \"bs_poly_set_test.res\", line 40, characters 4-11", Belt_Set.isEmpty(u6)); + +eq("File \"bs_poly_set_test.res\", line 41, characters 5-12", Belt_Set.size(u7), 3); + +b("File \"bs_poly_set_test.res\", line 42, characters 4-11", !Belt_Set.isEmpty(u7)); + +b("File \"bs_poly_set_test.res\", line 43, characters 4-11", Belt_Set.isEmpty(u8)); + +b("File \"bs_poly_set_test.res\", line 46, characters 4-11", Belt_Set.has(u10, 20)); + +b("File \"bs_poly_set_test.res\", line 47, characters 4-11", Belt_Set.has(u10, 21)); + +eq("File \"bs_poly_set_test.res\", line 48, characters 5-12", Belt_Set.size(u10), 20001); + +eq("File \"bs_poly_set_test.res\", line 49, characters 5-12", Belt_Set.size(u11), 19800); + +eq("File \"bs_poly_set_test.res\", line 50, characters 5-12", Belt_Set.size(u12), 19000); + +eq("File \"bs_poly_set_test.res\", line 52, characters 5-12", Belt_Set.size(u13), Belt_Set.size(u12)); + +eq("File \"bs_poly_set_test.res\", line 53, characters 5-12", Belt_Set.size(u14), 10000); + +eq("File \"bs_poly_set_test.res\", line 54, characters 5-12", Belt_Set.size(u15), 1); + +b("File \"bs_poly_set_test.res\", line 55, characters 4-11", Belt_Set.has(u15, 20000)); + +b("File \"bs_poly_set_test.res\", line 56, characters 4-11", !Belt_Set.has(u15, 2000)); + +b("File \"bs_poly_set_test.res\", line 57, characters 4-11", Belt_Set.isEmpty(u16)); + +let u17 = Belt_Set.fromArray(Array_data_util.randomRange(0, 100), IntCmp); + +let u18 = Belt_Set.fromArray(Array_data_util.randomRange(59, 200), IntCmp); + +let u19 = Belt_Set.union(u17, u18); + +let u20 = Belt_Set.fromArray(Array_data_util.randomRange(0, 200), IntCmp); + +let u21 = Belt_Set.intersect(u17, u18); + +let u22 = Belt_Set.diff(u17, u18); + +let u23 = Belt_Set.diff(u18, u17); + +let u24 = Belt_Set.union(u18, u17); + +let u25 = Belt_Set.add(u22, 59); + +let u26 = Belt_Set.add(Belt_Set.make(IntCmp), 3); + +let ss = Belt_Array.makeByAndShuffle(100, i => (i << 1)); + +let u27 = Belt_Set.fromArray(ss, IntCmp); + +let u28 = Belt_Set.union(u27, u26); + +let u29 = Belt_Set.union(u26, u27); + +b("File \"bs_poly_set_test.res\", line 71, characters 4-11", Belt_Set.eq(u28, u29)); + +b("File \"bs_poly_set_test.res\", line 72, characters 4-11", Primitive_object.equal(Belt_Set.toArray(u29), Belt_SortArray.stableSortBy(Belt_Array.concat(ss, [3]), Primitive_int.compare))); + +b("File \"bs_poly_set_test.res\", line 73, characters 4-11", Belt_Set.eq(u19, u20)); + +eq("File \"bs_poly_set_test.res\", line 74, characters 5-12", Belt_Set.toArray(u21), Array_data_util.range(59, 100)); + +eq("File \"bs_poly_set_test.res\", line 75, characters 5-12", Belt_Set.toArray(u22), Array_data_util.range(0, 58)); + +b("File \"bs_poly_set_test.res\", line 76, characters 4-11", Belt_Set.eq(u24, u19)); + +eq("File \"bs_poly_set_test.res\", line 77, characters 5-12", Belt_Set.toArray(u23), Array_data_util.range(101, 200)); + +b("File \"bs_poly_set_test.res\", line 78, characters 4-11", Belt_Set.subset(u23, u18)); + +b("File \"bs_poly_set_test.res\", line 79, characters 4-11", !Belt_Set.subset(u18, u23)); + +b("File \"bs_poly_set_test.res\", line 80, characters 4-11", Belt_Set.subset(u22, u17)); + +b("File \"bs_poly_set_test.res\", line 81, characters 4-11", Belt_Set.subset(u21, u17) && Belt_Set.subset(u21, u18)); + +b("File \"bs_poly_set_test.res\", line 82, characters 4-11", 47 === Belt_Set.getUndefined(u22, 47)); + +b("File \"bs_poly_set_test.res\", line 83, characters 4-11", Primitive_object.equal(47, Belt_Set.get(u22, 47))); + +b("File \"bs_poly_set_test.res\", line 84, characters 4-11", Belt_Set.getUndefined(u22, 59) === undefined); + +b("File \"bs_poly_set_test.res\", line 85, characters 4-11", undefined === Belt_Set.get(u22, 59)); + +eq("File \"bs_poly_set_test.res\", line 87, characters 5-12", Belt_Set.size(u25), 60); + +b("File \"bs_poly_set_test.res\", line 88, characters 4-11", Belt_Set.minimum(Belt_Set.make(IntCmp)) === undefined); + +b("File \"bs_poly_set_test.res\", line 89, characters 4-11", Belt_Set.maximum(Belt_Set.make(IntCmp)) === undefined); + +b("File \"bs_poly_set_test.res\", line 90, characters 4-11", Belt_Set.minUndefined(Belt_Set.make(IntCmp)) === undefined); + +b("File \"bs_poly_set_test.res\", line 91, characters 4-11", Belt_Set.maxUndefined(Belt_Set.make(IntCmp)) === undefined); + +function testIterToList(xs) { + let v = { + contents: /* [] */0 + }; + Belt_Set.forEach(xs, x => { + v.contents = { + hd: x, + tl: v.contents + }; + }); + return Belt_List.reverse(v.contents); +} + +function testIterToList2(xs) { + let v = { + contents: /* [] */0 + }; + Belt_SetDict.forEach(Belt_Set.getData(xs), x => { + v.contents = { + hd: x, + tl: v.contents + }; + }); + return Belt_List.reverse(v.contents); +} + +let u0$1 = Belt_Set.fromArray(Array_data_util.randomRange(0, 20), IntCmp); + +let u1$1 = Belt_Set.remove(u0$1, 17); + +let u2$1 = Belt_Set.add(u1$1, 33); + +b("File \"bs_poly_set_test.res\", line 110, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_List.makeBy(21, i => i), (x, y) => x === y)); + +b("File \"bs_poly_set_test.res\", line 111, characters 4-11", Belt_List.every2(testIterToList2(u0$1), Belt_List.makeBy(21, i => i), (x, y) => x === y)); + +b("File \"bs_poly_set_test.res\", line 112, characters 4-11", Belt_List.every2(testIterToList(u0$1), Belt_Set.toList(u0$1), (x, y) => x === y)); + +b("File \"bs_poly_set_test.res\", line 113, characters 4-11", Belt_Set.some(u0$1, x => x === 17)); + +b("File \"bs_poly_set_test.res\", line 114, characters 4-11", !Belt_Set.some(u1$1, x => x === 17)); + +b("File \"bs_poly_set_test.res\", line 115, characters 4-11", Belt_Set.every(u0$1, x => x < 24)); + +b("File \"bs_poly_set_test.res\", line 116, characters 4-11", Belt_SetDict.every(Belt_Set.getData(u0$1), x => x < 24)); + +b("File \"bs_poly_set_test.res\", line 117, characters 4-11", !Belt_Set.every(u2$1, x => x < 24)); + +b("File \"bs_poly_set_test.res\", line 118, characters 4-11", !Belt_Set.every(Belt_Set.fromArray([ + 1, + 2, + 3 +], IntCmp), x => x === 2)); + +b("File \"bs_poly_set_test.res\", line 119, characters 4-11", Belt_Set.cmp(u1$1, u0$1) < 0); + +b("File \"bs_poly_set_test.res\", line 120, characters 4-11", Belt_Set.cmp(u0$1, u1$1) > 0); + +let a0 = Belt_Set.fromArray(Array_data_util.randomRange(0, 1000), IntCmp); + +let a1 = Belt_Set.keep(a0, x => x % 2 === 0); + +let a2 = Belt_Set.keep(a0, x => x % 2 !== 0); + +let match = Belt_Set.partition(a0, x => x % 2 === 0); + +let a4 = match[1]; + +let a3 = match[0]; + +b("File \"bs_poly_set_test.res\", line 127, characters 4-11", Belt_Set.eq(a1, a3)); + +b("File \"bs_poly_set_test.res\", line 128, characters 4-11", Belt_Set.eq(a2, a4)); + +eq("File \"bs_poly_set_test.res\", line 129, characters 5-12", Belt_Set.getExn(a0, 3), 3); + +eq("File \"bs_poly_set_test.res\", line 130, characters 5-12", Belt_Set.getExn(a0, 4), 4); + +t("File \"bs_poly_set_test.res\", line 131, characters 4-11", () => { + Belt_Set.getExn(a0, 1002); +}); + +t("File \"bs_poly_set_test.res\", line 132, characters 4-11", () => { + Belt_Set.getExn(a0, -1); +}); + +eq("File \"bs_poly_set_test.res\", line 133, characters 5-12", Belt_Set.size(a0), 1001); + +b("File \"bs_poly_set_test.res\", line 134, characters 4-11", !Belt_Set.isEmpty(a0)); + +let match$1 = Belt_Set.split(a0, 200); + +let match$2 = match$1[0]; + +b("File \"bs_poly_set_test.res\", line 136, characters 4-11", match$1[1]); + +eq("File \"bs_poly_set_test.res\", line 137, characters 5-12", Belt_Set.toArray(match$2[0]), Belt_Array.makeBy(200, i => i)); + +eq("File \"bs_poly_set_test.res\", line 138, characters 5-12", Belt_Set.toList(match$2[1]), Belt_List.makeBy(800, i => i + 201 | 0)); + +let a7 = Belt_Set.remove(a0, 200); + +let match$3 = Belt_Set.split(a7, 200); + +let match$4 = match$3[0]; + +let a9 = match$4[1]; + +let a8 = match$4[0]; + +b("File \"bs_poly_set_test.res\", line 141, characters 4-11", !match$3[1]); + +eq("File \"bs_poly_set_test.res\", line 142, characters 5-12", Belt_Set.toArray(a8), Belt_Array.makeBy(200, i => i)); + +eq("File \"bs_poly_set_test.res\", line 143, characters 5-12", Belt_Set.toList(a9), Belt_List.makeBy(800, i => i + 201 | 0)); + +eq("File \"bs_poly_set_test.res\", line 144, characters 5-12", Belt_Set.minimum(a8), 0); + +eq("File \"bs_poly_set_test.res\", line 145, characters 5-12", Belt_Set.minimum(a9), 201); + +Belt_List.forEach({ + hd: a0, + tl: { + hd: a1, + tl: { + hd: a2, + tl: { + hd: a3, + tl: { + hd: a4, + tl: /* [] */0 + } + } + } + } +}, Belt_Set.checkInvariantInternal); + +let a = Belt_Set.fromArray([], IntCmp); + +b("File \"bs_poly_set_test.res\", line 151, characters 4-11", Belt_Set.isEmpty(Belt_Set.keep(a, x => x % 2 === 0))); + +let match$5 = Belt_Set.split(Belt_Set.make(IntCmp), 0); + +let match$6 = match$5[0]; + +b("File \"bs_poly_set_test.res\", line 156, characters 4-11", Belt_Set.isEmpty(match$6[0])); + +b("File \"bs_poly_set_test.res\", line 157, characters 4-11", Belt_Set.isEmpty(match$6[1])); + +b("File \"bs_poly_set_test.res\", line 158, characters 4-11", !match$5[1]); + +Mt.from_pair_suites("Bs_poly_set_test", suites.contents); + +let N; + +let D; + +let I; + +let A; + +let S; + +let L; + +export { + suites, + test_id, + eq, + b, + t, + N, + D, + I, + A, + S, + IntCmp, + L, + testIterToList, + testIterToList2, +} +/* IntCmp Not a pure module */ diff --git a/tests/tests/src/bs_qualified.js b/tests/tests/src/bs_qualified.js deleted file mode 100644 index 96ae426c27..0000000000 --- a/tests/tests/src/bs_qualified.js +++ /dev/null @@ -1,53 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let ZZ = require("X"); -let Z = require("z"); -let Vscode = require("vscode"); -let GlMatrix = require("gl-matrix"); - -function f(a, b, c) { - Vscode.commands.executeCommands("hi", a, b, c); - return process.env; -} - -function f2() { - return [ - Z.a0.a1.a2.hi, - a0.a1.a2.ho, - Math.imul(1, 2) - ]; -} - -function f3(x) { - new (global.Buffer)(20); - new (global.a0.a1.a2.Buffer)(20); - new (ZZ.global.a0.a1.a2.Buffer)(100); - new (ZZ.global.a0.a1.a2.makeBuffer3)(20); - console.log(Math.max(1.0, 2.0)); - console.log(x.a0[0]); - console.log(x.a0.a1[0]); - console.log(x.a0.a1.a2[0]); - x.a0[0] = "x"; - x.a0.a1[0] = "x"; - x.a0.a1.a2[0] = "x"; - console.log(x.a0.getX1); - console.log(x.a0.a1.getX2); - console.log(x.a0.a1.a2.getX3); - x.a0.setX1 = 0; - x.a0.a1.setX2 = 0; - x.a0.a1.a2.setX3 = 0; - x["a0-hi"].a1.a2.setXWeird3 = 0; - x.a0.send1(0); - x.a0.a1.send2(0); - x.a0.a1.send3(0); - x.a0.psend1(0); - x.a0.a1.psend2(0); - x.a0.a1.psend3(0); - return GlMatrix.mat4.create(); -} - -exports.f = f; -exports.f2 = f2; -exports.f3 = f3; -/* X Not a pure module */ diff --git a/tests/tests/src/bs_qualified.mjs b/tests/tests/src/bs_qualified.mjs new file mode 100644 index 0000000000..6b4e0bb108 --- /dev/null +++ b/tests/tests/src/bs_qualified.mjs @@ -0,0 +1,54 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as ZZ from "X"; +import * as Z from "z"; +import * as Vscode from "vscode"; +import * as GlMatrix from "gl-matrix"; + +function f(a, b, c) { + Vscode.commands.executeCommands("hi", a, b, c); + return process.env; +} + +function f2() { + return [ + Z.a0.a1.a2.hi, + a0.a1.a2.ho, + Math.imul(1, 2) + ]; +} + +function f3(x) { + new (global.Buffer)(20); + new (global.a0.a1.a2.Buffer)(20); + new (ZZ.global.a0.a1.a2.Buffer)(100); + new (ZZ.global.a0.a1.a2.makeBuffer3)(20); + console.log(Math.max(1.0, 2.0)); + console.log(x.a0[0]); + console.log(x.a0.a1[0]); + console.log(x.a0.a1.a2[0]); + x.a0[0] = "x"; + x.a0.a1[0] = "x"; + x.a0.a1.a2[0] = "x"; + console.log(x.a0.getX1); + console.log(x.a0.a1.getX2); + console.log(x.a0.a1.a2.getX3); + x.a0.setX1 = 0; + x.a0.a1.setX2 = 0; + x.a0.a1.a2.setX3 = 0; + x["a0-hi"].a1.a2.setXWeird3 = 0; + x.a0.send1(0); + x.a0.a1.send2(0); + x.a0.a1.send3(0); + x.a0.psend1(0); + x.a0.a1.psend2(0); + x.a0.a1.psend3(0); + return GlMatrix.mat4.create(); +} + +export { + f, + f2, + f3, +} +/* X Not a pure module */ diff --git a/tests/tests/src/bs_queue_test.js b/tests/tests/src/bs_queue_test.js deleted file mode 100644 index 7ba9420106..0000000000 --- a/tests/tests/src/bs_queue_test.js +++ /dev/null @@ -1,1216 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); -let Belt_MutableQueue = require("rescript/lib/js/Belt_MutableQueue.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 does_raise(f, q) { - try { - f(q); - return false; - } catch (exn) { - return true; - } -} - -function $plus$plus(q, x) { - Belt_MutableQueue.add(q, x); - return q; -} - -let q = Belt_MutableQueue.make(); - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), []) && Belt_MutableQueue.size(q) === 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 25, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)), [1]) && Belt_MutableQueue.size(q) === 1)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 26, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)), [ - 1, - 2 - ]) && Belt_MutableQueue.size(q) === 2)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 27, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)), [ - 1, - 2, - 3 - ]) && Belt_MutableQueue.size(q) === 3)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 28, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)), [ - 1, - 2, - 3, - 4 - ]) && Belt_MutableQueue.size(q) === 4)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 29, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 30, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [ - 2, - 3, - 4 - ]) && Belt_MutableQueue.size(q) === 3)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 31, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q) !== 2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 32, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [ - 3, - 4 - ]) && Belt_MutableQueue.size(q) === 2)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 33, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q) !== 3) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 34, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [4]) && Belt_MutableQueue.size(q) === 1)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 35, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 36, - 2 - ], - Error: new Error() - }; -} - -if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), []) && Belt_MutableQueue.size(q) === 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 37, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.popExn, q)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 38, - 2 - ], - Error: new Error() - }; -} - -let q$1 = Belt_MutableQueue.make(); - -if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 1), q$1)) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 43, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.popExn, q$1)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 44, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 2), q$1)) !== 2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 45, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.popExn, q$1)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 46, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q$1) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 47, - 2 - ], - Error: new Error() - }; -} - -let q$2 = Belt_MutableQueue.make(); - -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 52, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 53, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 3), q$2)) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 54, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.peekExn(q$2) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 55, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q$2) !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 56, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.peekExn(q$2) !== 2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 57, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q$2) !== 2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 58, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.peekExn(q$2) !== 3) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 59, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.popExn(q$2) !== 3) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 60, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 61, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 62, - 2 - ], - Error: new Error() - }; -} - -let q$3 = Belt_MutableQueue.make(); - -for (let i = 1; i <= 10; ++i) { - Belt_MutableQueue.add(q$3, i); -} - -Belt_MutableQueue.clear(q$3); - -if (Belt_MutableQueue.size(q$3) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 71, - 2 - ], - Error: new Error() - }; -} - -if (!does_raise(Belt_MutableQueue.popExn, q$3)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 72, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(q$3, Belt_MutableQueue.make())) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 73, - 2 - ], - Error: new Error() - }; -} - -Belt_MutableQueue.add(q$3, 42); - -if (Belt_MutableQueue.popExn(q$3) !== 42) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 75, - 2 - ], - Error: new Error() - }; -} - -let q1 = Belt_MutableQueue.make(); - -for (let i$1 = 1; i$1 <= 10; ++i$1) { - Belt_MutableQueue.add(q1, i$1); -} - -let q2 = Belt_MutableQueue.copy(q1); - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1), [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 84, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2), [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 85, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q1) !== 10) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 86, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2) !== 10) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 87, - 2 - ], - Error: new Error() - }; -} - -for (let i$2 = 1; i$2 <= 10; ++i$2) { - if (Belt_MutableQueue.popExn(q1) !== i$2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 89, - 4 - ], - Error: new Error() - }; - } - -} - -for (let i$3 = 1; i$3 <= 10; ++i$3) { - if (Belt_MutableQueue.popExn(q2) !== i$3) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 92, - 4 - ], - Error: new Error() - }; - } - -} - -let q$4 = Belt_MutableQueue.make(); - -if (!Belt_MutableQueue.isEmpty(q$4)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 98, - 2 - ], - Error: new Error() - }; -} - -for (let i$4 = 1; i$4 <= 10; ++i$4) { - Belt_MutableQueue.add(q$4, i$4); - if (Belt_MutableQueue.size(q$4) !== i$4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 101, - 4 - ], - Error: new Error() - }; - } - if (Belt_MutableQueue.isEmpty(q$4)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 102, - 4 - ], - Error: new Error() - }; - } - -} - -for (let i$5 = 10; i$5 >= 1; --i$5) { - if (Belt_MutableQueue.size(q$4) !== i$5) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 105, - 4 - ], - Error: new Error() - }; - } - if (Belt_MutableQueue.isEmpty(q$4)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 106, - 4 - ], - Error: new Error() - }; - } - Belt_MutableQueue.popExn(q$4); -} - -if (Belt_MutableQueue.size(q$4) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 109, - 2 - ], - Error: new Error() - }; -} - -if (!Belt_MutableQueue.isEmpty(q$4)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 110, - 2 - ], - Error: new Error() - }; -} - -let q$5 = Belt_MutableQueue.make(); - -for (let i$6 = 1; i$6 <= 10; ++i$6) { - Belt_MutableQueue.add(q$5, i$6); -} - -let i$7 = { - contents: 1 -}; - -Belt_MutableQueue.forEach(q$5, j => { - if (i$7.contents !== j) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 120, - 4 - ], - Error: new Error() - }; - } - i$7.contents = i$7.contents + 1 | 0; -}); - -let q1$1 = Belt_MutableQueue.make(); - -let q2$1 = Belt_MutableQueue.make(); - -if (Belt_MutableQueue.size(q1$1) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 127, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$1), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 128, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$1) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 129, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$1), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 130, - 2 - ], - Error: new Error() - }; -} - -Belt_MutableQueue.transfer(q1$1, q2$1); - -if (Belt_MutableQueue.size(q1$1) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 132, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$1), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 133, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$1) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 134, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$1), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 135, - 2 - ], - Error: new Error() - }; -} - -let q1$2 = Belt_MutableQueue.make(); - -let q2$2 = Belt_MutableQueue.make(); - -for (let i$8 = 1; i$8 <= 4; ++i$8) { - Belt_MutableQueue.add(q1$2, i$8); -} - -if (Belt_MutableQueue.size(q1$2) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 143, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$2), [ - 1, - 2, - 3, - 4 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 144, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$2) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 145, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$2), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 146, - 2 - ], - Error: new Error() - }; -} - -Belt_MutableQueue.transfer(q1$2, q2$2); - -if (Belt_MutableQueue.size(q1$2) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 148, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$2), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 149, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$2) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 150, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$2), [ - 1, - 2, - 3, - 4 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 151, - 2 - ], - Error: new Error() - }; -} - -let q1$3 = Belt_MutableQueue.make(); - -let q2$3 = Belt_MutableQueue.make(); - -for (let i$9 = 5; i$9 <= 8; ++i$9) { - Belt_MutableQueue.add(q2$3, i$9); -} - -if (Belt_MutableQueue.size(q1$3) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 159, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$3), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 160, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$3) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 161, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$3), [ - 5, - 6, - 7, - 8 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 162, - 2 - ], - Error: new Error() - }; -} - -Belt_MutableQueue.transfer(q1$3, q2$3); - -if (Belt_MutableQueue.size(q1$3) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 164, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$3), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 165, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$3) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 166, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$3), [ - 5, - 6, - 7, - 8 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 167, - 2 - ], - Error: new Error() - }; -} - -let q1$4 = Belt_MutableQueue.make(); - -let q2$4 = Belt_MutableQueue.make(); - -for (let i$10 = 1; i$10 <= 4; ++i$10) { - Belt_MutableQueue.add(q1$4, i$10); -} - -for (let i$11 = 5; i$11 <= 8; ++i$11) { - Belt_MutableQueue.add(q2$4, i$11); -} - -if (Belt_MutableQueue.size(q1$4) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 178, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$4), [ - 1, - 2, - 3, - 4 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 179, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.size(q2$4) !== 4) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 180, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$4), [ - 5, - 6, - 7, - 8 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 181, - 2 - ], - Error: new Error() - }; -} - -Belt_MutableQueue.transfer(q1$4, q2$4); - -if (Belt_MutableQueue.size(q1$4) !== 0) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 183, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$4), [])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 184, - 2 - ], - Error: new Error() - }; -} - -let v = [ - 5, - 6, - 7, - 8, - 1, - 2, - 3, - 4 -]; - -if (Belt_MutableQueue.size(q2$4) !== 8) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 186, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$4), v)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 187, - 2 - ], - Error: new Error() - }; -} - -if (Belt_MutableQueue.reduce(q2$4, 0, (x, y) => x - y | 0) !== Belt_Array.reduce(v, 0, (x, y) => x - y | 0)) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "bs_queue_test.res", - 189, - 2 - ], - Error: new Error() - }; -} - -console.log("OK"); - -let q$6 = Belt_MutableQueue.fromArray([ - 1, - 2, - 3, - 4 -]); - -let q1$5 = Belt_MutableQueue.map(q$6, x => x - 1 | 0); - -eq("File \"bs_queue_test.res\", line 197, characters 5-12", Belt_MutableQueue.toArray(q1$5), [ - 0, - 1, - 2, - 3 -]); - -b("File \"bs_queue_test.res\", line 198, characters 4-11", Belt_MutableQueue.isEmpty(Belt_MutableQueue.fromArray([]))); - -b("File \"bs_queue_test.res\", line 199, characters 4-11", Belt_MutableQueue.isEmpty(Belt_MutableQueue.map(Belt_MutableQueue.fromArray([]), x => x + 1 | 0))); - -Mt.from_pair_suites("Bs_queue_test", suites.contents); - -let Q; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.Q = Q; -exports.does_raise = does_raise; -exports.$plus$plus = $plus$plus; -/* q Not a pure module */ diff --git a/tests/tests/src/bs_queue_test.mjs b/tests/tests/src/bs_queue_test.mjs new file mode 100644 index 0000000000..299089540f --- /dev/null +++ b/tests/tests/src/bs_queue_test.mjs @@ -0,0 +1,1217 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; +import * as Belt_MutableQueue from "rescript/lib/es6/Belt_MutableQueue.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 does_raise(f, q) { + try { + f(q); + return false; + } catch (exn) { + return true; + } +} + +function $plus$plus(q, x) { + Belt_MutableQueue.add(q, x); + return q; +} + +let q = Belt_MutableQueue.make(); + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), []) && Belt_MutableQueue.size(q) === 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 25, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 1), q)), [1]) && Belt_MutableQueue.size(q) === 1)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 26, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 2), q)), [ + 1, + 2 + ]) && Belt_MutableQueue.size(q) === 2)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 27, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 3), q)), [ + 1, + 2, + 3 + ]) && Belt_MutableQueue.size(q) === 3)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 28, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray((Belt_MutableQueue.add(q, 4), q)), [ + 1, + 2, + 3, + 4 + ]) && Belt_MutableQueue.size(q) === 4)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 29, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 30, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [ + 2, + 3, + 4 + ]) && Belt_MutableQueue.size(q) === 3)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 31, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q) !== 2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 32, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [ + 3, + 4 + ]) && Belt_MutableQueue.size(q) === 2)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 33, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q) !== 3) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 34, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), [4]) && Belt_MutableQueue.size(q) === 1)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 35, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 36, + 2 + ], + Error: new Error() + }; +} + +if (!(Primitive_object.equal(Belt_MutableQueue.toArray(q), []) && Belt_MutableQueue.size(q) === 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 37, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.popExn, q)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 38, + 2 + ], + Error: new Error() + }; +} + +let q$1 = Belt_MutableQueue.make(); + +if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 1), q$1)) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 43, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.popExn, q$1)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 44, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn((Belt_MutableQueue.add(q$1, 2), q$1)) !== 2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 45, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.popExn, q$1)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 46, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q$1) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 47, + 2 + ], + Error: new Error() + }; +} + +let q$2 = Belt_MutableQueue.make(); + +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 1), q$2)) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 52, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 2), q$2)) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 53, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.peekExn((Belt_MutableQueue.add(q$2, 3), q$2)) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 54, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.peekExn(q$2) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 55, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q$2) !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 56, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.peekExn(q$2) !== 2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 57, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q$2) !== 2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 58, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.peekExn(q$2) !== 3) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 59, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.popExn(q$2) !== 3) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 60, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 61, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.peekExn, q$2)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 62, + 2 + ], + Error: new Error() + }; +} + +let q$3 = Belt_MutableQueue.make(); + +for (let i = 1; i <= 10; ++i) { + Belt_MutableQueue.add(q$3, i); +} + +Belt_MutableQueue.clear(q$3); + +if (Belt_MutableQueue.size(q$3) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 71, + 2 + ], + Error: new Error() + }; +} + +if (!does_raise(Belt_MutableQueue.popExn, q$3)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 72, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(q$3, Belt_MutableQueue.make())) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 73, + 2 + ], + Error: new Error() + }; +} + +Belt_MutableQueue.add(q$3, 42); + +if (Belt_MutableQueue.popExn(q$3) !== 42) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 75, + 2 + ], + Error: new Error() + }; +} + +let q1 = Belt_MutableQueue.make(); + +for (let i$1 = 1; i$1 <= 10; ++i$1) { + Belt_MutableQueue.add(q1, i$1); +} + +let q2 = Belt_MutableQueue.copy(q1); + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1), [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 84, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2), [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 85, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q1) !== 10) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 86, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2) !== 10) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 87, + 2 + ], + Error: new Error() + }; +} + +for (let i$2 = 1; i$2 <= 10; ++i$2) { + if (Belt_MutableQueue.popExn(q1) !== i$2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 89, + 4 + ], + Error: new Error() + }; + } + +} + +for (let i$3 = 1; i$3 <= 10; ++i$3) { + if (Belt_MutableQueue.popExn(q2) !== i$3) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 92, + 4 + ], + Error: new Error() + }; + } + +} + +let q$4 = Belt_MutableQueue.make(); + +if (!Belt_MutableQueue.isEmpty(q$4)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 98, + 2 + ], + Error: new Error() + }; +} + +for (let i$4 = 1; i$4 <= 10; ++i$4) { + Belt_MutableQueue.add(q$4, i$4); + if (Belt_MutableQueue.size(q$4) !== i$4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 101, + 4 + ], + Error: new Error() + }; + } + if (Belt_MutableQueue.isEmpty(q$4)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 102, + 4 + ], + Error: new Error() + }; + } + +} + +for (let i$5 = 10; i$5 >= 1; --i$5) { + if (Belt_MutableQueue.size(q$4) !== i$5) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 105, + 4 + ], + Error: new Error() + }; + } + if (Belt_MutableQueue.isEmpty(q$4)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 106, + 4 + ], + Error: new Error() + }; + } + Belt_MutableQueue.popExn(q$4); +} + +if (Belt_MutableQueue.size(q$4) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 109, + 2 + ], + Error: new Error() + }; +} + +if (!Belt_MutableQueue.isEmpty(q$4)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 110, + 2 + ], + Error: new Error() + }; +} + +let q$5 = Belt_MutableQueue.make(); + +for (let i$6 = 1; i$6 <= 10; ++i$6) { + Belt_MutableQueue.add(q$5, i$6); +} + +let i$7 = { + contents: 1 +}; + +Belt_MutableQueue.forEach(q$5, j => { + if (i$7.contents !== j) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 120, + 4 + ], + Error: new Error() + }; + } + i$7.contents = i$7.contents + 1 | 0; +}); + +let q1$1 = Belt_MutableQueue.make(); + +let q2$1 = Belt_MutableQueue.make(); + +if (Belt_MutableQueue.size(q1$1) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 127, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$1), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 128, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$1) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 129, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$1), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 130, + 2 + ], + Error: new Error() + }; +} + +Belt_MutableQueue.transfer(q1$1, q2$1); + +if (Belt_MutableQueue.size(q1$1) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 132, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$1), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 133, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$1) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 134, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$1), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 135, + 2 + ], + Error: new Error() + }; +} + +let q1$2 = Belt_MutableQueue.make(); + +let q2$2 = Belt_MutableQueue.make(); + +for (let i$8 = 1; i$8 <= 4; ++i$8) { + Belt_MutableQueue.add(q1$2, i$8); +} + +if (Belt_MutableQueue.size(q1$2) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 143, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$2), [ + 1, + 2, + 3, + 4 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 144, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$2) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 145, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$2), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 146, + 2 + ], + Error: new Error() + }; +} + +Belt_MutableQueue.transfer(q1$2, q2$2); + +if (Belt_MutableQueue.size(q1$2) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 148, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$2), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 149, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$2) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 150, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$2), [ + 1, + 2, + 3, + 4 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 151, + 2 + ], + Error: new Error() + }; +} + +let q1$3 = Belt_MutableQueue.make(); + +let q2$3 = Belt_MutableQueue.make(); + +for (let i$9 = 5; i$9 <= 8; ++i$9) { + Belt_MutableQueue.add(q2$3, i$9); +} + +if (Belt_MutableQueue.size(q1$3) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 159, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$3), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 160, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$3) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 161, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$3), [ + 5, + 6, + 7, + 8 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 162, + 2 + ], + Error: new Error() + }; +} + +Belt_MutableQueue.transfer(q1$3, q2$3); + +if (Belt_MutableQueue.size(q1$3) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 164, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$3), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 165, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$3) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 166, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$3), [ + 5, + 6, + 7, + 8 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 167, + 2 + ], + Error: new Error() + }; +} + +let q1$4 = Belt_MutableQueue.make(); + +let q2$4 = Belt_MutableQueue.make(); + +for (let i$10 = 1; i$10 <= 4; ++i$10) { + Belt_MutableQueue.add(q1$4, i$10); +} + +for (let i$11 = 5; i$11 <= 8; ++i$11) { + Belt_MutableQueue.add(q2$4, i$11); +} + +if (Belt_MutableQueue.size(q1$4) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 178, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$4), [ + 1, + 2, + 3, + 4 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 179, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.size(q2$4) !== 4) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 180, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$4), [ + 5, + 6, + 7, + 8 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 181, + 2 + ], + Error: new Error() + }; +} + +Belt_MutableQueue.transfer(q1$4, q2$4); + +if (Belt_MutableQueue.size(q1$4) !== 0) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 183, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q1$4), [])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 184, + 2 + ], + Error: new Error() + }; +} + +let v = [ + 5, + 6, + 7, + 8, + 1, + 2, + 3, + 4 +]; + +if (Belt_MutableQueue.size(q2$4) !== 8) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 186, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Belt_MutableQueue.toArray(q2$4), v)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 187, + 2 + ], + Error: new Error() + }; +} + +if (Belt_MutableQueue.reduce(q2$4, 0, (x, y) => x - y | 0) !== Belt_Array.reduce(v, 0, (x, y) => x - y | 0)) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "bs_queue_test.res", + 189, + 2 + ], + Error: new Error() + }; +} + +console.log("OK"); + +let q$6 = Belt_MutableQueue.fromArray([ + 1, + 2, + 3, + 4 +]); + +let q1$5 = Belt_MutableQueue.map(q$6, x => x - 1 | 0); + +eq("File \"bs_queue_test.res\", line 197, characters 5-12", Belt_MutableQueue.toArray(q1$5), [ + 0, + 1, + 2, + 3 +]); + +b("File \"bs_queue_test.res\", line 198, characters 4-11", Belt_MutableQueue.isEmpty(Belt_MutableQueue.fromArray([]))); + +b("File \"bs_queue_test.res\", line 199, characters 4-11", Belt_MutableQueue.isEmpty(Belt_MutableQueue.map(Belt_MutableQueue.fromArray([]), x => x + 1 | 0))); + +Mt.from_pair_suites("Bs_queue_test", suites.contents); + +let Q; + +export { + suites, + test_id, + eq, + b, + Q, + does_raise, + $plus$plus, +} +/* q Not a pure module */ diff --git a/tests/tests/src/bs_rest_test.js b/tests/tests/src/bs_rest_test.js deleted file mode 100644 index c982367412..0000000000 --- a/tests/tests/src/bs_rest_test.js +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function x(v){return [v]} -; - -x("3"); - -let v = x(3); - -function xxx(prim) { - return x(prim); -} - -let u = x(3); - -let xx = x("3"); - -exports.v = v; -exports.xxx = xxx; -exports.u = u; -exports.xx = xx; -/* Not a pure module */ diff --git a/tests/tests/src/bs_rest_test.mjs b/tests/tests/src/bs_rest_test.mjs new file mode 100644 index 0000000000..49a1c83502 --- /dev/null +++ b/tests/tests/src/bs_rest_test.mjs @@ -0,0 +1,25 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function x(v){return [v]} +; + +x("3"); + +let v = x(3); + +function xxx(prim) { + return x(prim); +} + +let u = x(3); + +let xx = x("3"); + +export { + v, + xxx, + u, + xx, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_set_int_test.js b/tests/tests/src/bs_set_int_test.js deleted file mode 100644 index 84a499983b..0000000000 --- a/tests/tests/src/bs_set_int_test.js +++ /dev/null @@ -1,385 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Belt_SetInt = require("rescript/lib/js/Belt_SetInt.js"); -let Array_data_util = require("./array_data_util.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, v) { - Mt.bool_suites(test_id, suites, loc, v); -} - -function $eq$tilde(s, i) { - return Belt_SetInt.eq(Belt_SetInt.fromArray(i), s); -} - -function $eq$star(a, b) { - return Belt_SetInt.eq(Belt_SetInt.fromArray(a), Belt_SetInt.fromArray(b)); -} - -b("File \"bs_set_int_test.res\", line 22, characters 11-18", $eq$star([ - 1, - 2, - 3 -], [ - 3, - 2, - 1 -])); - -let u = Belt_SetInt.intersect(Belt_SetInt.fromArray([ - 1, - 2, - 3 -]), Belt_SetInt.fromArray([ - 3, - 4, - 5 -])); - -b("File \"bs_set_int_test.res\", line 28, characters 11-18", Belt_SetInt.eq(Belt_SetInt.fromArray([3]), u)); - -function range(i, j) { - return Belt_Array.init((j - i | 0) + 1 | 0, k => k + i | 0); -} - -function revRange(i, j) { - return Belt_List.toArray(Belt_List.reverse(Belt_List.fromArray(Belt_Array.init((j - i | 0) + 1 | 0, k => k + i | 0)))); -} - -let v = Belt_SetInt.fromArray(Belt_Array.concat(range(100, 1000), revRange(400, 1500))); - -let i = range(100, 1500); - -b("File \"bs_set_int_test.res\", line 37, characters 4-11", Belt_SetInt.eq(Belt_SetInt.fromArray(i), v)); - -let match = Belt_SetInt.partition(v, x => x % 3 === 0); - -let l; - -let r; - -for (let i$1 = 100; i$1 <= 1500; ++i$1) { - if (i$1 % 3 === 0) { - l = Belt_SetInt.add(l, i$1); - } else { - r = Belt_SetInt.add(r, i$1); - } -} - -let nl = l; - -let nr = r; - -b("File \"bs_set_int_test.res\", line 50, characters 4-11", Belt_SetInt.eq(match[0], nl)); - -b("File \"bs_set_int_test.res\", line 51, characters 4-11", Belt_SetInt.eq(match[1], nr)); - -let i$2 = range(50, 100); - -let s = Belt_SetInt.intersect(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 55, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$2), s)); - -let i$3 = range(1, 200); - -let s$1 = Belt_SetInt.union(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 66, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$3), s$1)); - -let i$4 = range(1, 49); - -let s$2 = Belt_SetInt.diff(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); - -b("File \"bs_set_int_test.res\", line 77, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$4), s$2)); - -let i$5 = revRange(50, 100); - -let s$3 = Belt_SetInt.intersect(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); - -b("File \"bs_set_int_test.res\", line 88, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$5), s$3)); - -let i$6 = revRange(1, 200); - -let s$4 = Belt_SetInt.union(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); - -b("File \"bs_set_int_test.res\", line 99, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$6), s$4)); - -let i$7 = revRange(1, 49); - -let s$5 = Belt_SetInt.diff(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); - -b("File \"bs_set_int_test.res\", line 110, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$7), s$5)); - -let ss = [ - 1, - 222, - 3, - 4, - 2, - 0, - 33, - -1 -]; - -let v$1 = Belt_SetInt.fromArray([ - 1, - 222, - 3, - 4, - 2, - 0, - 33, - -1 -]); - -let minv = Belt_SetInt.minUndefined(v$1); - -let maxv = Belt_SetInt.maxUndefined(v$1); - -function approx(loc, x, y) { - b(loc, x === y); -} - -eq("File \"bs_set_int_test.res\", line 125, characters 5-12", Belt_SetInt.reduce(v$1, 0, (x, y) => x + y | 0), Belt_Array.reduce(ss, 0, (prim0, prim1) => prim0 + prim1 | 0)); - -approx("File \"bs_set_int_test.res\", line 126, characters 9-16", -1, minv); - -approx("File \"bs_set_int_test.res\", line 127, characters 9-16", 222, maxv); - -let v$2 = Belt_SetInt.remove(v$1, 3); - -let minv$1 = Belt_SetInt.minimum(v$2); - -let maxv$1 = Belt_SetInt.maximum(v$2); - -eq("File \"bs_set_int_test.res\", line 130, characters 5-12", minv$1, -1); - -eq("File \"bs_set_int_test.res\", line 131, characters 5-12", maxv$1, 222); - -let v$3 = Belt_SetInt.remove(v$2, 222); - -let minv$2 = Belt_SetInt.minimum(v$3); - -let maxv$2 = Belt_SetInt.maximum(v$3); - -eq("File \"bs_set_int_test.res\", line 134, characters 5-12", minv$2, -1); - -eq("File \"bs_set_int_test.res\", line 135, characters 5-12", maxv$2, 33); - -let v$4 = Belt_SetInt.remove(v$3, -1); - -let minv$3 = Belt_SetInt.minimum(v$4); - -let maxv$3 = Belt_SetInt.maximum(v$4); - -eq("File \"bs_set_int_test.res\", line 138, characters 5-12", minv$3, 0); - -eq("File \"bs_set_int_test.res\", line 139, characters 5-12", maxv$3, 33); - -let v$5 = Belt_SetInt.remove(v$4, 0); - -let v$6 = Belt_SetInt.remove(v$5, 33); - -let v$7 = Belt_SetInt.remove(v$6, 2); - -let v$8 = Belt_SetInt.remove(v$7, 3); - -let v$9 = Belt_SetInt.remove(v$8, 4); - -let v$10 = Belt_SetInt.remove(v$9, 1); - -b("File \"bs_set_int_test.res\", line 146, characters 4-11", Belt_SetInt.isEmpty(v$10)); - -let v$11 = Belt_Array.makeByAndShuffle(1000000, i => i); - -let u$1 = Belt_SetInt.fromArray(v$11); - -Belt_SetInt.checkInvariantInternal(u$1); - -let firstHalf = Belt_Array.slice(v$11, 0, 2000); - -let xx = Belt_Array.reduce(firstHalf, u$1, Belt_SetInt.remove); - -Belt_SetInt.checkInvariantInternal(u$1); - -b("File \"bs_set_int_test.res\", line 158, characters 4-11", Belt_SetInt.eq(Belt_SetInt.union(Belt_SetInt.fromArray(firstHalf), xx), u$1)); - -let aa = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); - -let bb = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 200)); - -let cc = Belt_SetInt.fromArray(Array_data_util.randomRange(120, 200)); - -let dd = Belt_SetInt.union(aa, cc); - -b("File \"bs_set_int_test.res\", line 171, characters 4-11", Belt_SetInt.subset(aa, bb)); - -b("File \"bs_set_int_test.res\", line 172, characters 4-11", Belt_SetInt.subset(dd, bb)); - -b("File \"bs_set_int_test.res\", line 173, characters 4-11", Belt_SetInt.subset(Belt_SetInt.add(dd, 200), bb)); - -b("File \"bs_set_int_test.res\", line 174, characters 4-11", Belt_SetInt.add(dd, 200) === dd); - -b("File \"bs_set_int_test.res\", line 175, characters 4-11", Belt_SetInt.add(dd, 0) === dd); - -b("File \"bs_set_int_test.res\", line 176, characters 4-11", !Belt_SetInt.subset(Belt_SetInt.add(dd, 201), bb)); - -let aa$1 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); - -let bb$1 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); - -let cc$1 = Belt_SetInt.add(bb$1, 101); - -let dd$1 = Belt_SetInt.remove(bb$1, 99); - -let ee = Belt_SetInt.add(dd$1, 101); - -b("File \"bs_set_int_test.res\", line 185, characters 4-11", Belt_SetInt.eq(aa$1, bb$1)); - -b("File \"bs_set_int_test.res\", line 186, characters 4-11", !Belt_SetInt.eq(aa$1, cc$1)); - -b("File \"bs_set_int_test.res\", line 187, characters 4-11", !Belt_SetInt.eq(dd$1, cc$1)); - -b("File \"bs_set_int_test.res\", line 188, characters 4-11", !Belt_SetInt.eq(bb$1, ee)); - -let a1 = Belt_SetInt.mergeMany(undefined, Array_data_util.randomRange(0, 100)); - -let a2 = Belt_SetInt.removeMany(a1, Array_data_util.randomRange(40, 100)); - -let a3 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 39)); - -let match$1 = Belt_SetInt.split(a1, 40); - -let match$2 = match$1[0]; - -let a5 = match$2[1]; - -let a4 = match$2[0]; - -b("File \"bs_set_int_test.res\", line 197, characters 4-11", Belt_SetInt.eq(a1, Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)))); - -b("File \"bs_set_int_test.res\", line 198, characters 4-11", Belt_SetInt.eq(a2, a3)); - -b("File \"bs_set_int_test.res\", line 199, characters 4-11", match$1[1]); - -b("File \"bs_set_int_test.res\", line 200, characters 4-11", Belt_SetInt.eq(a3, a4)); - -let a6 = Belt_SetInt.remove(Belt_SetInt.removeMany(a1, Array_data_util.randomRange(0, 39)), 40); - -b("File \"bs_set_int_test.res\", line 202, characters 4-11", Belt_SetInt.eq(a5, a6)); - -let a7 = Belt_SetInt.remove(a1, 40); - -let match$3 = Belt_SetInt.split(a7, 40); - -let match$4 = match$3[0]; - -let a9 = match$4[1]; - -b("File \"bs_set_int_test.res\", line 205, characters 4-11", !match$3[1]); - -b("File \"bs_set_int_test.res\", line 206, characters 4-11", Belt_SetInt.eq(a4, match$4[0])); - -b("File \"bs_set_int_test.res\", line 207, characters 4-11", Belt_SetInt.eq(a5, a9)); - -let a10 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(42, 2000)); - -eq("File \"bs_set_int_test.res\", line 209, characters 5-12", Belt_SetInt.size(a10), 1); - -let a11 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(0, 2000)); - -b("File \"bs_set_int_test.res\", line 211, characters 4-11", Belt_SetInt.isEmpty(a11)); - -let match$5 = Belt_SetInt.split(undefined, 0); - -let match$6 = match$5[0]; - -b("File \"bs_set_int_test.res\", line 216, characters 4-11", Belt_SetInt.isEmpty(match$6[0])); - -b("File \"bs_set_int_test.res\", line 217, characters 4-11", Belt_SetInt.isEmpty(match$6[1])); - -b("File \"bs_set_int_test.res\", line 218, characters 4-11", !match$5[1]); - -let v$12 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 2000)); - -let v0 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 2000)); - -let v1 = Belt_SetInt.fromArray(Array_data_util.randomRange(1, 2001)); - -let v2 = Belt_SetInt.fromArray(Array_data_util.randomRange(3, 2002)); - -let v3 = Belt_SetInt.removeMany(v2, [ - 2002, - 2001 -]); - -let us = Belt_Array.map(Array_data_util.randomRange(1000, 3000), x => Belt_SetInt.has(v$12, x)); - -let counted = Belt_Array.reduce(us, 0, (acc, x) => { - if (x) { - return acc + 1 | 0; - } else { - return acc; - } -}); - -eq("File \"bs_set_int_test.res\", line 235, characters 5-12", counted, 1001); - -b("File \"bs_set_int_test.res\", line 236, characters 4-11", Belt_SetInt.eq(v$12, v0)); - -b("File \"bs_set_int_test.res\", line 237, characters 4-11", Belt_SetInt.cmp(v$12, v0) === 0); - -b("File \"bs_set_int_test.res\", line 238, characters 4-11", Belt_SetInt.cmp(v$12, v1) < 0); - -b("File \"bs_set_int_test.res\", line 239, characters 4-11", Belt_SetInt.cmp(v$12, v2) > 0); - -b("File \"bs_set_int_test.res\", line 240, characters 4-11", Belt_SetInt.subset(v3, v0)); - -b("File \"bs_set_int_test.res\", line 241, characters 4-11", !Belt_SetInt.subset(v1, v0)); - -eq("File \"bs_set_int_test.res\", line 242, characters 5-12", Belt_SetInt.get(v$12, 30), 30); - -eq("File \"bs_set_int_test.res\", line 243, characters 5-12", Belt_SetInt.get(v$12, 3000), undefined); - -Mt.from_pair_suites("Bs_set_int_test", suites.contents); - -let N; - -let I; - -let L; - -let A; - -let ofA = Belt_SetInt.fromArray; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.N = N; -exports.I = I; -exports.L = L; -exports.A = A; -exports.$eq$tilde = $eq$tilde; -exports.$eq$star = $eq$star; -exports.ofA = ofA; -exports.u = u; -exports.range = range; -exports.revRange = revRange; -/* Not a pure module */ diff --git a/tests/tests/src/bs_set_int_test.mjs b/tests/tests/src/bs_set_int_test.mjs new file mode 100644 index 0000000000..26b26e5458 --- /dev/null +++ b/tests/tests/src/bs_set_int_test.mjs @@ -0,0 +1,386 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Belt_SetInt from "rescript/lib/es6/Belt_SetInt.js"; +import * as Array_data_util from "./array_data_util.mjs"; + +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, v) { + Mt.bool_suites(test_id, suites, loc, v); +} + +function $eq$tilde(s, i) { + return Belt_SetInt.eq(Belt_SetInt.fromArray(i), s); +} + +function $eq$star(a, b) { + return Belt_SetInt.eq(Belt_SetInt.fromArray(a), Belt_SetInt.fromArray(b)); +} + +b("File \"bs_set_int_test.res\", line 22, characters 11-18", $eq$star([ + 1, + 2, + 3 +], [ + 3, + 2, + 1 +])); + +let u = Belt_SetInt.intersect(Belt_SetInt.fromArray([ + 1, + 2, + 3 +]), Belt_SetInt.fromArray([ + 3, + 4, + 5 +])); + +b("File \"bs_set_int_test.res\", line 28, characters 11-18", Belt_SetInt.eq(Belt_SetInt.fromArray([3]), u)); + +function range(i, j) { + return Belt_Array.init((j - i | 0) + 1 | 0, k => k + i | 0); +} + +function revRange(i, j) { + return Belt_List.toArray(Belt_List.reverse(Belt_List.fromArray(Belt_Array.init((j - i | 0) + 1 | 0, k => k + i | 0)))); +} + +let v = Belt_SetInt.fromArray(Belt_Array.concat(range(100, 1000), revRange(400, 1500))); + +let i = range(100, 1500); + +b("File \"bs_set_int_test.res\", line 37, characters 4-11", Belt_SetInt.eq(Belt_SetInt.fromArray(i), v)); + +let match = Belt_SetInt.partition(v, x => x % 3 === 0); + +let l; + +let r; + +for (let i$1 = 100; i$1 <= 1500; ++i$1) { + if (i$1 % 3 === 0) { + l = Belt_SetInt.add(l, i$1); + } else { + r = Belt_SetInt.add(r, i$1); + } +} + +let nl = l; + +let nr = r; + +b("File \"bs_set_int_test.res\", line 50, characters 4-11", Belt_SetInt.eq(match[0], nl)); + +b("File \"bs_set_int_test.res\", line 51, characters 4-11", Belt_SetInt.eq(match[1], nr)); + +let i$2 = range(50, 100); + +let s = Belt_SetInt.intersect(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); + +b("File \"bs_set_int_test.res\", line 55, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$2), s)); + +let i$3 = range(1, 200); + +let s$1 = Belt_SetInt.union(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); + +b("File \"bs_set_int_test.res\", line 66, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$3), s$1)); + +let i$4 = range(1, 49); + +let s$2 = Belt_SetInt.diff(Belt_SetInt.fromArray(range(1, 100)), Belt_SetInt.fromArray(range(50, 200))); + +b("File \"bs_set_int_test.res\", line 77, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$4), s$2)); + +let i$5 = revRange(50, 100); + +let s$3 = Belt_SetInt.intersect(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); + +b("File \"bs_set_int_test.res\", line 88, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$5), s$3)); + +let i$6 = revRange(1, 200); + +let s$4 = Belt_SetInt.union(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); + +b("File \"bs_set_int_test.res\", line 99, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$6), s$4)); + +let i$7 = revRange(1, 49); + +let s$5 = Belt_SetInt.diff(Belt_SetInt.fromArray(revRange(1, 100)), Belt_SetInt.fromArray(revRange(50, 200))); + +b("File \"bs_set_int_test.res\", line 110, characters 2-9", Belt_SetInt.eq(Belt_SetInt.fromArray(i$7), s$5)); + +let ss = [ + 1, + 222, + 3, + 4, + 2, + 0, + 33, + -1 +]; + +let v$1 = Belt_SetInt.fromArray([ + 1, + 222, + 3, + 4, + 2, + 0, + 33, + -1 +]); + +let minv = Belt_SetInt.minUndefined(v$1); + +let maxv = Belt_SetInt.maxUndefined(v$1); + +function approx(loc, x, y) { + b(loc, x === y); +} + +eq("File \"bs_set_int_test.res\", line 125, characters 5-12", Belt_SetInt.reduce(v$1, 0, (x, y) => x + y | 0), Belt_Array.reduce(ss, 0, (prim0, prim1) => prim0 + prim1 | 0)); + +approx("File \"bs_set_int_test.res\", line 126, characters 9-16", -1, minv); + +approx("File \"bs_set_int_test.res\", line 127, characters 9-16", 222, maxv); + +let v$2 = Belt_SetInt.remove(v$1, 3); + +let minv$1 = Belt_SetInt.minimum(v$2); + +let maxv$1 = Belt_SetInt.maximum(v$2); + +eq("File \"bs_set_int_test.res\", line 130, characters 5-12", minv$1, -1); + +eq("File \"bs_set_int_test.res\", line 131, characters 5-12", maxv$1, 222); + +let v$3 = Belt_SetInt.remove(v$2, 222); + +let minv$2 = Belt_SetInt.minimum(v$3); + +let maxv$2 = Belt_SetInt.maximum(v$3); + +eq("File \"bs_set_int_test.res\", line 134, characters 5-12", minv$2, -1); + +eq("File \"bs_set_int_test.res\", line 135, characters 5-12", maxv$2, 33); + +let v$4 = Belt_SetInt.remove(v$3, -1); + +let minv$3 = Belt_SetInt.minimum(v$4); + +let maxv$3 = Belt_SetInt.maximum(v$4); + +eq("File \"bs_set_int_test.res\", line 138, characters 5-12", minv$3, 0); + +eq("File \"bs_set_int_test.res\", line 139, characters 5-12", maxv$3, 33); + +let v$5 = Belt_SetInt.remove(v$4, 0); + +let v$6 = Belt_SetInt.remove(v$5, 33); + +let v$7 = Belt_SetInt.remove(v$6, 2); + +let v$8 = Belt_SetInt.remove(v$7, 3); + +let v$9 = Belt_SetInt.remove(v$8, 4); + +let v$10 = Belt_SetInt.remove(v$9, 1); + +b("File \"bs_set_int_test.res\", line 146, characters 4-11", Belt_SetInt.isEmpty(v$10)); + +let v$11 = Belt_Array.makeByAndShuffle(1000000, i => i); + +let u$1 = Belt_SetInt.fromArray(v$11); + +Belt_SetInt.checkInvariantInternal(u$1); + +let firstHalf = Belt_Array.slice(v$11, 0, 2000); + +let xx = Belt_Array.reduce(firstHalf, u$1, Belt_SetInt.remove); + +Belt_SetInt.checkInvariantInternal(u$1); + +b("File \"bs_set_int_test.res\", line 158, characters 4-11", Belt_SetInt.eq(Belt_SetInt.union(Belt_SetInt.fromArray(firstHalf), xx), u$1)); + +let aa = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); + +let bb = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 200)); + +let cc = Belt_SetInt.fromArray(Array_data_util.randomRange(120, 200)); + +let dd = Belt_SetInt.union(aa, cc); + +b("File \"bs_set_int_test.res\", line 171, characters 4-11", Belt_SetInt.subset(aa, bb)); + +b("File \"bs_set_int_test.res\", line 172, characters 4-11", Belt_SetInt.subset(dd, bb)); + +b("File \"bs_set_int_test.res\", line 173, characters 4-11", Belt_SetInt.subset(Belt_SetInt.add(dd, 200), bb)); + +b("File \"bs_set_int_test.res\", line 174, characters 4-11", Belt_SetInt.add(dd, 200) === dd); + +b("File \"bs_set_int_test.res\", line 175, characters 4-11", Belt_SetInt.add(dd, 0) === dd); + +b("File \"bs_set_int_test.res\", line 176, characters 4-11", !Belt_SetInt.subset(Belt_SetInt.add(dd, 201), bb)); + +let aa$1 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); + +let bb$1 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)); + +let cc$1 = Belt_SetInt.add(bb$1, 101); + +let dd$1 = Belt_SetInt.remove(bb$1, 99); + +let ee = Belt_SetInt.add(dd$1, 101); + +b("File \"bs_set_int_test.res\", line 185, characters 4-11", Belt_SetInt.eq(aa$1, bb$1)); + +b("File \"bs_set_int_test.res\", line 186, characters 4-11", !Belt_SetInt.eq(aa$1, cc$1)); + +b("File \"bs_set_int_test.res\", line 187, characters 4-11", !Belt_SetInt.eq(dd$1, cc$1)); + +b("File \"bs_set_int_test.res\", line 188, characters 4-11", !Belt_SetInt.eq(bb$1, ee)); + +let a1 = Belt_SetInt.mergeMany(undefined, Array_data_util.randomRange(0, 100)); + +let a2 = Belt_SetInt.removeMany(a1, Array_data_util.randomRange(40, 100)); + +let a3 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 39)); + +let match$1 = Belt_SetInt.split(a1, 40); + +let match$2 = match$1[0]; + +let a5 = match$2[1]; + +let a4 = match$2[0]; + +b("File \"bs_set_int_test.res\", line 197, characters 4-11", Belt_SetInt.eq(a1, Belt_SetInt.fromArray(Array_data_util.randomRange(0, 100)))); + +b("File \"bs_set_int_test.res\", line 198, characters 4-11", Belt_SetInt.eq(a2, a3)); + +b("File \"bs_set_int_test.res\", line 199, characters 4-11", match$1[1]); + +b("File \"bs_set_int_test.res\", line 200, characters 4-11", Belt_SetInt.eq(a3, a4)); + +let a6 = Belt_SetInt.remove(Belt_SetInt.removeMany(a1, Array_data_util.randomRange(0, 39)), 40); + +b("File \"bs_set_int_test.res\", line 202, characters 4-11", Belt_SetInt.eq(a5, a6)); + +let a7 = Belt_SetInt.remove(a1, 40); + +let match$3 = Belt_SetInt.split(a7, 40); + +let match$4 = match$3[0]; + +let a9 = match$4[1]; + +b("File \"bs_set_int_test.res\", line 205, characters 4-11", !match$3[1]); + +b("File \"bs_set_int_test.res\", line 206, characters 4-11", Belt_SetInt.eq(a4, match$4[0])); + +b("File \"bs_set_int_test.res\", line 207, characters 4-11", Belt_SetInt.eq(a5, a9)); + +let a10 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(42, 2000)); + +eq("File \"bs_set_int_test.res\", line 209, characters 5-12", Belt_SetInt.size(a10), 1); + +let a11 = Belt_SetInt.removeMany(a9, Array_data_util.randomRange(0, 2000)); + +b("File \"bs_set_int_test.res\", line 211, characters 4-11", Belt_SetInt.isEmpty(a11)); + +let match$5 = Belt_SetInt.split(undefined, 0); + +let match$6 = match$5[0]; + +b("File \"bs_set_int_test.res\", line 216, characters 4-11", Belt_SetInt.isEmpty(match$6[0])); + +b("File \"bs_set_int_test.res\", line 217, characters 4-11", Belt_SetInt.isEmpty(match$6[1])); + +b("File \"bs_set_int_test.res\", line 218, characters 4-11", !match$5[1]); + +let v$12 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 2000)); + +let v0 = Belt_SetInt.fromArray(Array_data_util.randomRange(0, 2000)); + +let v1 = Belt_SetInt.fromArray(Array_data_util.randomRange(1, 2001)); + +let v2 = Belt_SetInt.fromArray(Array_data_util.randomRange(3, 2002)); + +let v3 = Belt_SetInt.removeMany(v2, [ + 2002, + 2001 +]); + +let us = Belt_Array.map(Array_data_util.randomRange(1000, 3000), x => Belt_SetInt.has(v$12, x)); + +let counted = Belt_Array.reduce(us, 0, (acc, x) => { + if (x) { + return acc + 1 | 0; + } else { + return acc; + } +}); + +eq("File \"bs_set_int_test.res\", line 235, characters 5-12", counted, 1001); + +b("File \"bs_set_int_test.res\", line 236, characters 4-11", Belt_SetInt.eq(v$12, v0)); + +b("File \"bs_set_int_test.res\", line 237, characters 4-11", Belt_SetInt.cmp(v$12, v0) === 0); + +b("File \"bs_set_int_test.res\", line 238, characters 4-11", Belt_SetInt.cmp(v$12, v1) < 0); + +b("File \"bs_set_int_test.res\", line 239, characters 4-11", Belt_SetInt.cmp(v$12, v2) > 0); + +b("File \"bs_set_int_test.res\", line 240, characters 4-11", Belt_SetInt.subset(v3, v0)); + +b("File \"bs_set_int_test.res\", line 241, characters 4-11", !Belt_SetInt.subset(v1, v0)); + +eq("File \"bs_set_int_test.res\", line 242, characters 5-12", Belt_SetInt.get(v$12, 30), 30); + +eq("File \"bs_set_int_test.res\", line 243, characters 5-12", Belt_SetInt.get(v$12, 3000), undefined); + +Mt.from_pair_suites("Bs_set_int_test", suites.contents); + +let N; + +let I; + +let L; + +let A; + +let ofA = Belt_SetInt.fromArray; + +export { + suites, + test_id, + eq, + b, + N, + I, + L, + A, + $eq$tilde, + $eq$star, + ofA, + u, + range, + revRange, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_splice_partial.js b/tests/tests/src/bs_splice_partial.js deleted file mode 100644 index aa01df223d..0000000000 --- a/tests/tests/src/bs_splice_partial.js +++ /dev/null @@ -1,48 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function test(g) { - g.xx(10, 3, "xxx", 1, 2, 3); -} - -function test_hi(x) { - let y = x.hi(1, 2, 3); - if (y !== null) { - console.log(y); - return 2; - } else { - return 1; - } -} - -function test_hi__2(x) { - let match = x.hi__2(); - if (match == null) { - return 1; - } else { - return 2; - } -} - -function test_cb(x) { - x.cb("hI", 1, 2, 3)(3); - x.cb("hI", 1, 2, 3)(3); - return x.cb2("hI", 1, 2, 3)(3); -} - -function f(x) { - v(x); -} - -function testUndefined() { - return say(1, 2, [undefined,undefined]); -} - -exports.test = test; -exports.test_hi = test_hi; -exports.test_hi__2 = test_hi__2; -exports.test_cb = test_cb; -exports.f = f; -exports.testUndefined = testUndefined; -/* No side effect */ diff --git a/tests/tests/src/bs_splice_partial.mjs b/tests/tests/src/bs_splice_partial.mjs new file mode 100644 index 0000000000..8f703e597f --- /dev/null +++ b/tests/tests/src/bs_splice_partial.mjs @@ -0,0 +1,49 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function test(g) { + g.xx(10, 3, "xxx", 1, 2, 3); +} + +function test_hi(x) { + let y = x.hi(1, 2, 3); + if (y !== null) { + console.log(y); + return 2; + } else { + return 1; + } +} + +function test_hi__2(x) { + let match = x.hi__2(); + if (match == null) { + return 1; + } else { + return 2; + } +} + +function test_cb(x) { + x.cb("hI", 1, 2, 3)(3); + x.cb("hI", 1, 2, 3)(3); + return x.cb2("hI", 1, 2, 3)(3); +} + +function f(x) { + v(x); +} + +function testUndefined() { + return say(1, 2, [undefined,undefined]); +} + +export { + test, + test_hi, + test_hi__2, + test_cb, + f, + testUndefined, +} +/* No side effect */ diff --git a/tests/tests/src/bs_stack_test.js b/tests/tests/src/bs_stack_test.js deleted file mode 100644 index c4b1649d98..0000000000 --- a/tests/tests/src/bs_stack_test.js +++ /dev/null @@ -1,145 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_undefined = require("rescript/lib/js/Js_undefined.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); -let Belt_MutableQueue = require("rescript/lib/js/Belt_MutableQueue.js"); -let Belt_MutableStack = require("rescript/lib/js/Belt_MutableStack.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 inOrder(v) { - let current = v; - let s = Belt_MutableStack.make(); - let q = Belt_MutableQueue.make(); - while (current !== undefined) { - let v$1 = current; - Belt_MutableStack.push(s, v$1); - current = v$1.left; - }; - while (!Belt_MutableStack.isEmpty(s)) { - current = Belt_MutableStack.popUndefined(s); - let v$2 = current; - Belt_MutableQueue.add(q, v$2.value); - current = v$2.right; - while (current !== undefined) { - let v$3 = current; - Belt_MutableStack.push(s, v$3); - current = v$3.left; - }; - }; - return Belt_MutableQueue.toArray(q); -} - -function inOrder3(v) { - let current = v; - let s = Belt_MutableStack.make(); - let q = Belt_MutableQueue.make(); - while (current !== undefined) { - let v$1 = current; - Belt_MutableStack.push(s, v$1); - current = v$1.left; - }; - Belt_MutableStack.dynamicPopIter(s, popped => { - Belt_MutableQueue.add(q, popped.value); - let current = popped.right; - while (current !== undefined) { - let v = current; - Belt_MutableStack.push(s, v); - current = v.left; - }; - }); - return Belt_MutableQueue.toArray(q); -} - -function inOrder2(v) { - let todo = true; - let cursor = v; - let s = Belt_MutableStack.make(); - let q = Belt_MutableQueue.make(); - while (todo) { - if (cursor !== undefined) { - let v$1 = cursor; - Belt_MutableStack.push(s, v$1); - cursor = v$1.left; - } else if (Belt_MutableStack.isEmpty(s)) { - todo = false; - } else { - cursor = Belt_MutableStack.popUndefined(s); - let current = cursor; - Belt_MutableQueue.add(q, current.value); - cursor = current.right; - } - }; -} - -function n(l, r, a) { - return { - value: a, - left: Js_undefined.fromOption(l), - right: Js_undefined.fromOption(r) - }; -} - -let test1 = n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), Primitive_option.some(n(undefined, undefined, 5)), 2)), Primitive_option.some(n(undefined, undefined, 3)), 1); - -function pushAllLeft(st1, s1) { - let current = st1; - while (current !== undefined) { - let v = current; - Belt_MutableStack.push(s1, v); - current = v.left; - }; -} - -let test2 = n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), undefined, 2)), undefined, 5)), undefined, 1)), undefined, 3); - -let test3 = n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), undefined, 2)), undefined, 5)), Primitive_option.some(n(undefined, undefined, 3)), 1); - -eq("File \"bs_stack_test.res\", line 98, characters 3-10", inOrder(test1), [ - 4, - 2, - 5, - 1, - 3 -]); - -eq("File \"bs_stack_test.res\", line 99, characters 3-10", inOrder3(test1), [ - 4, - 2, - 5, - 1, - 3 -]); - -Mt.from_pair_suites("bs_stack_test.res", suites.contents); - -let S; - -let Q; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.S = S; -exports.Q = Q; -exports.inOrder = inOrder; -exports.inOrder3 = inOrder3; -exports.inOrder2 = inOrder2; -exports.n = n; -exports.test1 = test1; -exports.pushAllLeft = pushAllLeft; -exports.test2 = test2; -exports.test3 = test3; -/* test1 Not a pure module */ diff --git a/tests/tests/src/bs_stack_test.mjs b/tests/tests/src/bs_stack_test.mjs new file mode 100644 index 0000000000..5670fd9d43 --- /dev/null +++ b/tests/tests/src/bs_stack_test.mjs @@ -0,0 +1,146 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_undefined from "rescript/lib/es6/Js_undefined.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; +import * as Belt_MutableQueue from "rescript/lib/es6/Belt_MutableQueue.js"; +import * as Belt_MutableStack from "rescript/lib/es6/Belt_MutableStack.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 inOrder(v) { + let current = v; + let s = Belt_MutableStack.make(); + let q = Belt_MutableQueue.make(); + while (current !== undefined) { + let v$1 = current; + Belt_MutableStack.push(s, v$1); + current = v$1.left; + }; + while (!Belt_MutableStack.isEmpty(s)) { + current = Belt_MutableStack.popUndefined(s); + let v$2 = current; + Belt_MutableQueue.add(q, v$2.value); + current = v$2.right; + while (current !== undefined) { + let v$3 = current; + Belt_MutableStack.push(s, v$3); + current = v$3.left; + }; + }; + return Belt_MutableQueue.toArray(q); +} + +function inOrder3(v) { + let current = v; + let s = Belt_MutableStack.make(); + let q = Belt_MutableQueue.make(); + while (current !== undefined) { + let v$1 = current; + Belt_MutableStack.push(s, v$1); + current = v$1.left; + }; + Belt_MutableStack.dynamicPopIter(s, popped => { + Belt_MutableQueue.add(q, popped.value); + let current = popped.right; + while (current !== undefined) { + let v = current; + Belt_MutableStack.push(s, v); + current = v.left; + }; + }); + return Belt_MutableQueue.toArray(q); +} + +function inOrder2(v) { + let todo = true; + let cursor = v; + let s = Belt_MutableStack.make(); + let q = Belt_MutableQueue.make(); + while (todo) { + if (cursor !== undefined) { + let v$1 = cursor; + Belt_MutableStack.push(s, v$1); + cursor = v$1.left; + } else if (Belt_MutableStack.isEmpty(s)) { + todo = false; + } else { + cursor = Belt_MutableStack.popUndefined(s); + let current = cursor; + Belt_MutableQueue.add(q, current.value); + cursor = current.right; + } + }; +} + +function n(l, r, a) { + return { + value: a, + left: Js_undefined.fromOption(l), + right: Js_undefined.fromOption(r) + }; +} + +let test1 = n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), Primitive_option.some(n(undefined, undefined, 5)), 2)), Primitive_option.some(n(undefined, undefined, 3)), 1); + +function pushAllLeft(st1, s1) { + let current = st1; + while (current !== undefined) { + let v = current; + Belt_MutableStack.push(s1, v); + current = v.left; + }; +} + +let test2 = n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), undefined, 2)), undefined, 5)), undefined, 1)), undefined, 3); + +let test3 = n(Primitive_option.some(n(Primitive_option.some(n(Primitive_option.some(n(undefined, undefined, 4)), undefined, 2)), undefined, 5)), Primitive_option.some(n(undefined, undefined, 3)), 1); + +eq("File \"bs_stack_test.res\", line 98, characters 3-10", inOrder(test1), [ + 4, + 2, + 5, + 1, + 3 +]); + +eq("File \"bs_stack_test.res\", line 99, characters 3-10", inOrder3(test1), [ + 4, + 2, + 5, + 1, + 3 +]); + +Mt.from_pair_suites("bs_stack_test.res", suites.contents); + +let S; + +let Q; + +export { + suites, + test_id, + eq, + S, + Q, + inOrder, + inOrder3, + inOrder2, + n, + test1, + pushAllLeft, + test2, + test3, +} +/* test1 Not a pure module */ diff --git a/tests/tests/src/bs_string_test.js b/tests/tests/src/bs_string_test.js deleted file mode 100644 index c7176e11e2..0000000000 --- a/tests/tests/src/bs_string_test.js +++ /dev/null @@ -1,36 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"bs_string_test.res\", line 13, characters 2-9", "ghso ghso g".split(" ").reduce((x, y) => x + ("-" + y), ""), "-ghso-ghso-g"); - -Mt.from_pair_suites("Bs_string_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/bs_string_test.mjs b/tests/tests/src/bs_string_test.mjs new file mode 100644 index 0000000000..1024e25c3f --- /dev/null +++ b/tests/tests/src/bs_string_test.mjs @@ -0,0 +1,37 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"bs_string_test.res\", line 13, characters 2-9", "ghso ghso g".split(" ").reduce((x, y) => x + ("-" + y), ""), "-ghso-ghso-g"); + +Mt.from_pair_suites("Bs_string_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/bs_unwrap_test.js b/tests/tests/src/bs_unwrap_test.js deleted file mode 100644 index 928689aeb0..0000000000 --- a/tests/tests/src/bs_unwrap_test.js +++ /dev/null @@ -1,111 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -console.log([ - "hello world", - 1 -]); - -console.log(1337); - -console.log("hello world"); - -let arg_string = { - NAME: "String", - VAL: "hi runtime" -}; - -console.log(arg_string.VAL); - -let arg_pair = { - NAME: "Pair", - VAL: [ - "hi", - 1 - ] -}; - -console.log(arg_pair.VAL); - -console.log(); - -console.log(1, undefined); - -console.log(2, "hi"); - -console.log(3, "hi"); - -console.log(4, undefined); - -let some_arg = { - NAME: "Bool", - VAL: true -}; - -console.log(5, Primitive_option.unwrapPolyVar(some_arg)); - -console.log(6, undefined); - -console.log(7, Primitive_option.unwrapPolyVar((console.log("trace"), undefined))); - -function dyn_log3(prim0, prim1, prim2) { - console.log(prim0.VAL, Primitive_option.unwrapPolyVar(prim1)); -} - -dyn_log3({ - NAME: "Int", - VAL: 8 -}, { - NAME: "Bool", - VAL: true -}, undefined); - -console.log("foo"); - -console.log({ - foo: 1 -}); - -function dyn_log4(prim) { - console.log(prim.VAL); -} - -console.log({ - foo: 2 -}); - -function f(x) { - console.log(x.VAL); -} - -function ff0(x, p) { - console.log(Primitive_option.unwrapPolyVar(x), p); -} - -function ff1(x, p) { - console.log(Primitive_option.unwrapPolyVar(x()), p); -} - -function test00() { - return { - a: 1, - b: 2, - x: undefined - }; -} - -let none_arg; - -exports.arg_string = arg_string; -exports.arg_pair = arg_pair; -exports.some_arg = some_arg; -exports.none_arg = none_arg; -exports.dyn_log3 = dyn_log3; -exports.dyn_log4 = dyn_log4; -exports.f = f; -exports.ff0 = ff0; -exports.ff1 = ff1; -exports.test00 = test00; -/* Not a pure module */ diff --git a/tests/tests/src/bs_unwrap_test.mjs b/tests/tests/src/bs_unwrap_test.mjs new file mode 100644 index 0000000000..5941ec6fa6 --- /dev/null +++ b/tests/tests/src/bs_unwrap_test.mjs @@ -0,0 +1,112 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +console.log([ + "hello world", + 1 +]); + +console.log(1337); + +console.log("hello world"); + +let arg_string = { + NAME: "String", + VAL: "hi runtime" +}; + +console.log(arg_string.VAL); + +let arg_pair = { + NAME: "Pair", + VAL: [ + "hi", + 1 + ] +}; + +console.log(arg_pair.VAL); + +console.log(); + +console.log(1, undefined); + +console.log(2, "hi"); + +console.log(3, "hi"); + +console.log(4, undefined); + +let some_arg = { + NAME: "Bool", + VAL: true +}; + +console.log(5, Primitive_option.unwrapPolyVar(some_arg)); + +console.log(6, undefined); + +console.log(7, Primitive_option.unwrapPolyVar((console.log("trace"), undefined))); + +function dyn_log3(prim0, prim1, prim2) { + console.log(prim0.VAL, Primitive_option.unwrapPolyVar(prim1)); +} + +dyn_log3({ + NAME: "Int", + VAL: 8 +}, { + NAME: "Bool", + VAL: true +}, undefined); + +console.log("foo"); + +console.log({ + foo: 1 +}); + +function dyn_log4(prim) { + console.log(prim.VAL); +} + +console.log({ + foo: 2 +}); + +function f(x) { + console.log(x.VAL); +} + +function ff0(x, p) { + console.log(Primitive_option.unwrapPolyVar(x), p); +} + +function ff1(x, p) { + console.log(Primitive_option.unwrapPolyVar(x()), p); +} + +function test00() { + return { + a: 1, + b: 2, + x: undefined + }; +} + +let none_arg; + +export { + arg_string, + arg_pair, + some_arg, + none_arg, + dyn_log3, + dyn_log4, + f, + ff0, + ff1, + test00, +} +/* Not a pure module */ diff --git a/tests/tests/src/caml_compare_bigint_test.js b/tests/tests/src/caml_compare_bigint_test.js deleted file mode 100644 index fc725fa3b2..0000000000 --- a/tests/tests/src/caml_compare_bigint_test.js +++ /dev/null @@ -1,366 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -function isLessThan(title, small, big) { - return { - hd: [ - "compare: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: big > small - }) - ], - tl: { - hd: [ - "compare: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: small < big - }) - ], - tl: { - hd: [ - "< operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(small, big) - }) - ], - tl: { - hd: [ - "<= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessequal(small, big) - }) - ], - tl: { - hd: [ - "> operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan(big, small) - }) - ], - tl: { - hd: [ - ">= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterequal(big, small) - }) - ], - tl: { - hd: [ - "min: " + title, - param => ({ - TAG: "Eq", - _0: small, - _1: Primitive_object.min(big, small) - }) - ], - tl: { - hd: [ - "min: " + title, - param => ({ - TAG: "Eq", - _0: small, - _1: Primitive_object.min(small, big) - }) - ], - tl: { - hd: [ - "max: " + title, - param => ({ - TAG: "Eq", - _0: big, - _1: Primitive_object.max(big, small) - }) - ], - tl: { - hd: [ - "max: " + title, - param => ({ - TAG: "Eq", - _0: big, - _1: Primitive_object.max(small, big) - }) - ], - tl: { - hd: [ - "!== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: big !== small - }) - ], - tl: { - hd: [ - "!== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: small !== big - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.notequal(big, small) - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.notequal(small, big) - }) - ], - tl: { - hd: [ - "== operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.equal(big, small) - }) - ], - tl: { - hd: [ - "== operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.equal(small, big) - }) - ], - tl: { - hd: [ - "=== operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: big === small - }) - ], - tl: { - hd: [ - "=== operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: small === big - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - }; -} - -function isEqual(title, num1, num2) { - return { - hd: [ - "< operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.lessthan(num2, num1) - }) - ], - tl: { - hd: [ - "<= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessequal(num2, num1) - }) - ], - tl: { - hd: [ - "> operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.greaterthan(num1, num2) - }) - ], - tl: { - hd: [ - ">= operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterequal(num1, num2) - }) - ], - tl: { - hd: [ - "min: " + title, - param => ({ - TAG: "Eq", - _0: num1, - _1: Primitive_object.min(num1, num2) - }) - ], - tl: { - hd: [ - "max: " + title, - param => ({ - TAG: "Eq", - _0: num1, - _1: Primitive_object.max(num1, num2) - }) - ], - tl: { - hd: [ - "compare: " + title, - param => ({ - TAG: "Eq", - _0: 0, - _1: Primitive_object.compare(num1, num2) - }) - ], - tl: { - hd: [ - "compare: " + title, - param => ({ - TAG: "Eq", - _0: 0, - _1: Primitive_object.compare(num2, num1) - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: num1 !== num2 - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: num2 !== num1 - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.notequal(num1, num2) - }) - ], - tl: { - hd: [ - "!= operator: " + title, - param => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.notequal(num2, num1) - }) - ], - tl: { - hd: [ - "== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.equal(num1, num2) - }) - ], - tl: { - hd: [ - "== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.equal(num2, num1) - }) - ], - tl: { - hd: [ - "=== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: num1 === num2 - }) - ], - tl: { - hd: [ - "=== operator: " + title, - param => ({ - TAG: "Eq", - _0: true, - _1: num2 === num1 - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - }; -} - -let five = BigInt("5"); - -let suites = Pervasives.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), Pervasives.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); - -Mt.from_pair_suites("caml_compare_bigint_test.res", suites); - -exports.isLessThan = isLessThan; -exports.isEqual = isEqual; -exports.five = five; -exports.suites = suites; -/* five Not a pure module */ diff --git a/tests/tests/src/caml_compare_bigint_test.mjs b/tests/tests/src/caml_compare_bigint_test.mjs new file mode 100644 index 0000000000..f3edb1c6d2 --- /dev/null +++ b/tests/tests/src/caml_compare_bigint_test.mjs @@ -0,0 +1,367 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +function isLessThan(title, small, big) { + return { + hd: [ + "compare: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: big > small + }) + ], + tl: { + hd: [ + "compare: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: small < big + }) + ], + tl: { + hd: [ + "< operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(small, big) + }) + ], + tl: { + hd: [ + "<= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessequal(small, big) + }) + ], + tl: { + hd: [ + "> operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan(big, small) + }) + ], + tl: { + hd: [ + ">= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterequal(big, small) + }) + ], + tl: { + hd: [ + "min: " + title, + param => ({ + TAG: "Eq", + _0: small, + _1: Primitive_object.min(big, small) + }) + ], + tl: { + hd: [ + "min: " + title, + param => ({ + TAG: "Eq", + _0: small, + _1: Primitive_object.min(small, big) + }) + ], + tl: { + hd: [ + "max: " + title, + param => ({ + TAG: "Eq", + _0: big, + _1: Primitive_object.max(big, small) + }) + ], + tl: { + hd: [ + "max: " + title, + param => ({ + TAG: "Eq", + _0: big, + _1: Primitive_object.max(small, big) + }) + ], + tl: { + hd: [ + "!== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: big !== small + }) + ], + tl: { + hd: [ + "!== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: small !== big + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.notequal(big, small) + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.notequal(small, big) + }) + ], + tl: { + hd: [ + "== operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.equal(big, small) + }) + ], + tl: { + hd: [ + "== operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.equal(small, big) + }) + ], + tl: { + hd: [ + "=== operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: big === small + }) + ], + tl: { + hd: [ + "=== operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: small === big + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }; +} + +function isEqual(title, num1, num2) { + return { + hd: [ + "< operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.lessthan(num2, num1) + }) + ], + tl: { + hd: [ + "<= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessequal(num2, num1) + }) + ], + tl: { + hd: [ + "> operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.greaterthan(num1, num2) + }) + ], + tl: { + hd: [ + ">= operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterequal(num1, num2) + }) + ], + tl: { + hd: [ + "min: " + title, + param => ({ + TAG: "Eq", + _0: num1, + _1: Primitive_object.min(num1, num2) + }) + ], + tl: { + hd: [ + "max: " + title, + param => ({ + TAG: "Eq", + _0: num1, + _1: Primitive_object.max(num1, num2) + }) + ], + tl: { + hd: [ + "compare: " + title, + param => ({ + TAG: "Eq", + _0: 0, + _1: Primitive_object.compare(num1, num2) + }) + ], + tl: { + hd: [ + "compare: " + title, + param => ({ + TAG: "Eq", + _0: 0, + _1: Primitive_object.compare(num2, num1) + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: num1 !== num2 + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: num2 !== num1 + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.notequal(num1, num2) + }) + ], + tl: { + hd: [ + "!= operator: " + title, + param => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.notequal(num2, num1) + }) + ], + tl: { + hd: [ + "== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.equal(num1, num2) + }) + ], + tl: { + hd: [ + "== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.equal(num2, num1) + }) + ], + tl: { + hd: [ + "=== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: num1 === num2 + }) + ], + tl: { + hd: [ + "=== operator: " + title, + param => ({ + TAG: "Eq", + _0: true, + _1: num2 === num1 + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }; +} + +let five = BigInt("5"); + +let suites = Pervasives.$at(isLessThan("123 and 555555", BigInt("123"), BigInt("555555")), Pervasives.$at(isEqual("98765 and 98765", BigInt("98765"), BigInt("98765")), isEqual("same instance", five, five))); + +Mt.from_pair_suites("caml_compare_bigint_test.res", suites); + +export { + isLessThan, + isEqual, + five, + suites, +} +/* five Not a pure module */ diff --git a/tests/tests/src/caml_compare_test.js b/tests/tests/src/caml_compare_test.js deleted file mode 100644 index e29dfa0cc4..0000000000 --- a/tests/tests/src/caml_compare_test.js +++ /dev/null @@ -1,1051 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let function_equal_test; - -try { - function_equal_test = Primitive_object.equal(x => x + 1 | 0, x => x + 2 | 0); -} catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - function_equal_test = exn.RE_EXN_ID === "Invalid_argument" && exn._1 === "equal: functional value" ? true : false; -} - -let suites = { - contents: { - hd: [ - "File \"caml_compare_test.res\", line 12, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(undefined, 1) - }) - ], - tl: { - hd: [ - "option2", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(1, 2) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 14, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan({ - hd: 1, - tl: /* [] */0 - }, /* [] */0) - }) - ], - tl: { - hd: [ - "listeq", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.equal({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }) - }) - ], - tl: { - hd: [ - "listneq", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }, { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 2, - tl: /* [] */0 - } - } - }) - }) - ], - tl: { - hd: [ - "custom_u", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan([ - { - TAG: "A", - _0: 3 - }, - { - TAG: "B", - _0: 2, - _1: false - }, - { - TAG: "C", - _0: 1 - } - ], [ - { - TAG: "A", - _0: 3 - }, - { - TAG: "B", - _0: 2, - _1: false - }, - { - TAG: "C", - _0: 0 - } - ]) - }) - ], - tl: { - hd: [ - "custom_u2", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.equal([ - { - TAG: "A", - _0: 3 - }, - { - TAG: "B", - _0: 2, - _1: false - }, - { - TAG: "C", - _0: 1 - } - ], [ - { - TAG: "A", - _0: 3 - }, - { - TAG: "B", - _0: 2, - _1: false - }, - { - TAG: "C", - _0: 1 - } - ]) - }) - ], - tl: { - hd: [ - "function", - () => ({ - TAG: "Eq", - _0: true, - _1: function_equal_test - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 20, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(undefined, 1) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 21, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(undefined, [ - 1, - 30 - ]) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 22, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan([ - 1, - 30 - ], undefined) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 24, characters 6-13", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan({ - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } - } - } - } - } - } - }, { - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 409, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - }) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 27, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan({ - hd: 1, - tl: /* [] */0 - }, { - hd: 1, - tl: { - hd: 409, - tl: /* [] */0 - } - }) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 28, characters 5-12", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.lessthan(/* [] */0, { - hd: 409, - tl: /* [] */0 - }) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 30, characters 6-13", - () => ({ - TAG: "Eq", - _0: true, - _1: Primitive_object.greaterthan({ - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 409, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - }, { - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } - } - } - } - } - } - }) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 33, characters 5-12", - () => ({ - TAG: "Eq", - _0: false, - _1: false - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 34, characters 5-12", - () => ({ - TAG: "Eq", - _0: false, - _1: false - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 36, characters 6-13", - () => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.equal({ - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } - } - } - } - } - } - }, { - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 409, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - }) - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 40, characters 6-13", - () => ({ - TAG: "Eq", - _0: false, - _1: Primitive_object.equal({ - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 409, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - }, { - hd: 2, - tl: { - hd: 6, - tl: { - hd: 1, - tl: { - hd: 1, - tl: { - hd: 2, - tl: { - hd: 1, - tl: { - hd: 4, - tl: { - hd: 2, - tl: { - hd: 1, - tl: /* [] */0 - } - } - } - } - } - } - } - } - }) - }) - ], - tl: { - hd: [ - "cmp_id", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 1, - y: 2 - }, { - x: 1, - y: 2 - }), - _1: 0 - }) - ], - tl: { - hd: [ - "cmp_val", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 1 - }, { - x: 2 - }), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_val2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 2 - }, { - x: 1 - }), - _1: 1 - }) - ], - tl: { - hd: [ - "cmp_empty", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({}, {}), - _1: 0 - }) - ], - tl: { - hd: [ - "cmp_empty2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({}, {x:1}), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_swap", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 1, - y: 2 - }, { - y: 2, - x: 1 - }), - _1: 0 - }) - ], - tl: { - hd: [ - "cmp_size", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({x:1}, {x:1, y:2}), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_size2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({x:1, y:2}, {x:1}), - _1: 1 - }) - ], - tl: { - hd: [ - "cmp_order", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 0, - y: 1 - }, { - x: 1, - y: 0 - }), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_order2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: 1, - y: 0 - }, { - x: 0, - y: 1 - }), - _1: 1 - }) - ], - tl: { - hd: [ - "cmp_in_list", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - hd: { - x: 1 - }, - tl: /* [] */0 - }, { - hd: { - x: 2 - }, - tl: /* [] */0 - }), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_in_list2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - hd: { - x: 2 - }, - tl: /* [] */0 - }, { - hd: { - x: 1 - }, - tl: /* [] */0 - }), - _1: 1 - }) - ], - tl: { - hd: [ - "cmp_with_list", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: { - hd: 0, - tl: /* [] */0 - } - }, { - x: { - hd: 1, - tl: /* [] */0 - } - }), - _1: -1 - }) - ], - tl: { - hd: [ - "cmp_with_list2", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - x: { - hd: 1, - tl: /* [] */0 - } - }, { - x: { - hd: 0, - tl: /* [] */0 - } - }), - _1: 1 - }) - ], - tl: { - hd: [ - "eq_id", - () => ({ - TAG: "Ok", - _0: Primitive_object.equal({ - x: 1, - y: 2 - }, { - x: 1, - y: 2 - }) - }) - ], - tl: { - hd: [ - "eq_val", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - x: 1 - }, { - x: 2 - }), - _1: false - }) - ], - tl: { - hd: [ - "eq_val2", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - x: 2 - }, { - x: 1 - }), - _1: false - }) - ], - tl: { - hd: [ - "eq_empty", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({}, {}), - _1: true - }) - ], - tl: { - hd: [ - "eq_empty2", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({}, {x:1}), - _1: false - }) - ], - tl: { - hd: [ - "eq_swap", - () => ({ - TAG: "Ok", - _0: Primitive_object.equal({ - x: 1, - y: 2 - }, { - y: 2, - x: 1 - }) - }) - ], - tl: { - hd: [ - "eq_size", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({x:1}, {x:1, y:2}), - _1: false - }) - ], - tl: { - hd: [ - "eq_size2", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({x:1, y:2}, {x:1}), - _1: false - }) - ], - tl: { - hd: [ - "eq_in_list", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - hd: { - x: 1 - }, - tl: /* [] */0 - }, { - hd: { - x: 2 - }, - tl: /* [] */0 - }), - _1: false - }) - ], - tl: { - hd: [ - "eq_in_list2", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - hd: { - x: 2 - }, - tl: /* [] */0 - }, { - hd: { - x: 2 - }, - tl: /* [] */0 - }), - _1: true - }) - ], - tl: { - hd: [ - "eq_with_list", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - x: { - hd: 0, - tl: /* [] */0 - } - }, { - x: { - hd: 0, - tl: /* [] */0 - } - }), - _1: true - }) - ], - tl: { - hd: [ - "eq_with_list2", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({ - x: { - hd: 0, - tl: /* [] */0 - } - }, { - x: { - hd: 1, - tl: /* [] */0 - } - }), - _1: false - }) - ], - tl: { - hd: [ - "eq_no_prototype", - () => ({ - TAG: "Eq", - _0: Primitive_object.equal({x:1}, ((function(){let o = Object.create(null);o.x = 1;return o;})())), - _1: true - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 76, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare(null, { - hd: 3, - tl: /* [] */0 - }), - _1: -1 - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 77, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare({ - hd: 3, - tl: /* [] */0 - }, null), - _1: 1 - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 78, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare(null, 0), - _1: -1 - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 79, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare(0, null), - _1: 1 - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 80, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare(undefined, 0), - _1: -1 - }) - ], - tl: { - hd: [ - "File \"caml_compare_test.res\", line 81, characters 5-12", - () => ({ - TAG: "Eq", - _0: Primitive_object.compare(0, undefined), - _1: 1 - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -eq("File \"caml_compare_test.res\", line 88, characters 3-10", true, Primitive_object.greaterthan(1, undefined)); - -eq("File \"caml_compare_test.res\", line 89, characters 3-10", true, Primitive_object.lessthan(/* [] */0, { - hd: 1, - tl: /* [] */0 -})); - -eq("File \"caml_compare_test.res\", line 90, characters 3-10", false, Primitive_object.greaterthan(undefined, 1)); - -eq("File \"caml_compare_test.res\", line 91, characters 3-10", false, Primitive_object.greaterthan(undefined, [ - 1, - 30 -])); - -eq("File \"caml_compare_test.res\", line 92, characters 3-10", false, Primitive_object.lessthan([ - 1, - 30 -], undefined)); - -Mt.from_pair_suites("Caml_compare_test", suites.contents); - -exports.function_equal_test = function_equal_test; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* function_equal_test Not a pure module */ diff --git a/tests/tests/src/caml_compare_test.mjs b/tests/tests/src/caml_compare_test.mjs new file mode 100644 index 0000000000..073733b27f --- /dev/null +++ b/tests/tests/src/caml_compare_test.mjs @@ -0,0 +1,1052 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let function_equal_test; + +try { + function_equal_test = Primitive_object.equal(x => x + 1 | 0, x => x + 2 | 0); +} catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + function_equal_test = exn.RE_EXN_ID === "Invalid_argument" && exn._1 === "equal: functional value" ? true : false; +} + +let suites = { + contents: { + hd: [ + "File \"caml_compare_test.res\", line 12, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(undefined, 1) + }) + ], + tl: { + hd: [ + "option2", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(1, 2) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 14, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan({ + hd: 1, + tl: /* [] */0 + }, /* [] */0) + }) + ], + tl: { + hd: [ + "listeq", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.equal({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }) + }) + ], + tl: { + hd: [ + "listneq", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } + }, { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 2, + tl: /* [] */0 + } + } + }) + }) + ], + tl: { + hd: [ + "custom_u", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan([ + { + TAG: "A", + _0: 3 + }, + { + TAG: "B", + _0: 2, + _1: false + }, + { + TAG: "C", + _0: 1 + } + ], [ + { + TAG: "A", + _0: 3 + }, + { + TAG: "B", + _0: 2, + _1: false + }, + { + TAG: "C", + _0: 0 + } + ]) + }) + ], + tl: { + hd: [ + "custom_u2", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.equal([ + { + TAG: "A", + _0: 3 + }, + { + TAG: "B", + _0: 2, + _1: false + }, + { + TAG: "C", + _0: 1 + } + ], [ + { + TAG: "A", + _0: 3 + }, + { + TAG: "B", + _0: 2, + _1: false + }, + { + TAG: "C", + _0: 1 + } + ]) + }) + ], + tl: { + hd: [ + "function", + () => ({ + TAG: "Eq", + _0: true, + _1: function_equal_test + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 20, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(undefined, 1) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 21, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(undefined, [ + 1, + 30 + ]) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 22, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan([ + 1, + 30 + ], undefined) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 24, characters 6-13", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan({ + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + } + } + } + } + } + }, { + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 409, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + }) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 27, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan({ + hd: 1, + tl: /* [] */0 + }, { + hd: 1, + tl: { + hd: 409, + tl: /* [] */0 + } + }) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 28, characters 5-12", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.lessthan(/* [] */0, { + hd: 409, + tl: /* [] */0 + }) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 30, characters 6-13", + () => ({ + TAG: "Eq", + _0: true, + _1: Primitive_object.greaterthan({ + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 409, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + }, { + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + } + } + } + } + } + }) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 33, characters 5-12", + () => ({ + TAG: "Eq", + _0: false, + _1: false + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 34, characters 5-12", + () => ({ + TAG: "Eq", + _0: false, + _1: false + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 36, characters 6-13", + () => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.equal({ + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + } + } + } + } + } + }, { + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 409, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + }) + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 40, characters 6-13", + () => ({ + TAG: "Eq", + _0: false, + _1: Primitive_object.equal({ + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 409, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + }, { + hd: 2, + tl: { + hd: 6, + tl: { + hd: 1, + tl: { + hd: 1, + tl: { + hd: 2, + tl: { + hd: 1, + tl: { + hd: 4, + tl: { + hd: 2, + tl: { + hd: 1, + tl: /* [] */0 + } + } + } + } + } + } + } + } + }) + }) + ], + tl: { + hd: [ + "cmp_id", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 1, + y: 2 + }, { + x: 1, + y: 2 + }), + _1: 0 + }) + ], + tl: { + hd: [ + "cmp_val", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 1 + }, { + x: 2 + }), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_val2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 2 + }, { + x: 1 + }), + _1: 1 + }) + ], + tl: { + hd: [ + "cmp_empty", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({}, {}), + _1: 0 + }) + ], + tl: { + hd: [ + "cmp_empty2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({}, {x:1}), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_swap", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 1, + y: 2 + }, { + y: 2, + x: 1 + }), + _1: 0 + }) + ], + tl: { + hd: [ + "cmp_size", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({x:1}, {x:1, y:2}), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_size2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({x:1, y:2}, {x:1}), + _1: 1 + }) + ], + tl: { + hd: [ + "cmp_order", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 0, + y: 1 + }, { + x: 1, + y: 0 + }), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_order2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: 1, + y: 0 + }, { + x: 0, + y: 1 + }), + _1: 1 + }) + ], + tl: { + hd: [ + "cmp_in_list", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + hd: { + x: 1 + }, + tl: /* [] */0 + }, { + hd: { + x: 2 + }, + tl: /* [] */0 + }), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_in_list2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + hd: { + x: 2 + }, + tl: /* [] */0 + }, { + hd: { + x: 1 + }, + tl: /* [] */0 + }), + _1: 1 + }) + ], + tl: { + hd: [ + "cmp_with_list", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: { + hd: 0, + tl: /* [] */0 + } + }, { + x: { + hd: 1, + tl: /* [] */0 + } + }), + _1: -1 + }) + ], + tl: { + hd: [ + "cmp_with_list2", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + x: { + hd: 1, + tl: /* [] */0 + } + }, { + x: { + hd: 0, + tl: /* [] */0 + } + }), + _1: 1 + }) + ], + tl: { + hd: [ + "eq_id", + () => ({ + TAG: "Ok", + _0: Primitive_object.equal({ + x: 1, + y: 2 + }, { + x: 1, + y: 2 + }) + }) + ], + tl: { + hd: [ + "eq_val", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + x: 1 + }, { + x: 2 + }), + _1: false + }) + ], + tl: { + hd: [ + "eq_val2", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + x: 2 + }, { + x: 1 + }), + _1: false + }) + ], + tl: { + hd: [ + "eq_empty", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({}, {}), + _1: true + }) + ], + tl: { + hd: [ + "eq_empty2", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({}, {x:1}), + _1: false + }) + ], + tl: { + hd: [ + "eq_swap", + () => ({ + TAG: "Ok", + _0: Primitive_object.equal({ + x: 1, + y: 2 + }, { + y: 2, + x: 1 + }) + }) + ], + tl: { + hd: [ + "eq_size", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({x:1}, {x:1, y:2}), + _1: false + }) + ], + tl: { + hd: [ + "eq_size2", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({x:1, y:2}, {x:1}), + _1: false + }) + ], + tl: { + hd: [ + "eq_in_list", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + hd: { + x: 1 + }, + tl: /* [] */0 + }, { + hd: { + x: 2 + }, + tl: /* [] */0 + }), + _1: false + }) + ], + tl: { + hd: [ + "eq_in_list2", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + hd: { + x: 2 + }, + tl: /* [] */0 + }, { + hd: { + x: 2 + }, + tl: /* [] */0 + }), + _1: true + }) + ], + tl: { + hd: [ + "eq_with_list", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + x: { + hd: 0, + tl: /* [] */0 + } + }, { + x: { + hd: 0, + tl: /* [] */0 + } + }), + _1: true + }) + ], + tl: { + hd: [ + "eq_with_list2", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({ + x: { + hd: 0, + tl: /* [] */0 + } + }, { + x: { + hd: 1, + tl: /* [] */0 + } + }), + _1: false + }) + ], + tl: { + hd: [ + "eq_no_prototype", + () => ({ + TAG: "Eq", + _0: Primitive_object.equal({x:1}, ((function(){let o = Object.create(null);o.x = 1;return o;})())), + _1: true + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 76, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare(null, { + hd: 3, + tl: /* [] */0 + }), + _1: -1 + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 77, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare({ + hd: 3, + tl: /* [] */0 + }, null), + _1: 1 + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 78, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare(null, 0), + _1: -1 + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 79, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare(0, null), + _1: 1 + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 80, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare(undefined, 0), + _1: -1 + }) + ], + tl: { + hd: [ + "File \"caml_compare_test.res\", line 81, characters 5-12", + () => ({ + TAG: "Eq", + _0: Primitive_object.compare(0, undefined), + _1: 1 + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +eq("File \"caml_compare_test.res\", line 88, characters 3-10", true, Primitive_object.greaterthan(1, undefined)); + +eq("File \"caml_compare_test.res\", line 89, characters 3-10", true, Primitive_object.lessthan(/* [] */0, { + hd: 1, + tl: /* [] */0 +})); + +eq("File \"caml_compare_test.res\", line 90, characters 3-10", false, Primitive_object.greaterthan(undefined, 1)); + +eq("File \"caml_compare_test.res\", line 91, characters 3-10", false, Primitive_object.greaterthan(undefined, [ + 1, + 30 +])); + +eq("File \"caml_compare_test.res\", line 92, characters 3-10", false, Primitive_object.lessthan([ + 1, + 30 +], undefined)); + +Mt.from_pair_suites("Caml_compare_test", suites.contents); + +export { + function_equal_test, + suites, + test_id, + eq, +} +/* function_equal_test Not a pure module */ diff --git a/tests/tests/src/chain_code_test.js b/tests/tests/src/chain_code_test.js deleted file mode 100644 index b00658505f..0000000000 --- a/tests/tests/src/chain_code_test.js +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f(h) { - return h.x.y.z; -} - -function f2(h) { - return h.x.y.z; -} - -function f3(h, x, y) { - return h.paint(x, y).draw(x, y); -} - -function f4(h, x, y) { - h.paint = [ - x, - y - ]; - h.paint.draw = [ - x, - y - ]; -} - -eq("File \"chain_code_test.res\", line 27, characters 12-19", 32, ({ - x: { - y: { - z: 32 - } - } -}).x.y.z); - -Mt.from_pair_suites("Chain_code_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -/* Not a pure module */ diff --git a/tests/tests/src/chain_code_test.mjs b/tests/tests/src/chain_code_test.mjs new file mode 100644 index 0000000000..8b817cb815 --- /dev/null +++ b/tests/tests/src/chain_code_test.mjs @@ -0,0 +1,70 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f(h) { + return h.x.y.z; +} + +function f2(h) { + return h.x.y.z; +} + +function f3(h, x, y) { + return h.paint(x, y).draw(x, y); +} + +function f4(h, x, y) { + h.paint = [ + x, + y + ]; + h.paint.draw = [ + x, + y + ]; +} + +eq("File \"chain_code_test.res\", line 27, characters 12-19", 32, ({ + x: { + y: { + z: 32 + } + } +}).x.y.z); + +Mt.from_pair_suites("Chain_code_test", suites.contents); + +export { + suites, + test_id, + eq, + f, + f2, + f3, + f4, +} +/* Not a pure module */ diff --git a/tests/tests/src/chn_test.js b/tests/tests/src/chn_test.js deleted file mode 100644 index 97e5f6699e..0000000000 --- a/tests/tests/src/chn_test.js +++ /dev/null @@ -1,276 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -console.log("你好,\n世界"); - -console.log("\x3f\u003f\b\t\n\v\f\r\0\"'"); - -function convert(s) { - return Belt_List.fromArray(Array.from(s, x => { - let x$1 = x.codePointAt(0); - if (x$1 !== undefined) { - return x$1; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "chn_test.res", - 24, - 16 - ], - Error: new Error() - }; - })); -} - -eq("File \"chn_test.res\", line 32, characters 4-11", "你好,\n世界", "你好,\n世界"); - -eq("File \"chn_test.res\", line 38, characters 4-11", convert("汉字是世界上最美丽的character"), { - hd: 27721, - tl: { - hd: 23383, - tl: { - hd: 26159, - tl: { - hd: 19990, - tl: { - hd: 30028, - tl: { - hd: 19978, - tl: { - hd: 26368, - tl: { - hd: 32654, - tl: { - hd: 20029, - tl: { - hd: 30340, - tl: { - hd: 99, - tl: { - hd: 104, - tl: { - hd: 97, - tl: { - hd: 114, - tl: { - hd: 97, - tl: { - hd: 99, - tl: { - hd: 116, - tl: { - hd: 101, - tl: { - hd: 114, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}); - -eq("File \"chn_test.res\", line 62, characters 5-12", convert("\x3f\x3fa"), { - hd: 63, - tl: { - hd: 63, - tl: { - hd: 97, - tl: /* [] */0 - } - } -}); - -eq("File \"chn_test.res\", line 63, characters 5-12", convert("??a"), { - hd: 63, - tl: { - hd: 63, - tl: { - hd: 97, - tl: /* [] */0 - } - } -}); - -eq("File \"chn_test.res\", line 64, characters 5-12", convert("\u003f\x3fa"), { - hd: 63, - tl: { - hd: 63, - tl: { - hd: 97, - tl: /* [] */0 - } - } -}); - -eq("File \"chn_test.res\", line 65, characters 5-12", convert("🚀🚀a"), { - hd: 128640, - tl: { - hd: 128640, - tl: { - hd: 97, - tl: /* [] */0 - } - } -}); - -eq("File \"chn_test.res\", line 66, characters 5-12", convert("\uD83D\uDE80a"), { - hd: 128640, - tl: { - hd: 97, - tl: /* [] */0 - } -}); - -eq("File \"chn_test.res\", line 67, characters 5-12", convert("\uD83D\uDE80\x3f"), { - hd: 128640, - tl: { - hd: 63, - tl: /* [] */0 - } -}); - -eq("File \"chn_test.res\", line 71, characters 5-12", convert("\uD83D\uDE80\uD83D\uDE80a"), { - hd: 128640, - tl: { - hd: 128640, - tl: { - hd: 97, - tl: /* [] */0 - } - } -}); - -eq("No inline string length", "\uD83D\uDE80\0".length, 3); - -eq("File \"chn_test.res\", line 78, characters 4-11", "\uD83D\uDE80\0".codePointAt(0), 128640); - -eq("File \"chn_test.res\", line 83, characters 5-12", "🚀".codePointAt(0), 128640); - -eq("File \"chn_test.res\", line 88, characters 5-12", convert("\uD83D\uDE80"), { - hd: 128640, - tl: /* [] */0 -}); - -eq("File \"chn_test.res\", line 89, characters 5-12", convert("\uD83D\uDE80\uD83D\uDE80"), { - hd: 128640, - tl: { - hd: 128640, - tl: /* [] */0 - } -}); - -eq("File \"chn_test.res\", line 90, characters 5-12", convert(" \b\t\n\v\f\ra"), { - hd: 32, - tl: { - hd: 8, - tl: { - hd: 9, - tl: { - hd: 10, - tl: { - hd: 11, - tl: { - hd: 12, - tl: { - hd: 13, - tl: { - hd: 97, - tl: /* [] */0 - } - } - } - } - } - } - } -}); - -eq("File \"chn_test.res\", line 96, characters 5-12", convert(" \b\t\n\v\f\r\"'\\\0a"), { - hd: 32, - tl: { - hd: 8, - tl: { - hd: 9, - tl: { - hd: 10, - tl: { - hd: 11, - tl: { - hd: 12, - tl: { - hd: 13, - tl: { - hd: 34, - tl: { - hd: 39, - tl: { - hd: 92, - tl: { - hd: 0, - tl: { - hd: 97, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } -}); - -Mt.from_pair_suites("Chn_test", suites.contents); - -let $$String; - -exports.$$String = $$String; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.convert = convert; -/* Not a pure module */ diff --git a/tests/tests/src/chn_test.mjs b/tests/tests/src/chn_test.mjs new file mode 100644 index 0000000000..5a56ac3cb6 --- /dev/null +++ b/tests/tests/src/chn_test.mjs @@ -0,0 +1,277 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +console.log("你好,\n世界"); + +console.log("\x3f\u003f\b\t\n\v\f\r\0\"'"); + +function convert(s) { + return Belt_List.fromArray(Array.from(s, x => { + let x$1 = x.codePointAt(0); + if (x$1 !== undefined) { + return x$1; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "chn_test.res", + 24, + 16 + ], + Error: new Error() + }; + })); +} + +eq("File \"chn_test.res\", line 32, characters 4-11", "你好,\n世界", "你好,\n世界"); + +eq("File \"chn_test.res\", line 38, characters 4-11", convert("汉字是世界上最美丽的character"), { + hd: 27721, + tl: { + hd: 23383, + tl: { + hd: 26159, + tl: { + hd: 19990, + tl: { + hd: 30028, + tl: { + hd: 19978, + tl: { + hd: 26368, + tl: { + hd: 32654, + tl: { + hd: 20029, + tl: { + hd: 30340, + tl: { + hd: 99, + tl: { + hd: 104, + tl: { + hd: 97, + tl: { + hd: 114, + tl: { + hd: 97, + tl: { + hd: 99, + tl: { + hd: 116, + tl: { + hd: 101, + tl: { + hd: 114, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}); + +eq("File \"chn_test.res\", line 62, characters 5-12", convert("\x3f\x3fa"), { + hd: 63, + tl: { + hd: 63, + tl: { + hd: 97, + tl: /* [] */0 + } + } +}); + +eq("File \"chn_test.res\", line 63, characters 5-12", convert("??a"), { + hd: 63, + tl: { + hd: 63, + tl: { + hd: 97, + tl: /* [] */0 + } + } +}); + +eq("File \"chn_test.res\", line 64, characters 5-12", convert("\u003f\x3fa"), { + hd: 63, + tl: { + hd: 63, + tl: { + hd: 97, + tl: /* [] */0 + } + } +}); + +eq("File \"chn_test.res\", line 65, characters 5-12", convert("🚀🚀a"), { + hd: 128640, + tl: { + hd: 128640, + tl: { + hd: 97, + tl: /* [] */0 + } + } +}); + +eq("File \"chn_test.res\", line 66, characters 5-12", convert("\uD83D\uDE80a"), { + hd: 128640, + tl: { + hd: 97, + tl: /* [] */0 + } +}); + +eq("File \"chn_test.res\", line 67, characters 5-12", convert("\uD83D\uDE80\x3f"), { + hd: 128640, + tl: { + hd: 63, + tl: /* [] */0 + } +}); + +eq("File \"chn_test.res\", line 71, characters 5-12", convert("\uD83D\uDE80\uD83D\uDE80a"), { + hd: 128640, + tl: { + hd: 128640, + tl: { + hd: 97, + tl: /* [] */0 + } + } +}); + +eq("No inline string length", "\uD83D\uDE80\0".length, 3); + +eq("File \"chn_test.res\", line 78, characters 4-11", "\uD83D\uDE80\0".codePointAt(0), 128640); + +eq("File \"chn_test.res\", line 83, characters 5-12", "🚀".codePointAt(0), 128640); + +eq("File \"chn_test.res\", line 88, characters 5-12", convert("\uD83D\uDE80"), { + hd: 128640, + tl: /* [] */0 +}); + +eq("File \"chn_test.res\", line 89, characters 5-12", convert("\uD83D\uDE80\uD83D\uDE80"), { + hd: 128640, + tl: { + hd: 128640, + tl: /* [] */0 + } +}); + +eq("File \"chn_test.res\", line 90, characters 5-12", convert(" \b\t\n\v\f\ra"), { + hd: 32, + tl: { + hd: 8, + tl: { + hd: 9, + tl: { + hd: 10, + tl: { + hd: 11, + tl: { + hd: 12, + tl: { + hd: 13, + tl: { + hd: 97, + tl: /* [] */0 + } + } + } + } + } + } + } +}); + +eq("File \"chn_test.res\", line 96, characters 5-12", convert(" \b\t\n\v\f\r\"'\\\0a"), { + hd: 32, + tl: { + hd: 8, + tl: { + hd: 9, + tl: { + hd: 10, + tl: { + hd: 11, + tl: { + hd: 12, + tl: { + hd: 13, + tl: { + hd: 34, + tl: { + hd: 39, + tl: { + hd: 92, + tl: { + hd: 0, + tl: { + hd: 97, + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } +}); + +Mt.from_pair_suites("Chn_test", suites.contents); + +let $$String; + +export { + $$String, + suites, + test_id, + eq, + convert, +} +/* Not a pure module */ diff --git a/tests/tests/src/class_type_ffi_test.js b/tests/tests/src/class_type_ffi_test.js deleted file mode 100644 index ad02e32fbc..0000000000 --- a/tests/tests/src/class_type_ffi_test.js +++ /dev/null @@ -1,30 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function test_set(x) { - x.length__aux = 3; -} - -function ff(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { - return fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); -} - -function ff2(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { - return fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); -} - -function off2(o, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { - return o.huge_method(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); -} - -function mk_f() { - return (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => a0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); -} - -exports.test_set = test_set; -exports.ff = ff; -exports.ff2 = ff2; -exports.off2 = off2; -exports.mk_f = mk_f; -/* No side effect */ diff --git a/tests/tests/src/class_type_ffi_test.mjs b/tests/tests/src/class_type_ffi_test.mjs new file mode 100644 index 0000000000..90ec60a23b --- /dev/null +++ b/tests/tests/src/class_type_ffi_test.mjs @@ -0,0 +1,31 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function test_set(x) { + x.length__aux = 3; +} + +function ff(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { + return fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); +} + +function ff2(fn, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { + return fn(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); +} + +function off2(o, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { + return o.huge_method(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); +} + +function mk_f() { + return (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => a0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); +} + +export { + test_set, + ff, + ff2, + off2, + mk_f, +} +/* No side effect */ diff --git a/tests/tests/src/coercion_module_alias_test.js b/tests/tests/src/coercion_module_alias_test.js deleted file mode 100644 index c64cadd3d1..0000000000 --- a/tests/tests/src/coercion_module_alias_test.js +++ /dev/null @@ -1,210 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Char = require("rescript/lib/js/Char.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -function l(prim) { - console.log(prim); -} - -let C$p = Char; - -console.log(66); - -console.log(66); - -let C3 = Char; - -console.log(66); - -let f = Belt_List.length; - -function g(x) { - return Belt_List.length(Belt_List.map(x, prim => prim + 1 | 0)); -} - -function F(X) { - return Char; -} - -let C4 = Char; - -console.log(66); - -function G(X) { - return X; -} - -let M = {}; - -let N = { - x: 1 -}; - -let N$p; - -let M$p = { - N: N, - N$p: N$p -}; - -console.log(1); - -let M$p$p = { - N$p: N -}; - -console.log(M$p$p.N$p.x); - -let M2 = { - N: N, - N$p: N$p -}; - -let M3 = { - N$p: N -}; - -console.log(1); - -let M3$p = { - N$p: N -}; - -console.log(M3$p.N$p.x); - -let N$1 = { - x: 1 -}; - -let M4 = { - N$p: N$1 -}; - -console.log(1); - -function F0(X) { - let N = { - x: 1 - }; - return { - N: N, - N$p: undefined - }; -} - -let N$2 = { - x: 1 -}; - -let M5 = { - N$p: N$2 -}; - -console.log(M5.N$p.x); - -let D = { - y: 3 -}; - -let N$3 = { - x: 1 -}; - -let N$p$1; - -let M6 = { - D: D, - N: N$3, - N$p: N$p$1 -}; - -console.log(1); - -let M7 = { - N$p: N$3 -}; - -console.log(M7.N$p.x); - -console.log(1); - -let C$p$1; - -let M8 = { - C: undefined, - C$p: C$p$1 -}; - -let M9_C = { - chr: prim => prim -}; - -let M9 = { - C: M9_C, - C$p: C$p$1 -}; - -let prim = M9_C.chr(66); - -console.log(prim); - -let M10 = { - C$p: { - chr: prim => prim - } -}; - -let prim$1 = M10.C$p.chr(66); - -console.log(prim$1); - -let C; - -let C$p$p$p = C$p; - -let C$p$p = Char; - -function G0(funarg) { - let N = { - x: 1 - }; - return { - N$p: N - }; -} - -let M1 = { - N: N$3, - N$p: N$p$1 -}; - -exports.l = l; -exports.C = C; -exports.C$p = C$p; -exports.C$p$p$p = C$p$p$p; -exports.C$p$p = C$p$p; -exports.C3 = C3; -exports.f = f; -exports.g = g; -exports.F = F; -exports.C4 = C4; -exports.G = G; -exports.M = M; -exports.M$p = M$p; -exports.M$p$p = M$p$p; -exports.M2 = M2; -exports.M3 = M3; -exports.M3$p = M3$p; -exports.M4 = M4; -exports.F0 = F0; -exports.G0 = G0; -exports.M5 = M5; -exports.M6 = M6; -exports.M1 = M1; -exports.M7 = M7; -exports.M8 = M8; -exports.M9 = M9; -exports.M10 = M10; -/* Not a pure module */ diff --git a/tests/tests/src/coercion_module_alias_test.mjs b/tests/tests/src/coercion_module_alias_test.mjs new file mode 100644 index 0000000000..d8615b6cdd --- /dev/null +++ b/tests/tests/src/coercion_module_alias_test.mjs @@ -0,0 +1,211 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Char from "rescript/lib/es6/Char.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +function l(prim) { + console.log(prim); +} + +let C$p = Char; + +console.log(66); + +console.log(66); + +let C3 = Char; + +console.log(66); + +let f = Belt_List.length; + +function g(x) { + return Belt_List.length(Belt_List.map(x, prim => prim + 1 | 0)); +} + +function F(X) { + return Char; +} + +let C4 = Char; + +console.log(66); + +function G(X) { + return X; +} + +let M = {}; + +let N = { + x: 1 +}; + +let N$p; + +let M$p = { + N: N, + N$p: N$p +}; + +console.log(1); + +let M$p$p = { + N$p: N +}; + +console.log(M$p$p.N$p.x); + +let M2 = { + N: N, + N$p: N$p +}; + +let M3 = { + N$p: N +}; + +console.log(1); + +let M3$p = { + N$p: N +}; + +console.log(M3$p.N$p.x); + +let N$1 = { + x: 1 +}; + +let M4 = { + N$p: N$1 +}; + +console.log(1); + +function F0(X) { + let N = { + x: 1 + }; + return { + N: N, + N$p: undefined + }; +} + +let N$2 = { + x: 1 +}; + +let M5 = { + N$p: N$2 +}; + +console.log(M5.N$p.x); + +let D = { + y: 3 +}; + +let N$3 = { + x: 1 +}; + +let N$p$1; + +let M6 = { + D: D, + N: N$3, + N$p: N$p$1 +}; + +console.log(1); + +let M7 = { + N$p: N$3 +}; + +console.log(M7.N$p.x); + +console.log(1); + +let C$p$1; + +let M8 = { + C: undefined, + C$p: C$p$1 +}; + +let M9_C = { + chr: prim => prim +}; + +let M9 = { + C: M9_C, + C$p: C$p$1 +}; + +let prim = M9_C.chr(66); + +console.log(prim); + +let M10 = { + C$p: { + chr: prim => prim + } +}; + +let prim$1 = M10.C$p.chr(66); + +console.log(prim$1); + +let C; + +let C$p$p$p = C$p; + +let C$p$p = Char; + +function G0(funarg) { + let N = { + x: 1 + }; + return { + N$p: N + }; +} + +let M1 = { + N: N$3, + N$p: N$p$1 +}; + +export { + l, + C, + C$p, + C$p$p$p, + C$p$p, + C3, + f, + g, + F, + C4, + G, + M, + M$p, + M$p$p, + M2, + M3, + M3$p, + M4, + F0, + G0, + M5, + M6, + M1, + M7, + M8, + M9, + M10, +} +/* Not a pure module */ diff --git a/tests/tests/src/compare_test.js b/tests/tests/src/compare_test.js deleted file mode 100644 index 4b4c6e86ea..0000000000 --- a/tests/tests/src/compare_test.js +++ /dev/null @@ -1,52 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function compare(x, y) { - switch (x) { - case "A" : - return y === "A"; - case "B" : - return y === "B"; - case "C" : - return y === "C"; - } -} - -function compare2(x, y) { - switch (x) { - case "A" : - switch (y) { - case "A" : - return true; - case "B" : - case "C" : - return false; - } - case "B" : - switch (y) { - case "B" : - return true; - case "A" : - case "C" : - return false; - } - case "C" : - switch (y) { - case "A" : - case "B" : - return false; - case "C" : - return true; - } - } -} - -function compare3(x, y) { - return x === y; -} - -exports.compare = compare; -exports.compare2 = compare2; -exports.compare3 = compare3; -/* No side effect */ diff --git a/tests/tests/src/compare_test.mjs b/tests/tests/src/compare_test.mjs new file mode 100644 index 0000000000..4ce42f1021 --- /dev/null +++ b/tests/tests/src/compare_test.mjs @@ -0,0 +1,53 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function compare(x, y) { + switch (x) { + case "A" : + return y === "A"; + case "B" : + return y === "B"; + case "C" : + return y === "C"; + } +} + +function compare2(x, y) { + switch (x) { + case "A" : + switch (y) { + case "A" : + return true; + case "B" : + case "C" : + return false; + } + case "B" : + switch (y) { + case "B" : + return true; + case "A" : + case "C" : + return false; + } + case "C" : + switch (y) { + case "A" : + case "B" : + return false; + case "C" : + return true; + } + } +} + +function compare3(x, y) { + return x === y; +} + +export { + compare, + compare2, + compare3, +} +/* No side effect */ diff --git a/tests/tests/src/complete_parmatch_test.js b/tests/tests/src/complete_parmatch_test.js deleted file mode 100644 index 6abcb4081f..0000000000 --- a/tests/tests/src/complete_parmatch_test.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - switch (x) { - case 1 : - return /* 'a' */97; - case 2 : - return /* 'b' */98; - case 3 : - return /* 'c' */99; - default: - return /* 'x' */120; - } -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/complete_parmatch_test.mjs b/tests/tests/src/complete_parmatch_test.mjs new file mode 100644 index 0000000000..89cada93e2 --- /dev/null +++ b/tests/tests/src/complete_parmatch_test.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + switch (x) { + case 1 : + return /* 'a' */97; + case 2 : + return /* 'b' */98; + case 3 : + return /* 'c' */99; + default: + return /* 'x' */120; + } +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/complex_while_loop.js b/tests/tests/src/complex_while_loop.js deleted file mode 100644 index cd4fa0c7eb..0000000000 --- a/tests/tests/src/complex_while_loop.js +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f() { - let n = 0; - while ((() => { - let fib = x => { - if (x === 0 || x === 1) { - return 1; - } else { - return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; - } - }; - return fib(n) > 10; - })()) { - console.log(n.toString()); - n = n + 1 | 0; - }; -} - -function ff() { - while ((() => { - let b = 9; - return (3 + b | 0) > 10; - })()) { - - }; -} - -exports.f = f; -exports.ff = ff; -/* No side effect */ diff --git a/tests/tests/src/complex_while_loop.mjs b/tests/tests/src/complex_while_loop.mjs new file mode 100644 index 0000000000..5fd9b2aa27 --- /dev/null +++ b/tests/tests/src/complex_while_loop.mjs @@ -0,0 +1,34 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f() { + let n = 0; + while ((() => { + let fib = x => { + if (x === 0 || x === 1) { + return 1; + } else { + return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; + } + }; + return fib(n) > 10; + })()) { + console.log(n.toString()); + n = n + 1 | 0; + }; +} + +function ff() { + while ((() => { + let b = 9; + return (3 + b | 0) > 10; + })()) { + + }; +} + +export { + f, + ff, +} +/* No side effect */ diff --git a/tests/tests/src/condition_compilation_test.js b/tests/tests/src/condition_compilation_test.js deleted file mode 100644 index 5bca8c3fab..0000000000 --- a/tests/tests/src/condition_compilation_test.js +++ /dev/null @@ -1,66 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let v = { - contents: 1 -}; - -v.contents = v.contents + 1 | 0; - -let a = v.contents; - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"condition_compilation_test.res\", line 63, characters 5-12", 3, 3); - -eq("File \"condition_compilation_test.res\", line 64, characters 5-12", v.contents, 2); - -Mt.from_pair_suites("Condition_compilation_test", suites.contents); - -let b = "u"; - -let buffer_size = 1; - -let vv = 3; - -let version_gt_3 = true; - -let version = -1; - -let ocaml_veriosn = "unknown"; - -exports.b = b; -exports.buffer_size = buffer_size; -exports.vv = vv; -exports.v = v; -exports.a = a; -exports.version_gt_3 = version_gt_3; -exports.version = version; -exports.ocaml_veriosn = ocaml_veriosn; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/condition_compilation_test.mjs b/tests/tests/src/condition_compilation_test.mjs new file mode 100644 index 0000000000..533679e9e7 --- /dev/null +++ b/tests/tests/src/condition_compilation_test.mjs @@ -0,0 +1,67 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let v = { + contents: 1 +}; + +v.contents = v.contents + 1 | 0; + +let a = v.contents; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"condition_compilation_test.res\", line 63, characters 5-12", 3, 3); + +eq("File \"condition_compilation_test.res\", line 64, characters 5-12", v.contents, 2); + +Mt.from_pair_suites("Condition_compilation_test", suites.contents); + +let b = "u"; + +let buffer_size = 1; + +let vv = 3; + +let version_gt_3 = true; + +let version = -1; + +let ocaml_veriosn = "unknown"; + +export { + b, + buffer_size, + vv, + v, + a, + version_gt_3, + version, + ocaml_veriosn, + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/conditional/cond_a.js b/tests/tests/src/conditional/cond_a.js deleted file mode 100644 index 654be840bb..0000000000 --- a/tests/tests/src/conditional/cond_a.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "cond_a.res", - 1, - 8 - ], - Error: new Error() -}; - -exports.u = u; -/* u Not a pure module */ diff --git a/tests/tests/src/conditional/cond_a.mjs b/tests/tests/src/conditional/cond_a.mjs new file mode 100644 index 0000000000..7eea77289a --- /dev/null +++ b/tests/tests/src/conditional/cond_a.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "cond_a.res", + 1, + 8 + ], + Error: new Error() +}; + +export { + u, +} +/* u Not a pure module */ diff --git a/tests/tests/src/conditional/cond_a_B.js b/tests/tests/src/conditional/cond_a_B.js deleted file mode 100644 index c5a52052e0..0000000000 --- a/tests/tests/src/conditional/cond_a_B.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let B = { - value: 3 -}; - -let A = { - u: 3 -}; - -exports.B = B; -exports.A = A; -/* No side effect */ diff --git a/tests/tests/src/conditional/cond_a_B.mjs b/tests/tests/src/conditional/cond_a_B.mjs new file mode 100644 index 0000000000..85ab1e8e9b --- /dev/null +++ b/tests/tests/src/conditional/cond_a_B.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let B = { + value: 3 +}; + +let A = { + u: 3 +}; + +export { + B, + A, +} +/* No side effect */ diff --git a/tests/tests/src/conditional/cond_a_C.js b/tests/tests/src/conditional/cond_a_C.js deleted file mode 100644 index 41056e1139..0000000000 --- a/tests/tests/src/conditional/cond_a_C.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let C = { - value: 3 -}; - -let A = { - u: 3 -}; - -exports.C = C; -exports.A = A; -/* No side effect */ diff --git a/tests/tests/src/conditional/cond_a_C.mjs b/tests/tests/src/conditional/cond_a_C.mjs new file mode 100644 index 0000000000..50cff7a715 --- /dev/null +++ b/tests/tests/src/conditional/cond_a_C.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let C = { + value: 3 +}; + +let A = { + u: 3 +}; + +export { + C, + A, +} +/* No side effect */ diff --git a/tests/tests/src/conditional/cond_a_none.js b/tests/tests/src/conditional/cond_a_none.js deleted file mode 100644 index 90d2901291..0000000000 --- a/tests/tests/src/conditional/cond_a_none.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "cond_a_none.res", - 2, - 10 - ], - Error: new Error() -}; - -exports.A = A; -/* u Not a pure module */ diff --git a/tests/tests/src/conditional/cond_a_none.mjs b/tests/tests/src/conditional/cond_a_none.mjs new file mode 100644 index 0000000000..765ecc86fd --- /dev/null +++ b/tests/tests/src/conditional/cond_a_none.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "cond_a_none.res", + 2, + 10 + ], + Error: new Error() +}; + +export { + A, +} +/* u Not a pure module */ diff --git a/tests/tests/src/conditional/cond_b.js b/tests/tests/src/conditional/cond_b.js deleted file mode 100644 index aaf55c9a90..0000000000 --- a/tests/tests/src/conditional/cond_b.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let value = 3; - -exports.value = value; -/* No side effect */ diff --git a/tests/tests/src/conditional/cond_b.mjs b/tests/tests/src/conditional/cond_b.mjs new file mode 100644 index 0000000000..522d8f9212 --- /dev/null +++ b/tests/tests/src/conditional/cond_b.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let value = 3; + +export { + value, +} +/* No side effect */ diff --git a/tests/tests/src/conditional/cond_c.js b/tests/tests/src/conditional/cond_c.js deleted file mode 100644 index aaf55c9a90..0000000000 --- a/tests/tests/src/conditional/cond_c.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let value = 3; - -exports.value = value; -/* No side effect */ diff --git a/tests/tests/src/conditional/cond_c.mjs b/tests/tests/src/conditional/cond_c.mjs new file mode 100644 index 0000000000..522d8f9212 --- /dev/null +++ b/tests/tests/src/conditional/cond_c.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let value = 3; + +export { + value, +} +/* No side effect */ diff --git a/tests/tests/src/config1_test.js b/tests/tests/src/config1_test.mjs similarity index 100% rename from tests/tests/src/config1_test.js rename to tests/tests/src/config1_test.mjs diff --git a/tests/tests/src/console_log_test.js b/tests/tests/src/console_log_test.js deleted file mode 100644 index 7ca7f50b95..0000000000 --- a/tests/tests/src/console_log_test.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -function min_int(prim0, prim1) { - return Math.min(prim0, prim1); -} - -function say(prim0, prim1) { - return prim0.say(prim1); -} - -let v = Primitive_object.compare; - -exports.min_int = min_int; -exports.say = say; -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/console_log_test.mjs b/tests/tests/src/console_log_test.mjs new file mode 100644 index 0000000000..0ca31922c5 --- /dev/null +++ b/tests/tests/src/console_log_test.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +function min_int(prim0, prim1) { + return Math.min(prim0, prim1); +} + +function say(prim0, prim1) { + return prim0.say(prim1); +} + +let v = Primitive_object.compare; + +export { + min_int, + say, + v, +} +/* No side effect */ diff --git a/tests/tests/src/const_block_test.js b/tests/tests/src/const_block_test.js deleted file mode 100644 index 479e3ad51f..0000000000 --- a/tests/tests/src/const_block_test.js +++ /dev/null @@ -1,102 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); - -let a = [ - 0, - 1, - 2 -]; - -let b = [ - 0, - 1, - 2 -]; - -let c = [ - 0, - 1, - 2, - 3, - 4, - 5 -]; - -function f() { - Primitive_array.set(a, 0, 3.0); - Primitive_array.set(b, 0, 3); -} - -function h() { - return c; -} - -function g() { - f(); - return { - TAG: "Eq", - _0: [ - Primitive_array.get(a, 0), - Primitive_array.get(b, 0) - ], - _1: [ - 3.0, - 3 - ] - }; -} - -let suites_0 = [ - "const_block_test", - g -]; - -let suites_1 = { - hd: [ - "avoid_mutable_inline_test", - () => { - Primitive_array.set(c, 0, 3); - Primitive_array.set(c, 1, 4); - return { - TAG: "Eq", - _0: [ - 3, - 4, - 2, - 3, - 4, - 5 - ], - _1: c - }; - } - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Const_block_test", suites); - -let v = [ - 0, - 1, - 2, - 3, - 4, - 5 -]; - -exports.a = a; -exports.b = b; -exports.c = c; -exports.v = v; -exports.f = f; -exports.h = h; -/* Not a pure module */ diff --git a/tests/tests/src/const_block_test.mjs b/tests/tests/src/const_block_test.mjs new file mode 100644 index 0000000000..fecc847176 --- /dev/null +++ b/tests/tests/src/const_block_test.mjs @@ -0,0 +1,103 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; + +let a = [ + 0, + 1, + 2 +]; + +let b = [ + 0, + 1, + 2 +]; + +let c = [ + 0, + 1, + 2, + 3, + 4, + 5 +]; + +function f() { + Primitive_array.set(a, 0, 3.0); + Primitive_array.set(b, 0, 3); +} + +function h() { + return c; +} + +function g() { + f(); + return { + TAG: "Eq", + _0: [ + Primitive_array.get(a, 0), + Primitive_array.get(b, 0) + ], + _1: [ + 3.0, + 3 + ] + }; +} + +let suites_0 = [ + "const_block_test", + g +]; + +let suites_1 = { + hd: [ + "avoid_mutable_inline_test", + () => { + Primitive_array.set(c, 0, 3); + Primitive_array.set(c, 1, 4); + return { + TAG: "Eq", + _0: [ + 3, + 4, + 2, + 3, + 4, + 5 + ], + _1: c + }; + } + ], + tl: /* [] */0 +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Const_block_test", suites); + +let v = [ + 0, + 1, + 2, + 3, + 4, + 5 +]; + +export { + a, + b, + c, + v, + f, + h, +} +/* Not a pure module */ diff --git a/tests/tests/src/const_defs.js b/tests/tests/src/const_defs.js deleted file mode 100644 index 4e308ce038..0000000000 --- a/tests/tests/src/const_defs.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = true; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/const_defs.mjs b/tests/tests/src/const_defs.mjs new file mode 100644 index 0000000000..929ed489c4 --- /dev/null +++ b/tests/tests/src/const_defs.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = true; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/const_defs_test.js b/tests/tests/src/const_defs_test.js deleted file mode 100644 index 0d7788f675..0000000000 --- a/tests/tests/src/const_defs_test.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Pervasives = require("rescript/lib/js/Pervasives.js"); - -let u = 3; - -function f() { - return Pervasives.invalid_arg("hi"); -} - -exports.u = u; -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/const_defs_test.mjs b/tests/tests/src/const_defs_test.mjs new file mode 100644 index 0000000000..538e6c636c --- /dev/null +++ b/tests/tests/src/const_defs_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; + +let u = 3; + +function f() { + return Pervasives.invalid_arg("hi"); +} + +export { + u, + f, +} +/* No side effect */ diff --git a/tests/tests/src/const_test.js b/tests/tests/src/const_test.js deleted file mode 100644 index e36d5b3ad9..0000000000 --- a/tests/tests/src/const_test.js +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - return x; -} - -function ff(x) { - return x; -} - -function fff(x) { - let x$1 = { - TAG: "A", - _0: x - }; - switch (x$1.TAG) { - case "A" : - return x; - case "B" : - return 1; - case "C" : - return 2; - } -} - -function h(x) { - if (x === "B") { - return 1; - } else if (x === "C") { - return 2; - } else { - return 0; - } -} - -function hh() { - return 3; -} - -let g = h("A"); - -exports.f = f; -exports.ff = ff; -exports.fff = fff; -exports.h = h; -exports.hh = hh; -exports.g = g; -/* g Not a pure module */ diff --git a/tests/tests/src/const_test.mjs b/tests/tests/src/const_test.mjs new file mode 100644 index 0000000000..3a7d0323ea --- /dev/null +++ b/tests/tests/src/const_test.mjs @@ -0,0 +1,51 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + return x; +} + +function ff(x) { + return x; +} + +function fff(x) { + let x$1 = { + TAG: "A", + _0: x + }; + switch (x$1.TAG) { + case "A" : + return x; + case "B" : + return 1; + case "C" : + return 2; + } +} + +function h(x) { + if (x === "B") { + return 1; + } else if (x === "C") { + return 2; + } else { + return 0; + } +} + +function hh() { + return 3; +} + +let g = h("A"); + +export { + f, + ff, + fff, + h, + hh, + g, +} +/* g Not a pure module */ diff --git a/tests/tests/src/cont_int_fold_test.js b/tests/tests/src/cont_int_fold_test.js deleted file mode 100644 index 3fa0671aaa..0000000000 --- a/tests/tests/src/cont_int_fold_test.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function a(a0, a1, a2, a3, a4) { - return (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) + 2 | 0; -} - -function b(a0, a1, a2, a3, a4) { - return (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) + (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) | 0; -} - -exports.a = a; -exports.b = b; -/* No side effect */ diff --git a/tests/tests/src/cont_int_fold_test.mjs b/tests/tests/src/cont_int_fold_test.mjs new file mode 100644 index 0000000000..708c375572 --- /dev/null +++ b/tests/tests/src/cont_int_fold_test.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function a(a0, a1, a2, a3, a4) { + return (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) + 2 | 0; +} + +function b(a0, a1, a2, a3, a4) { + return (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) + (((((1 + a0 | 0) + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0) | 0; +} + +export { + a, + b, +} +/* No side effect */ diff --git a/tests/tests/src/cps_test.js b/tests/tests/src/cps_test.js deleted file mode 100644 index 6136c08066..0000000000 --- a/tests/tests/src/cps_test.js +++ /dev/null @@ -1,94 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -function test() { - let v = { - contents: 0 - }; - let f = (_n, _acc) => { - while (true) { - let acc = _acc; - let n = _n; - if (n === 0) { - return acc(); - } - _acc = () => { - v.contents = v.contents + n | 0; - return acc(); - }; - _n = n - 1 | 0; - continue; - }; - }; - f(10, () => {}); - return v.contents; -} - -function test_closure() { - let v = { - contents: 0 - }; - let arr = Belt_Array.make(6, x => x); - for (let i = 0; i <= 5; ++i) { - arr[i] = param => i; - } - Belt_Array.forEach(arr, i => { - v.contents = v.contents + i(0) | 0; - }); - return v.contents; -} - -function test_closure2() { - let v = { - contents: 0 - }; - let arr = Belt_Array.make(6, x => x); - for (let i = 0; i <= 5; ++i) { - let j = i + i | 0; - arr[i] = param => j; - } - Belt_Array.forEach(arr, i => { - v.contents = v.contents + i(0) | 0; - }); - return v.contents; -} - -Mt.from_pair_suites("Cps_test", { - hd: [ - "cps_test_sum", - () => ({ - TAG: "Eq", - _0: 55, - _1: test() - }) - ], - tl: { - hd: [ - "cps_test_closure", - () => ({ - TAG: "Eq", - _0: 15, - _1: test_closure() - }) - ], - tl: { - hd: [ - "cps_test_closure2", - () => ({ - TAG: "Eq", - _0: 30, - _1: test_closure2() - }) - ], - tl: /* [] */0 - } - } -}); - -exports.test = test; -exports.test_closure = test_closure; -exports.test_closure2 = test_closure2; -/* Not a pure module */ diff --git a/tests/tests/src/cps_test.mjs b/tests/tests/src/cps_test.mjs new file mode 100644 index 0000000000..1e1c1c6d8f --- /dev/null +++ b/tests/tests/src/cps_test.mjs @@ -0,0 +1,95 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +function test() { + let v = { + contents: 0 + }; + let f = (_n, _acc) => { + while (true) { + let acc = _acc; + let n = _n; + if (n === 0) { + return acc(); + } + _acc = () => { + v.contents = v.contents + n | 0; + return acc(); + }; + _n = n - 1 | 0; + continue; + }; + }; + f(10, () => {}); + return v.contents; +} + +function test_closure() { + let v = { + contents: 0 + }; + let arr = Belt_Array.make(6, x => x); + for (let i = 0; i <= 5; ++i) { + arr[i] = param => i; + } + Belt_Array.forEach(arr, i => { + v.contents = v.contents + i(0) | 0; + }); + return v.contents; +} + +function test_closure2() { + let v = { + contents: 0 + }; + let arr = Belt_Array.make(6, x => x); + for (let i = 0; i <= 5; ++i) { + let j = i + i | 0; + arr[i] = param => j; + } + Belt_Array.forEach(arr, i => { + v.contents = v.contents + i(0) | 0; + }); + return v.contents; +} + +Mt.from_pair_suites("Cps_test", { + hd: [ + "cps_test_sum", + () => ({ + TAG: "Eq", + _0: 55, + _1: test() + }) + ], + tl: { + hd: [ + "cps_test_closure", + () => ({ + TAG: "Eq", + _0: 15, + _1: test_closure() + }) + ], + tl: { + hd: [ + "cps_test_closure2", + () => ({ + TAG: "Eq", + _0: 30, + _1: test_closure2() + }) + ], + tl: /* [] */0 + } + } +}); + +export { + test, + test_closure, + test_closure2, +} +/* Not a pure module */ diff --git a/tests/tests/src/cross_module_inline_test.js b/tests/tests/src/cross_module_inline_test.js deleted file mode 100644 index eb32c53f16..0000000000 --- a/tests/tests/src/cross_module_inline_test.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Test_char = require("./test_char.js"); - -let v = Test_char.caml_is_printable(/* 'a' */97); - -exports.v = v; -/* v Not a pure module */ diff --git a/tests/tests/src/cross_module_inline_test.mjs b/tests/tests/src/cross_module_inline_test.mjs new file mode 100644 index 0000000000..715b9c6e1d --- /dev/null +++ b/tests/tests/src/cross_module_inline_test.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Test_char from "./test_char.mjs"; + +let v = Test_char.caml_is_printable(/* 'a' */97); + +export { + v, +} +/* v Not a pure module */ diff --git a/tests/tests/src/custom_error_test.js b/tests/tests/src/custom_error_test.js deleted file mode 100644 index 12e8246a47..0000000000 --- a/tests/tests/src/custom_error_test.js +++ /dev/null @@ -1,66 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Exn = require("rescript/lib/js/Exn.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -function test_js_error() { - let e; - try { - e = JSON.parse(" {\"x\" : }"); - } catch (raw_err) { - let err = Primitive_exceptions.internalToException(raw_err); - if (err.RE_EXN_ID === Exn.$$Error) { - console.log(err._1.stack); - return; - } - throw err; - } - return e; -} - -function test_js_error2() { - try { - return JSON.parse(" {\"x\" : }"); - } catch (raw_e) { - let e = Primitive_exceptions.internalToException(raw_e); - if (e.RE_EXN_ID === Exn.$$Error) { - console.log(e._1.stack); - throw e; - } - throw e; - } -} - -function example1() { - let v; - try { - v = JSON.parse(" {\"x\" }"); - } catch (raw_err) { - let err = Primitive_exceptions.internalToException(raw_err); - if (err.RE_EXN_ID === Exn.$$Error) { - console.log(err._1.stack); - return; - } - throw err; - } - return v; -} - -function example2() { - try { - return JSON.parse(" {\"x\"}"); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === Exn.$$Error) { - return; - } - throw exn; - } -} - -exports.test_js_error = test_js_error; -exports.test_js_error2 = test_js_error2; -exports.example1 = example1; -exports.example2 = example2; -/* No side effect */ diff --git a/tests/tests/src/custom_error_test.mjs b/tests/tests/src/custom_error_test.mjs new file mode 100644 index 0000000000..8954226c64 --- /dev/null +++ b/tests/tests/src/custom_error_test.mjs @@ -0,0 +1,67 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Exn from "rescript/lib/es6/Exn.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +function test_js_error() { + let e; + try { + e = JSON.parse(" {\"x\" : }"); + } catch (raw_err) { + let err = Primitive_exceptions.internalToException(raw_err); + if (err.RE_EXN_ID === Exn.$$Error) { + console.log(err._1.stack); + return; + } + throw err; + } + return e; +} + +function test_js_error2() { + try { + return JSON.parse(" {\"x\" : }"); + } catch (raw_e) { + let e = Primitive_exceptions.internalToException(raw_e); + if (e.RE_EXN_ID === Exn.$$Error) { + console.log(e._1.stack); + throw e; + } + throw e; + } +} + +function example1() { + let v; + try { + v = JSON.parse(" {\"x\" }"); + } catch (raw_err) { + let err = Primitive_exceptions.internalToException(raw_err); + if (err.RE_EXN_ID === Exn.$$Error) { + console.log(err._1.stack); + return; + } + throw err; + } + return v; +} + +function example2() { + try { + return JSON.parse(" {\"x\"}"); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === Exn.$$Error) { + return; + } + throw exn; + } +} + +export { + test_js_error, + test_js_error2, + example1, + example2, +} +/* No side effect */ diff --git a/tests/tests/src/debug_keep_test.js b/tests/tests/src/debug_keep_test.js deleted file mode 100644 index 6b2d610da8..0000000000 --- a/tests/tests/src/debug_keep_test.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -debugger; - -/* Not a pure module */ diff --git a/tests/tests/src/debug_keep_test.mjs b/tests/tests/src/debug_keep_test.mjs new file mode 100644 index 0000000000..93b325414a --- /dev/null +++ b/tests/tests/src/debug_keep_test.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +debugger; + +/* Not a pure module */ diff --git a/tests/tests/src/debug_mode_value.js b/tests/tests/src/debug_mode_value.js deleted file mode 100644 index 2e14ec1623..0000000000 --- a/tests/tests/src/debug_mode_value.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let u = { - TAG: "A", - _0: 1, - _1: 2, - [Symbol.for("name")]: "A" -}; - -let h = { - hd: 1, - tl: /* [] */0 -}; - -exports.u = u; -exports.h = h; -/* No side effect */ diff --git a/tests/tests/src/debug_mode_value.mjs b/tests/tests/src/debug_mode_value.mjs new file mode 100644 index 0000000000..5312ef0edf --- /dev/null +++ b/tests/tests/src/debug_mode_value.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let u = { + TAG: "A", + _0: 1, + _1: 2, + [Symbol.for("name")]: "A" +}; + +let h = { + hd: 1, + tl: /* [] */0 +}; + +export { + u, + h, +} +/* No side effect */ diff --git a/tests/tests/src/debug_tmp.js b/tests/tests/src/debug_tmp.mjs similarity index 100% rename from tests/tests/src/debug_tmp.js rename to tests/tests/src/debug_tmp.mjs diff --git a/tests/tests/src/debugger_test.js b/tests/tests/src/debugger_test.js deleted file mode 100644 index 37d33813f9..0000000000 --- a/tests/tests/src/debugger_test.js +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x, y) { - console.log([ - x, - y - ]); - return x + y | 0; -} - -function g() { - f(1, 2); - debugger; - f(1, 2); - debugger; - return 3; -} - -function exterme_g() { - f(1, 2); - debugger; - let v; - console.log(v); - f(1, 2); - debugger; - return 3; -} - -exports.f = f; -exports.g = g; -exports.exterme_g = exterme_g; -/* No side effect */ diff --git a/tests/tests/src/debugger_test.mjs b/tests/tests/src/debugger_test.mjs new file mode 100644 index 0000000000..0ff39dd1b0 --- /dev/null +++ b/tests/tests/src/debugger_test.mjs @@ -0,0 +1,35 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x, y) { + console.log([ + x, + y + ]); + return x + y | 0; +} + +function g() { + f(1, 2); + debugger; + f(1, 2); + debugger; + return 3; +} + +function exterme_g() { + f(1, 2); + debugger; + let v; + console.log(v); + f(1, 2); + debugger; + return 3; +} + +export { + f, + g, + exterme_g, +} +/* No side effect */ diff --git a/tests/tests/src/default_export_test.js b/tests/tests/src/default_export_test.js deleted file mode 100644 index 86a2657e3a..0000000000 --- a/tests/tests/src/default_export_test.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let $$default = "xx"; - -exports.default = $$default; -exports.__esModule = true; -/* No side effect */ diff --git a/tests/tests/src/default_export_test.mjs b/tests/tests/src/default_export_test.mjs new file mode 100644 index 0000000000..4c67f05d73 --- /dev/null +++ b/tests/tests/src/default_export_test.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let $$default = "xx"; + +export { + $$default as default, +} +/* No side effect */ diff --git a/tests/tests/src/defunctor_make_test.js b/tests/tests/src/defunctor_make_test.js deleted file mode 100644 index 3e5afd3d23..0000000000 --- a/tests/tests/src/defunctor_make_test.js +++ /dev/null @@ -1,172 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -function getcompare(x) { - return x; -} - -function Make(M) { - return M; -} - -let Comparable = { - getcompare: getcompare, - Make: Make -}; - -function height(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } -} - -function create(l, x, d, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } else if (typeof lr !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } else if (typeof rl !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } -} - -function add(x, data, compare, x_) { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: x_._4 - }; - } else if (c < 0) { - return bal(add(x, data, compare, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, compare, r)); - } -} - -function add$1(x, data, v) { - let X = v.compare; - return { - compare: v.compare, - data: add(x, data, X.compare, v.data) - }; -} - -function empty(v) { - return { - compare: v, - data: "Empty" - }; -} - -let compare = Primitive_int.compare; - -let V0 = { - compare: compare -}; - -let compare$1 = Primitive_int.compare; - -let V1 = { - compare: compare$1 -}; - -let v0 = { - compare: V0, - data: "Empty" -}; - -let v1 = { - compare: V1, - data: "Empty" -}; - -let v3 = add$1(3, "a", v0); - -console.log(v3); - -exports.Comparable = Comparable; -exports.height = height; -exports.create = create; -exports.bal = bal; -exports.add = add$1; -exports.empty = empty; -exports.V0 = V0; -exports.V1 = V1; -exports.v0 = v0; -exports.v1 = v1; -exports.v3 = v3; -/* v3 Not a pure module */ diff --git a/tests/tests/src/defunctor_make_test.mjs b/tests/tests/src/defunctor_make_test.mjs new file mode 100644 index 0000000000..e0ddcadaec --- /dev/null +++ b/tests/tests/src/defunctor_make_test.mjs @@ -0,0 +1,173 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +function getcompare(x) { + return x; +} + +function Make(M) { + return M; +} + +let Comparable = { + getcompare: getcompare, + Make: Make +}; + +function height(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } +} + +function create(l, x, d, r) { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function bal(l, x, d, r) { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, ld, create(lr, x, d, r)); + } else if (typeof lr !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, x, d, rl), rv, rd, rr); + } else if (typeof rl !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); + } +} + +function add(x, data, compare, x_) { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: x_._4 + }; + } else if (c < 0) { + return bal(add(x, data, compare, l), v, d, r); + } else { + return bal(l, v, d, add(x, data, compare, r)); + } +} + +function add$1(x, data, v) { + let X = v.compare; + return { + compare: v.compare, + data: add(x, data, X.compare, v.data) + }; +} + +function empty(v) { + return { + compare: v, + data: "Empty" + }; +} + +let compare = Primitive_int.compare; + +let V0 = { + compare: compare +}; + +let compare$1 = Primitive_int.compare; + +let V1 = { + compare: compare$1 +}; + +let v0 = { + compare: V0, + data: "Empty" +}; + +let v1 = { + compare: V1, + data: "Empty" +}; + +let v3 = add$1(3, "a", v0); + +console.log(v3); + +export { + Comparable, + height, + create, + bal, + add$1 as add, + empty, + V0, + V1, + v0, + v1, + v3, +} +/* v3 Not a pure module */ diff --git a/tests/tests/src/demo_int_map.js b/tests/tests/src/demo_int_map.js deleted file mode 100644 index d8531713c0..0000000000 --- a/tests/tests/src/demo_int_map.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_MapInt = require("rescript/lib/js/Belt_MapInt.js"); - -function test() { - let m; - for (let i = 0; i <= 1000000; ++i) { - m = Belt_MapInt.set(m, i, i); - } - for (let i$1 = 0; i$1 <= 1000000; ++i$1) { - Belt_MapInt.get(m, i$1); - } -} - -test(); - -/* Not a pure module */ diff --git a/tests/tests/src/demo_int_map.mjs b/tests/tests/src/demo_int_map.mjs new file mode 100644 index 0000000000..21aadffef3 --- /dev/null +++ b/tests/tests/src/demo_int_map.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_MapInt from "rescript/lib/es6/Belt_MapInt.js"; + +function test() { + let m; + for (let i = 0; i <= 1000000; ++i) { + m = Belt_MapInt.set(m, i, i); + } + for (let i$1 = 0; i$1 <= 1000000; ++i$1) { + Belt_MapInt.get(m, i$1); + } +} + +test(); + +/* Not a pure module */ diff --git a/tests/tests/src/demo_page.js b/tests/tests/src/demo_page.js deleted file mode 100644 index f506133343..0000000000 --- a/tests/tests/src/demo_page.js +++ /dev/null @@ -1,54 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let React = require("react"); -let ReactDom = require("react-dom"); - -function fib(x) { - if (x === 2 || x === 1) { - return 1; - } else { - return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; - } -} - -function sum(n) { - let v = 0; - for (let i = 0; i <= n; ++i) { - v = v + i | 0; - } - return v; -} - -function map(f, x) { - if (typeof x !== "object") { - return "Nil"; - } else { - return { - TAG: "Cons", - _0: f(x._0), - _1: map(f, x._1) - }; - } -} - -function test_curry(x, y) { - return x + y | 0; -} - -function f(extra) { - return 32 + extra | 0; -} - -ReactDom.render(React.createClass({ - render: () => React.DOM.div({ - alt: "pic" - }, React.DOM.h1(undefined, "hello react"), React.DOM.h2(undefined, "type safe!")) -}), document.getElementById("hi")); - -exports.fib = fib; -exports.sum = sum; -exports.map = map; -exports.test_curry = test_curry; -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/demo_page.mjs b/tests/tests/src/demo_page.mjs new file mode 100644 index 0000000000..ee3b1665a5 --- /dev/null +++ b/tests/tests/src/demo_page.mjs @@ -0,0 +1,55 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as React from "react"; +import * as ReactDom from "react-dom"; + +function fib(x) { + if (x === 2 || x === 1) { + return 1; + } else { + return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; + } +} + +function sum(n) { + let v = 0; + for (let i = 0; i <= n; ++i) { + v = v + i | 0; + } + return v; +} + +function map(f, x) { + if (typeof x !== "object") { + return "Nil"; + } else { + return { + TAG: "Cons", + _0: f(x._0), + _1: map(f, x._1) + }; + } +} + +function test_curry(x, y) { + return x + y | 0; +} + +function f(extra) { + return 32 + extra | 0; +} + +ReactDom.render(React.createClass({ + render: () => React.DOM.div({ + alt: "pic" + }, React.DOM.h1(undefined, "hello react"), React.DOM.h2(undefined, "type safe!")) +}), document.getElementById("hi")); + +export { + fib, + sum, + map, + test_curry, + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/demo_pipe.js b/tests/tests/src/demo_pipe.js deleted file mode 100644 index ade4eaf5be..0000000000 --- a/tests/tests/src/demo_pipe.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function register(rl) { - return rl.on("line", x => { - console.log(x); - }).on("close", () => { - console.log("finished"); - }); -} - -exports.register = register; -/* No side effect */ diff --git a/tests/tests/src/demo_pipe.mjs b/tests/tests/src/demo_pipe.mjs new file mode 100644 index 0000000000..2e061cce11 --- /dev/null +++ b/tests/tests/src/demo_pipe.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function register(rl) { + return rl.on("line", x => { + console.log(x); + }).on("close", () => { + console.log("finished"); + }); +} + +export { + register, +} +/* No side effect */ diff --git a/tests/tests/src/derive_projector_test.js b/tests/tests/src/derive_projector_test.js deleted file mode 100644 index 6ed61163a3..0000000000 --- a/tests/tests/src/derive_projector_test.js +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function u_x(param) { - return param.u_x; -} - -function b_x(param) { - return param.b_x; -} - -function c_x(param) { - return param.c_x; -} - -function d_int(param_0) { - return { - TAG: "D_int", - _0: param_0 - }; -} - -function d_tuple(param_0, param_1) { - return { - TAG: "D_tuple", - _0: param_0, - _1: param_1 - }; -} - -function newContent(param_0) { - return { - TAG: "NewContent", - _0: param_0 - }; -} - -function d_tweak(param_0) { - return { - TAG: "D_tweak", - _0: param_0 - }; -} - -function u_X(param) { - return param.u_X; -} - -function d(param) { - return param.d; -} - -let v = { - TAG: "D_int", - _0: 3 -}; - -let h_1 = { - hd: { - TAG: "D_int", - _0: 3 - }, - tl: { - hd: { - TAG: "D_tuple", - _0: 3, - _1: "hgo" - }, - tl: { - hd: { - TAG: "D_tweak", - _0: [ - 3, - "hgo" - ] - }, - tl: { - hd: { - TAG: "NewContent", - _0: "3" - }, - tl: /* [] */0 - } - } - } -}; - -let h = { - hd: "D_empty", - tl: h_1 -}; - -function xx(param_0) { - return { - TAG: "Xx", - _0: param_0 - }; -} - -function a(param_0) { - return { - TAG: "A", - _0: param_0 - }; -} - -let d_empty = "D_empty"; - -let hei = "Hei"; - -exports.u_x = u_x; -exports.b_x = b_x; -exports.c_x = c_x; -exports.d_empty = d_empty; -exports.d_int = d_int; -exports.d_tuple = d_tuple; -exports.newContent = newContent; -exports.d_tweak = d_tweak; -exports.hei = hei; -exports.u_X = u_X; -exports.d = d; -exports.v = v; -exports.h = h; -exports.xx = xx; -exports.a = a; -/* No side effect */ diff --git a/tests/tests/src/derive_projector_test.mjs b/tests/tests/src/derive_projector_test.mjs new file mode 100644 index 0000000000..c732e0e0f8 --- /dev/null +++ b/tests/tests/src/derive_projector_test.mjs @@ -0,0 +1,128 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function u_x(param) { + return param.u_x; +} + +function b_x(param) { + return param.b_x; +} + +function c_x(param) { + return param.c_x; +} + +function d_int(param_0) { + return { + TAG: "D_int", + _0: param_0 + }; +} + +function d_tuple(param_0, param_1) { + return { + TAG: "D_tuple", + _0: param_0, + _1: param_1 + }; +} + +function newContent(param_0) { + return { + TAG: "NewContent", + _0: param_0 + }; +} + +function d_tweak(param_0) { + return { + TAG: "D_tweak", + _0: param_0 + }; +} + +function u_X(param) { + return param.u_X; +} + +function d(param) { + return param.d; +} + +let v = { + TAG: "D_int", + _0: 3 +}; + +let h_1 = { + hd: { + TAG: "D_int", + _0: 3 + }, + tl: { + hd: { + TAG: "D_tuple", + _0: 3, + _1: "hgo" + }, + tl: { + hd: { + TAG: "D_tweak", + _0: [ + 3, + "hgo" + ] + }, + tl: { + hd: { + TAG: "NewContent", + _0: "3" + }, + tl: /* [] */0 + } + } + } +}; + +let h = { + hd: "D_empty", + tl: h_1 +}; + +function xx(param_0) { + return { + TAG: "Xx", + _0: param_0 + }; +} + +function a(param_0) { + return { + TAG: "A", + _0: param_0 + }; +} + +let d_empty = "D_empty"; + +let hei = "Hei"; + +export { + u_x, + b_x, + c_x, + d_empty, + d_int, + d_tuple, + newContent, + d_tweak, + hei, + u_X, + d, + v, + h, + xx, + a, +} +/* No side effect */ diff --git a/tests/tests/src/directives.js b/tests/tests/src/directives.js deleted file mode 100644 index 4272ed41a3..0000000000 --- a/tests/tests/src/directives.js +++ /dev/null @@ -1,11 +0,0 @@ -first directive; -second directive; -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -let a = Belt_Array.forEach; - -exports.a = a; -/* No side effect */ diff --git a/tests/tests/src/directives.mjs b/tests/tests/src/directives.mjs new file mode 100644 index 0000000000..ef14b48f85 --- /dev/null +++ b/tests/tests/src/directives.mjs @@ -0,0 +1,12 @@ +first directive; +second directive; +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +let a = Belt_Array.forEach; + +export { + a, +} +/* No side effect */ diff --git a/tests/tests/src/div_by_zero_test.js b/tests/tests/src/div_by_zero_test.js deleted file mode 100644 index 002cf63458..0000000000 --- a/tests/tests/src/div_by_zero_test.js +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function add(suite) { - suites.contents = { - hd: suite, - tl: suites.contents - }; -} - -add([ - "File \"div_by_zero_test.res\", line 14, characters 7-14", - () => ({ - TAG: "ThrowAny", - _0: () => { - Primitive_int.div(3, 0); - } - }) -]); - -add([ - "File \"div_by_zero_test.res\", line 15, characters 7-14", - () => ({ - TAG: "ThrowAny", - _0: () => { - Primitive_int.mod_(3, 0); - } - }) -]); - -function div(x, y) { - return Primitive_int.div(x, y) + 3 | 0; -} - -Mt.from_pair_suites("Div_by_zero_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.add = add; -exports.div = div; -/* Not a pure module */ diff --git a/tests/tests/src/div_by_zero_test.mjs b/tests/tests/src/div_by_zero_test.mjs new file mode 100644 index 0000000000..03d9d73e33 --- /dev/null +++ b/tests/tests/src/div_by_zero_test.mjs @@ -0,0 +1,69 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function add(suite) { + suites.contents = { + hd: suite, + tl: suites.contents + }; +} + +add([ + "File \"div_by_zero_test.res\", line 14, characters 7-14", + () => ({ + TAG: "ThrowAny", + _0: () => { + Primitive_int.div(3, 0); + } + }) +]); + +add([ + "File \"div_by_zero_test.res\", line 15, characters 7-14", + () => ({ + TAG: "ThrowAny", + _0: () => { + Primitive_int.mod_(3, 0); + } + }) +]); + +function div(x, y) { + return Primitive_int.div(x, y) + 3 | 0; +} + +Mt.from_pair_suites("Div_by_zero_test", suites.contents); + +export { + suites, + test_id, + eq, + add, + div, +} +/* Not a pure module */ diff --git a/tests/tests/src/dollar_escape_test.js b/tests/tests/src/dollar_escape_test.js deleted file mode 100644 index 1c547e8f66..0000000000 --- a/tests/tests/src/dollar_escape_test.js +++ /dev/null @@ -1,54 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function $$(x, y) { - return x + y | 0; -} - -let v = 3; - -function $$$plus(x, y) { - return Math.imul(x, y); -} - -let u = 3; - -eq("File \"dollar_escape_test.res\", line 20, characters 3-10", v, 3); - -eq("File \"dollar_escape_test.res\", line 21, characters 3-10", u, 3); - -Mt.from_pair_suites("Dollar_escape_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.$$ = $$; -exports.v = v; -exports.$$$plus = $$$plus; -exports.u = u; -/* Not a pure module */ diff --git a/tests/tests/src/dollar_escape_test.mjs b/tests/tests/src/dollar_escape_test.mjs new file mode 100644 index 0000000000..8257d45abb --- /dev/null +++ b/tests/tests/src/dollar_escape_test.mjs @@ -0,0 +1,55 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function $$(x, y) { + return x + y | 0; +} + +let v = 3; + +function $$$plus(x, y) { + return Math.imul(x, y); +} + +let u = 3; + +eq("File \"dollar_escape_test.res\", line 20, characters 3-10", v, 3); + +eq("File \"dollar_escape_test.res\", line 21, characters 3-10", u, 3); + +Mt.from_pair_suites("Dollar_escape_test", suites.contents); + +export { + suites, + test_id, + eq, + $$, + v, + $$$plus, + u, +} +/* Not a pure module */ diff --git a/tests/tests/src/earger_curry_test.js b/tests/tests/src/earger_curry_test.js deleted file mode 100644 index 111b088b10..0000000000 --- a/tests/tests/src/earger_curry_test.js +++ /dev/null @@ -1,167 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); - -function map(f, a) { - let f$1 = x => f(x); - let l = a.length; - if (l === 0) { - return []; - } - let r = Belt_Array.make(l, f$1(a[0])); - for (let i = 1; i < l; ++i) { - r[i] = f$1(a[i]); - } - return r; -} - -function init(l, f) { - let f$1 = x => f(x); - if (l === 0) { - return []; - } - if (l < 0) { - return Pervasives.invalid_arg("Array.init"); - } - let res = Belt_Array.make(l, f$1(0)); - for (let i = 1; i < l; ++i) { - res[i] = f$1(i); - } - return res; -} - -function fold_left(f, x, a) { - let f$1 = (x, y) => f(x, y); - let r = x; - for (let i = 0, i_finish = a.length; i < i_finish; ++i) { - r = f$1(r, a[i]); - } - return r; -} - -function f2() { - let arr = Belt_Array.init(30000000, i => i); - let b = Belt_Array.map(arr, i => i + i - 1); - let v = Belt_Array.reduceReverse(b, 0, (prim0, prim1) => prim0 + prim1); - console.log(v.toString()); -} - -f2(); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let v = { - contents: 0 -}; - -let all_v = { - contents: /* [] */0 -}; - -function add5(a0, a1, a2, a3, a4) { - console.log([ - a0, - a1, - a2, - a3, - a4 - ]); - all_v.contents = { - hd: v.contents, - tl: all_v.contents - }; - return (((a0 + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0; -} - -function f(x) { - return (extra, extra$1) => add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), extra, extra$1); -} - -function g(x) { - let u = (a, b) => add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), a, b); - all_v.contents = { - hd: v.contents, - tl: all_v.contents - }; - return u; -} - -let a = f(0)(3, 4); - -let b = f(0)(3, 5); - -let c = g(0)(3, 4); - -let d = g(0)(3, 5); - -eq("File \"earger_curry_test.res\", line 148, characters 5-12", a, 10); - -eq("File \"earger_curry_test.res\", line 149, characters 5-12", b, 11); - -eq("File \"earger_curry_test.res\", line 150, characters 5-12", c, 10); - -eq("File \"earger_curry_test.res\", line 151, characters 5-12", d, 11); - -eq("File \"earger_curry_test.res\", line 152, characters 5-12", all_v.contents, { - hd: 8, - tl: { - hd: 6, - tl: { - hd: 6, - tl: { - hd: 4, - tl: { - hd: 4, - tl: { - hd: 2, - tl: /* [] */0 - } - } - } - } - } -}); - -Mt.from_pair_suites("Earger_curry_test", suites.contents); - -exports.map = map; -exports.init = init; -exports.fold_left = fold_left; -exports.f2 = f2; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.all_v = all_v; -exports.add5 = add5; -exports.f = f; -exports.g = g; -exports.a = a; -exports.b = b; -exports.c = c; -exports.d = d; -/* Not a pure module */ diff --git a/tests/tests/src/earger_curry_test.mjs b/tests/tests/src/earger_curry_test.mjs new file mode 100644 index 0000000000..97e7a61672 --- /dev/null +++ b/tests/tests/src/earger_curry_test.mjs @@ -0,0 +1,168 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; + +function map(f, a) { + let f$1 = x => f(x); + let l = a.length; + if (l === 0) { + return []; + } + let r = Belt_Array.make(l, f$1(a[0])); + for (let i = 1; i < l; ++i) { + r[i] = f$1(a[i]); + } + return r; +} + +function init(l, f) { + let f$1 = x => f(x); + if (l === 0) { + return []; + } + if (l < 0) { + return Pervasives.invalid_arg("Array.init"); + } + let res = Belt_Array.make(l, f$1(0)); + for (let i = 1; i < l; ++i) { + res[i] = f$1(i); + } + return res; +} + +function fold_left(f, x, a) { + let f$1 = (x, y) => f(x, y); + let r = x; + for (let i = 0, i_finish = a.length; i < i_finish; ++i) { + r = f$1(r, a[i]); + } + return r; +} + +function f2() { + let arr = Belt_Array.init(30000000, i => i); + let b = Belt_Array.map(arr, i => i + i - 1); + let v = Belt_Array.reduceReverse(b, 0, (prim0, prim1) => prim0 + prim1); + console.log(v.toString()); +} + +f2(); + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let v = { + contents: 0 +}; + +let all_v = { + contents: /* [] */0 +}; + +function add5(a0, a1, a2, a3, a4) { + console.log([ + a0, + a1, + a2, + a3, + a4 + ]); + all_v.contents = { + hd: v.contents, + tl: all_v.contents + }; + return (((a0 + a1 | 0) + a2 | 0) + a3 | 0) + a4 | 0; +} + +function f(x) { + return (extra, extra$1) => add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), extra, extra$1); +} + +function g(x) { + let u = (a, b) => add5(x, (v.contents = v.contents + 1 | 0, 1), (v.contents = v.contents + 1 | 0, 2), a, b); + all_v.contents = { + hd: v.contents, + tl: all_v.contents + }; + return u; +} + +let a = f(0)(3, 4); + +let b = f(0)(3, 5); + +let c = g(0)(3, 4); + +let d = g(0)(3, 5); + +eq("File \"earger_curry_test.res\", line 148, characters 5-12", a, 10); + +eq("File \"earger_curry_test.res\", line 149, characters 5-12", b, 11); + +eq("File \"earger_curry_test.res\", line 150, characters 5-12", c, 10); + +eq("File \"earger_curry_test.res\", line 151, characters 5-12", d, 11); + +eq("File \"earger_curry_test.res\", line 152, characters 5-12", all_v.contents, { + hd: 8, + tl: { + hd: 6, + tl: { + hd: 6, + tl: { + hd: 4, + tl: { + hd: 4, + tl: { + hd: 2, + tl: /* [] */0 + } + } + } + } + } +}); + +Mt.from_pair_suites("Earger_curry_test", suites.contents); + +export { + map, + init, + fold_left, + f2, + suites, + test_id, + eq, + v, + all_v, + add5, + f, + g, + a, + b, + c, + d, +} +/* Not a pure module */ diff --git a/tests/tests/src/effect.js b/tests/tests/src/effect.js deleted file mode 100644 index 9b2a8742c7..0000000000 --- a/tests/tests/src/effect.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log("hello"); - -console.log("hey"); - -let a = 3; - -let b = 4; - -let c = 3; - -exports.a = a; -exports.b = b; -exports.c = c; -/* Not a pure module */ diff --git a/tests/tests/src/effect.mjs b/tests/tests/src/effect.mjs new file mode 100644 index 0000000000..81df1be1eb --- /dev/null +++ b/tests/tests/src/effect.mjs @@ -0,0 +1,19 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log("hello"); + +console.log("hey"); + +let a = 3; + +let b = 4; + +let c = 3; + +export { + a, + b, + c, +} +/* Not a pure module */ diff --git a/tests/tests/src/epsilon_test.js b/tests/tests/src/epsilon_test.js deleted file mode 100644 index abcb43cc1c..0000000000 --- a/tests/tests/src/epsilon_test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); - -let v = (Number.EPSILON?Number.EPSILON:2.220446049250313e-16); - -let suites_0 = [ - "epsilon", - param => ({ - TAG: "Eq", - _0: Pervasives.epsilon_float, - _1: v - }) -]; - -let suites_1 = { - hd: [ - "raw_epsilon", - param => ({ - TAG: "Eq", - _0: 2.220446049250313e-16, - _1: v - }) - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Epsilon_test", suites); - -exports.v = v; -exports.suites = suites; -/* v Not a pure module */ diff --git a/tests/tests/src/epsilon_test.mjs b/tests/tests/src/epsilon_test.mjs new file mode 100644 index 0000000000..f5207c3f63 --- /dev/null +++ b/tests/tests/src/epsilon_test.mjs @@ -0,0 +1,40 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; + +let v = (Number.EPSILON?Number.EPSILON:2.220446049250313e-16); + +let suites_0 = [ + "epsilon", + param => ({ + TAG: "Eq", + _0: Pervasives.epsilon_float, + _1: v + }) +]; + +let suites_1 = { + hd: [ + "raw_epsilon", + param => ({ + TAG: "Eq", + _0: 2.220446049250313e-16, + _1: v + }) + ], + tl: /* [] */0 +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Epsilon_test", suites); + +export { + v, + suites, +} +/* v Not a pure module */ diff --git a/tests/tests/src/equal_box_test.js b/tests/tests/src/equal_box_test.js deleted file mode 100644 index 43d1ccdc88..0000000000 --- a/tests/tests/src/equal_box_test.js +++ /dev/null @@ -1,116 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let aa = Primitive_object.equal; - -let bb = Primitive_object.equal; - -let cc = Primitive_object.equal; - -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 f() { - -} - -function shouldBeNull() { - return null; -} - -b("File \"equal_box_test.res\", line 14, characters 4-11", 3 !== null); - -b("File \"equal_box_test.res\", line 15, characters 4-11", true); - -b("File \"equal_box_test.res\", line 16, characters 4-11", "3" !== null); - -b("File \"equal_box_test.res\", line 17, characters 4-11", /* '3' */51 !== null); - -b("File \"equal_box_test.res\", line 18, characters 4-11", 0 !== null); - -b("File \"equal_box_test.res\", line 19, characters 4-11", 0 !== null); - -b("File \"equal_box_test.res\", line 20, characters 4-11", true); - -b("File \"equal_box_test.res\", line 21, characters 4-11", true); - -b("File \"equal_box_test.res\", line 22, characters 4-11", true); - -b("File \"equal_box_test.res\", line 23, characters 4-11", true); - -b("File \"equal_box_test.res\", line 24, characters 4-11", 3 !== undefined); - -let v = null; - -b("File \"equal_box_test.res\", line 29, characters 4-11", 3 !== v); - -b("File \"equal_box_test.res\", line 30, characters 4-11", undefined !== v); - -b("File \"equal_box_test.res\", line 31, characters 4-11", "3" !== v); - -b("File \"equal_box_test.res\", line 32, characters 4-11", /* '3' */51 !== v); - -b("File \"equal_box_test.res\", line 33, characters 4-11", 0 !== v); - -b("File \"equal_box_test.res\", line 34, characters 4-11", 0 !== v); - -b("File \"equal_box_test.res\", line 35, characters 4-11", undefined !== v); - -b("File \"equal_box_test.res\", line 36, characters 4-11", null === v); - -b("File \"equal_box_test.res\", line 37, characters 4-11", true); - -b("File \"equal_box_test.res\", line 38, characters 4-11", true); - -b("File \"equal_box_test.res\", line 39, characters 4-11", 3 !== undefined); - -b("File \"equal_box_test.res\", line 45, characters 4-11", 3 !== undefined); - -b("File \"equal_box_test.res\", line 46, characters 4-11", true); - -b("File \"equal_box_test.res\", line 47, characters 4-11", "3" !== undefined); - -b("File \"equal_box_test.res\", line 48, characters 4-11", /* '3' */51 !== undefined); - -b("File \"equal_box_test.res\", line 49, characters 4-11", 0 !== undefined); - -b("File \"equal_box_test.res\", line 50, characters 4-11", 0 !== undefined); - -b("File \"equal_box_test.res\", line 51, characters 4-11", true); - -b("File \"equal_box_test.res\", line 55, characters 4-11", true); - -b("File \"equal_box_test.res\", line 56, characters 4-11", true); - -b("File \"equal_box_test.res\", line 57, characters 4-11", true); - -b("File \"equal_box_test.res\", line 58, characters 4-11", 3 !== undefined); - -Mt.from_pair_suites("File \"equal_box_test.res\", line 61, characters 20-27", suites.contents); - -exports.aa = aa; -exports.bb = bb; -exports.cc = cc; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.f = f; -exports.shouldBeNull = shouldBeNull; -/* Not a pure module */ diff --git a/tests/tests/src/equal_box_test.mjs b/tests/tests/src/equal_box_test.mjs new file mode 100644 index 0000000000..a840b951f3 --- /dev/null +++ b/tests/tests/src/equal_box_test.mjs @@ -0,0 +1,117 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let aa = Primitive_object.equal; + +let bb = Primitive_object.equal; + +let cc = Primitive_object.equal; + +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 f() { + +} + +function shouldBeNull() { + return null; +} + +b("File \"equal_box_test.res\", line 14, characters 4-11", 3 !== null); + +b("File \"equal_box_test.res\", line 15, characters 4-11", true); + +b("File \"equal_box_test.res\", line 16, characters 4-11", "3" !== null); + +b("File \"equal_box_test.res\", line 17, characters 4-11", /* '3' */51 !== null); + +b("File \"equal_box_test.res\", line 18, characters 4-11", 0 !== null); + +b("File \"equal_box_test.res\", line 19, characters 4-11", 0 !== null); + +b("File \"equal_box_test.res\", line 20, characters 4-11", true); + +b("File \"equal_box_test.res\", line 21, characters 4-11", true); + +b("File \"equal_box_test.res\", line 22, characters 4-11", true); + +b("File \"equal_box_test.res\", line 23, characters 4-11", true); + +b("File \"equal_box_test.res\", line 24, characters 4-11", 3 !== undefined); + +let v = null; + +b("File \"equal_box_test.res\", line 29, characters 4-11", 3 !== v); + +b("File \"equal_box_test.res\", line 30, characters 4-11", undefined !== v); + +b("File \"equal_box_test.res\", line 31, characters 4-11", "3" !== v); + +b("File \"equal_box_test.res\", line 32, characters 4-11", /* '3' */51 !== v); + +b("File \"equal_box_test.res\", line 33, characters 4-11", 0 !== v); + +b("File \"equal_box_test.res\", line 34, characters 4-11", 0 !== v); + +b("File \"equal_box_test.res\", line 35, characters 4-11", undefined !== v); + +b("File \"equal_box_test.res\", line 36, characters 4-11", null === v); + +b("File \"equal_box_test.res\", line 37, characters 4-11", true); + +b("File \"equal_box_test.res\", line 38, characters 4-11", true); + +b("File \"equal_box_test.res\", line 39, characters 4-11", 3 !== undefined); + +b("File \"equal_box_test.res\", line 45, characters 4-11", 3 !== undefined); + +b("File \"equal_box_test.res\", line 46, characters 4-11", true); + +b("File \"equal_box_test.res\", line 47, characters 4-11", "3" !== undefined); + +b("File \"equal_box_test.res\", line 48, characters 4-11", /* '3' */51 !== undefined); + +b("File \"equal_box_test.res\", line 49, characters 4-11", 0 !== undefined); + +b("File \"equal_box_test.res\", line 50, characters 4-11", 0 !== undefined); + +b("File \"equal_box_test.res\", line 51, characters 4-11", true); + +b("File \"equal_box_test.res\", line 55, characters 4-11", true); + +b("File \"equal_box_test.res\", line 56, characters 4-11", true); + +b("File \"equal_box_test.res\", line 57, characters 4-11", true); + +b("File \"equal_box_test.res\", line 58, characters 4-11", 3 !== undefined); + +Mt.from_pair_suites("File \"equal_box_test.res\", line 61, characters 20-27", suites.contents); + +export { + aa, + bb, + cc, + suites, + test_id, + eq, + b, + f, + shouldBeNull, +} +/* Not a pure module */ diff --git a/tests/tests/src/equal_exception_test.js b/tests/tests/src/equal_exception_test.js deleted file mode 100644 index 4179bf287a..0000000000 --- a/tests/tests/src/equal_exception_test.js +++ /dev/null @@ -1,152 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let v = "gso"; - -function is_equal() { - if (v.codePointAt(0) === /* 'g' */103) { - return; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 6, - 2 - ], - Error: new Error() - }; -} - -function is_exception() { - try { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "Not_found") { - return; - } - throw exn; - } -} - -function is_normal_exception(_x) { - let A = /* @__PURE__ */Primitive_exceptions.create("A"); - let v = { - RE_EXN_ID: A, - _1: 3 - }; - try { - throw v; - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === A) { - if (exn._1 === 3) { - return; - } - throw exn; - } - throw exn; - } -} - -function is_arbitrary_exception() { - let A = /* @__PURE__ */Primitive_exceptions.create("A"); - try { - throw { - RE_EXN_ID: A, - Error: new Error() - }; - } catch (exn) { - return; - } -} - -let suites_0 = [ - "is_equal", - is_equal -]; - -let suites_1 = { - hd: [ - "is_exception", - is_exception - ], - tl: { - hd: [ - "is_normal_exception", - is_normal_exception - ], - tl: { - hd: [ - "is_arbitrary_exception", - is_arbitrary_exception - ], - tl: /* [] */0 - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -let e = { - RE_EXN_ID: "Not_found" -}; - -function eq(x) { - return x.RE_EXN_ID === "Not_found"; -} - -let Not_found = /* @__PURE__ */Primitive_exceptions.create("Equal_exception_test.Not_found"); - -if (Primitive_object.equal(e, { - RE_EXN_ID: Not_found - }) !== false) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 47, - 0 - ], - Error: new Error() - }; -} - -if (Not_found === "Not_found" !== false) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "equal_exception_test.res", - 48, - 0 - ], - Error: new Error() - }; -} - -Mt.from_suites("exception", suites); - -let $$String; - -exports.$$String = $$String; -exports.v = v; -exports.is_equal = is_equal; -exports.is_exception = is_exception; -exports.is_normal_exception = is_normal_exception; -exports.is_arbitrary_exception = is_arbitrary_exception; -exports.suites = suites; -exports.e = e; -exports.eq = eq; -exports.Not_found = Not_found; -/* Not a pure module */ diff --git a/tests/tests/src/equal_exception_test.mjs b/tests/tests/src/equal_exception_test.mjs new file mode 100644 index 0000000000..fc7990ef36 --- /dev/null +++ b/tests/tests/src/equal_exception_test.mjs @@ -0,0 +1,153 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let v = "gso"; + +function is_equal() { + if (v.codePointAt(0) === /* 'g' */103) { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 6, + 2 + ], + Error: new Error() + }; +} + +function is_exception() { + try { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "Not_found") { + return; + } + throw exn; + } +} + +function is_normal_exception(_x) { + let A = /* @__PURE__ */Primitive_exceptions.create("A"); + let v = { + RE_EXN_ID: A, + _1: 3 + }; + try { + throw v; + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === A) { + if (exn._1 === 3) { + return; + } + throw exn; + } + throw exn; + } +} + +function is_arbitrary_exception() { + let A = /* @__PURE__ */Primitive_exceptions.create("A"); + try { + throw { + RE_EXN_ID: A, + Error: new Error() + }; + } catch (exn) { + return; + } +} + +let suites_0 = [ + "is_equal", + is_equal +]; + +let suites_1 = { + hd: [ + "is_exception", + is_exception + ], + tl: { + hd: [ + "is_normal_exception", + is_normal_exception + ], + tl: { + hd: [ + "is_arbitrary_exception", + is_arbitrary_exception + ], + tl: /* [] */0 + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +let e = { + RE_EXN_ID: "Not_found" +}; + +function eq(x) { + return x.RE_EXN_ID === "Not_found"; +} + +let Not_found = /* @__PURE__ */Primitive_exceptions.create("Equal_exception_test.Not_found"); + +if (Primitive_object.equal(e, { + RE_EXN_ID: Not_found + }) !== false) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 47, + 0 + ], + Error: new Error() + }; +} + +if (Not_found === "Not_found" !== false) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "equal_exception_test.res", + 48, + 0 + ], + Error: new Error() + }; +} + +Mt.from_suites("exception", suites); + +let $$String; + +export { + $$String, + v, + is_equal, + is_exception, + is_normal_exception, + is_arbitrary_exception, + suites, + e, + eq, + Not_found, +} +/* Not a pure module */ diff --git a/tests/tests/src/equal_test.js b/tests/tests/src/equal_test.js deleted file mode 100644 index a4cfefc608..0000000000 --- a/tests/tests/src/equal_test.js +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function str_equal(x, y) { - return x === y; -} - -let str_b = true; - -function int_equal(x, y) { - return x === y; -} - -function float_equal(x, y) { - return x === y; -} - -let v = false; - -exports.str_equal = str_equal; -exports.str_b = str_b; -exports.int_equal = int_equal; -exports.v = v; -exports.float_equal = float_equal; -/* No side effect */ diff --git a/tests/tests/src/equal_test.mjs b/tests/tests/src/equal_test.mjs new file mode 100644 index 0000000000..722a9031db --- /dev/null +++ b/tests/tests/src/equal_test.mjs @@ -0,0 +1,27 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function str_equal(x, y) { + return x === y; +} + +let str_b = true; + +function int_equal(x, y) { + return x === y; +} + +function float_equal(x, y) { + return x === y; +} + +let v = false; + +export { + str_equal, + str_b, + int_equal, + v, + float_equal, +} +/* No side effect */ diff --git a/tests/tests_esmodule/src/es6_export.mjs b/tests/tests/src/es6_export.mjs similarity index 100% rename from tests/tests_esmodule/src/es6_export.mjs rename to tests/tests/src/es6_export.mjs diff --git a/tests/tests_esmodule/src/es6_export.res b/tests/tests/src/es6_export.res similarity index 100% rename from tests/tests_esmodule/src/es6_export.res rename to tests/tests/src/es6_export.res diff --git a/tests/tests_esmodule/src/es6_import.mjs b/tests/tests/src/es6_import.mjs similarity index 100% rename from tests/tests_esmodule/src/es6_import.mjs rename to tests/tests/src/es6_import.mjs diff --git a/tests/tests_esmodule/src/es6_import.res b/tests/tests/src/es6_import.res similarity index 100% rename from tests/tests_esmodule/src/es6_import.res rename to tests/tests/src/es6_import.res diff --git a/tests/tests/src/escape_esmodule.js b/tests/tests/src/escape_esmodule.js deleted file mode 100644 index 4a0d036ebc..0000000000 --- a/tests/tests/src/escape_esmodule.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let __esModule = false; - -let $$default = 4; - -exports.__esModule = __esModule; -exports.default = $$default; -exports.__esModule = true; -/* No side effect */ diff --git a/tests/tests/src/escape_esmodule.mjs b/tests/tests/src/escape_esmodule.mjs new file mode 100644 index 0000000000..5583ddd1cc --- /dev/null +++ b/tests/tests/src/escape_esmodule.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let __esModule = false; + +let $$default = 4; + +export { + __esModule, + $$default as default, +} +/* No side effect */ diff --git a/tests/tests/src/esmodule_ref.js b/tests/tests/src/esmodule_ref.js deleted file mode 100644 index 2afa67236b..0000000000 --- a/tests/tests/src/esmodule_ref.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log(false); - -/* Not a pure module */ diff --git a/tests/tests/src/esmodule_ref.mjs b/tests/tests/src/esmodule_ref.mjs new file mode 100644 index 0000000000..959043b041 --- /dev/null +++ b/tests/tests/src/esmodule_ref.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log(false); + +/* Not a pure module */ diff --git a/tests/tests/src/event_ffi.js b/tests/tests/src/event_ffi.js deleted file mode 100644 index 21992a969d..0000000000 --- a/tests/tests/src/event_ffi.js +++ /dev/null @@ -1,76 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -function h0(x) { - return x(); -} - -function h00(x) { - return x(); -} - -function h1(x, y) { - return x(y); -} - -function h10(x) { - return x(3); -} - -function h30(x) { - return a => x(3, 3, a); -} - -function h33(x) { - return x(1, 2, 3); -} - -function h34(x) { - return x(1, 2, 3)(4); -} - -function ocaml_run(b, c) { - return (1 + b | 0) + c | 0; -} - -function a0() { - console.log("hi"); -} - -function a1() { - return x => x; -} - -function a2(x, y) { - return x + y | 0; -} - -function a3(x, y, z) { - return (x + y | 0) + z | 0; -} - -function xx() { - return param => { - console.log(3); - }; -} - -let test_as = Belt_List.map; - -exports.h0 = h0; -exports.h00 = h00; -exports.h1 = h1; -exports.h10 = h10; -exports.h30 = h30; -exports.h33 = h33; -exports.h34 = h34; -exports.ocaml_run = ocaml_run; -exports.a0 = a0; -exports.a1 = a1; -exports.a2 = a2; -exports.a3 = a3; -exports.test_as = test_as; -exports.xx = xx; -/* No side effect */ diff --git a/tests/tests/src/event_ffi.mjs b/tests/tests/src/event_ffi.mjs new file mode 100644 index 0000000000..ec47eeae4c --- /dev/null +++ b/tests/tests/src/event_ffi.mjs @@ -0,0 +1,77 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +function h0(x) { + return x(); +} + +function h00(x) { + return x(); +} + +function h1(x, y) { + return x(y); +} + +function h10(x) { + return x(3); +} + +function h30(x) { + return a => x(3, 3, a); +} + +function h33(x) { + return x(1, 2, 3); +} + +function h34(x) { + return x(1, 2, 3)(4); +} + +function ocaml_run(b, c) { + return (1 + b | 0) + c | 0; +} + +function a0() { + console.log("hi"); +} + +function a1() { + return x => x; +} + +function a2(x, y) { + return x + y | 0; +} + +function a3(x, y, z) { + return (x + y | 0) + z | 0; +} + +function xx() { + return param => { + console.log(3); + }; +} + +let test_as = Belt_List.map; + +export { + h0, + h00, + h1, + h10, + h30, + h33, + h34, + ocaml_run, + a0, + a1, + a2, + a3, + test_as, + xx, +} +/* No side effect */ diff --git a/tests/tests/src/exception_alias.js b/tests/tests/src/exception_alias.js deleted file mode 100644 index 5c4bc893e7..0000000000 --- a/tests/tests/src/exception_alias.js +++ /dev/null @@ -1,127 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -let a0 = { - RE_EXN_ID: "Not_found" -}; - -let b = Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}); - -let List = { - size: Belt_List.size, - head: Belt_List.head, - headExn: Belt_List.headExn, - tail: Belt_List.tail, - tailExn: Belt_List.tailExn, - add: Belt_List.add, - get: Belt_List.get, - getExn: Belt_List.getExn, - make: Belt_List.make, - makeByU: Belt_List.makeByU, - makeBy: Belt_List.makeBy, - shuffle: Belt_List.shuffle, - drop: Belt_List.drop, - take: Belt_List.take, - splitAt: Belt_List.splitAt, - concat: Belt_List.concat, - concatMany: Belt_List.concatMany, - reverseConcat: Belt_List.reverseConcat, - flatten: Belt_List.flatten, - mapU: Belt_List.mapU, - map: Belt_List.map, - zip: Belt_List.zip, - zipByU: Belt_List.zipByU, - zipBy: Belt_List.zipBy, - mapWithIndexU: Belt_List.mapWithIndexU, - mapWithIndex: Belt_List.mapWithIndex, - fromArray: Belt_List.fromArray, - toArray: Belt_List.toArray, - reverse: Belt_List.reverse, - mapReverseU: Belt_List.mapReverseU, - mapReverse: Belt_List.mapReverse, - forEachU: Belt_List.forEachU, - forEach: Belt_List.forEach, - forEachWithIndexU: Belt_List.forEachWithIndexU, - forEachWithIndex: Belt_List.forEachWithIndex, - reduceU: Belt_List.reduceU, - reduce: Belt_List.reduce, - reduceWithIndexU: Belt_List.reduceWithIndexU, - reduceWithIndex: Belt_List.reduceWithIndex, - reduceReverseU: Belt_List.reduceReverseU, - reduceReverse: Belt_List.reduceReverse, - mapReverse2U: Belt_List.mapReverse2U, - mapReverse2: Belt_List.mapReverse2, - forEach2U: Belt_List.forEach2U, - forEach2: Belt_List.forEach2, - reduce2U: Belt_List.reduce2U, - reduce2: Belt_List.reduce2, - reduceReverse2U: Belt_List.reduceReverse2U, - reduceReverse2: Belt_List.reduceReverse2, - everyU: Belt_List.everyU, - every: Belt_List.every, - someU: Belt_List.someU, - some: Belt_List.some, - every2U: Belt_List.every2U, - every2: Belt_List.every2, - some2U: Belt_List.some2U, - some2: Belt_List.some2, - cmpByLength: Belt_List.cmpByLength, - cmpU: Belt_List.cmpU, - cmp: Belt_List.cmp, - eqU: Belt_List.eqU, - eq: Belt_List.eq, - hasU: Belt_List.hasU, - has: Belt_List.has, - getByU: Belt_List.getByU, - getBy: Belt_List.getBy, - keepU: Belt_List.keepU, - keep: Belt_List.keep, - filter: Belt_List.filter, - keepWithIndexU: Belt_List.keepWithIndexU, - keepWithIndex: Belt_List.keepWithIndex, - filterWithIndex: Belt_List.filterWithIndex, - keepMapU: Belt_List.keepMapU, - keepMap: Belt_List.keepMap, - partitionU: Belt_List.partitionU, - partition: Belt_List.partition, - unzip: Belt_List.unzip, - getAssocU: Belt_List.getAssocU, - getAssoc: Belt_List.getAssoc, - hasAssocU: Belt_List.hasAssocU, - hasAssoc: Belt_List.hasAssoc, - removeAssocU: Belt_List.removeAssocU, - removeAssoc: Belt_List.removeAssoc, - setAssocU: Belt_List.setAssocU, - setAssoc: Belt_List.setAssoc, - sortU: Belt_List.sortU, - sort: Belt_List.sort, - b: b, - length: 3 -}; - -let a1 = a0; - -let a2 = a0; - -let a3 = a0; - -let a4 = a0; - -let a5 = a0; - -exports.a0 = a0; -exports.a1 = a1; -exports.a2 = a2; -exports.a3 = a3; -exports.a4 = a4; -exports.a5 = a5; -exports.List = List; -/* b Not a pure module */ diff --git a/tests/tests/src/exception_alias.mjs b/tests/tests/src/exception_alias.mjs new file mode 100644 index 0000000000..2b2cac959e --- /dev/null +++ b/tests/tests/src/exception_alias.mjs @@ -0,0 +1,128 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +let a0 = { + RE_EXN_ID: "Not_found" +}; + +let b = Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}); + +let List = { + size: Belt_List.size, + head: Belt_List.head, + headExn: Belt_List.headExn, + tail: Belt_List.tail, + tailExn: Belt_List.tailExn, + add: Belt_List.add, + get: Belt_List.get, + getExn: Belt_List.getExn, + make: Belt_List.make, + makeByU: Belt_List.makeByU, + makeBy: Belt_List.makeBy, + shuffle: Belt_List.shuffle, + drop: Belt_List.drop, + take: Belt_List.take, + splitAt: Belt_List.splitAt, + concat: Belt_List.concat, + concatMany: Belt_List.concatMany, + reverseConcat: Belt_List.reverseConcat, + flatten: Belt_List.flatten, + mapU: Belt_List.mapU, + map: Belt_List.map, + zip: Belt_List.zip, + zipByU: Belt_List.zipByU, + zipBy: Belt_List.zipBy, + mapWithIndexU: Belt_List.mapWithIndexU, + mapWithIndex: Belt_List.mapWithIndex, + fromArray: Belt_List.fromArray, + toArray: Belt_List.toArray, + reverse: Belt_List.reverse, + mapReverseU: Belt_List.mapReverseU, + mapReverse: Belt_List.mapReverse, + forEachU: Belt_List.forEachU, + forEach: Belt_List.forEach, + forEachWithIndexU: Belt_List.forEachWithIndexU, + forEachWithIndex: Belt_List.forEachWithIndex, + reduceU: Belt_List.reduceU, + reduce: Belt_List.reduce, + reduceWithIndexU: Belt_List.reduceWithIndexU, + reduceWithIndex: Belt_List.reduceWithIndex, + reduceReverseU: Belt_List.reduceReverseU, + reduceReverse: Belt_List.reduceReverse, + mapReverse2U: Belt_List.mapReverse2U, + mapReverse2: Belt_List.mapReverse2, + forEach2U: Belt_List.forEach2U, + forEach2: Belt_List.forEach2, + reduce2U: Belt_List.reduce2U, + reduce2: Belt_List.reduce2, + reduceReverse2U: Belt_List.reduceReverse2U, + reduceReverse2: Belt_List.reduceReverse2, + everyU: Belt_List.everyU, + every: Belt_List.every, + someU: Belt_List.someU, + some: Belt_List.some, + every2U: Belt_List.every2U, + every2: Belt_List.every2, + some2U: Belt_List.some2U, + some2: Belt_List.some2, + cmpByLength: Belt_List.cmpByLength, + cmpU: Belt_List.cmpU, + cmp: Belt_List.cmp, + eqU: Belt_List.eqU, + eq: Belt_List.eq, + hasU: Belt_List.hasU, + has: Belt_List.has, + getByU: Belt_List.getByU, + getBy: Belt_List.getBy, + keepU: Belt_List.keepU, + keep: Belt_List.keep, + filter: Belt_List.filter, + keepWithIndexU: Belt_List.keepWithIndexU, + keepWithIndex: Belt_List.keepWithIndex, + filterWithIndex: Belt_List.filterWithIndex, + keepMapU: Belt_List.keepMapU, + keepMap: Belt_List.keepMap, + partitionU: Belt_List.partitionU, + partition: Belt_List.partition, + unzip: Belt_List.unzip, + getAssocU: Belt_List.getAssocU, + getAssoc: Belt_List.getAssoc, + hasAssocU: Belt_List.hasAssocU, + hasAssoc: Belt_List.hasAssoc, + removeAssocU: Belt_List.removeAssocU, + removeAssoc: Belt_List.removeAssoc, + setAssocU: Belt_List.setAssocU, + setAssoc: Belt_List.setAssoc, + sortU: Belt_List.sortU, + sort: Belt_List.sort, + b: b, + length: 3 +}; + +let a1 = a0; + +let a2 = a0; + +let a3 = a0; + +let a4 = a0; + +let a5 = a0; + +export { + a0, + a1, + a2, + a3, + a4, + a5, + List, +} +/* b Not a pure module */ diff --git a/tests/tests/src/exception_raise_test.js b/tests/tests/src/exception_raise_test.js deleted file mode 100644 index 4b7f7b2fba..0000000000 --- a/tests/tests/src/exception_raise_test.js +++ /dev/null @@ -1,244 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Exn = require("rescript/lib/js/Exn.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let Local = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.Local"); - -let B = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.B"); - -let C = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.C"); - -let D = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.D"); - -function appf(g, x) { - let A = /* @__PURE__ */Primitive_exceptions.create("A"); - try { - return g(x); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === Local) { - return 3; - } - if (exn.RE_EXN_ID === "Not_found") { - return 2; - } - if (exn.RE_EXN_ID === A) { - return 3; - } - if (exn.RE_EXN_ID !== B) { - if (exn.RE_EXN_ID === C) { - return exn._1; - } else if (exn.RE_EXN_ID === D) { - return exn._1[0]; - } else { - return 4; - } - } - let match = exn._1; - if (!match) { - return 4; - } - let match$1 = match.tl; - if (!match$1) { - return 4; - } - let match$2 = match$1.tl; - if (match$2) { - return match$2.hd; - } else { - return 4; - } - } -} - -let A = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.A"); - -let f; - -try { - f = (function () {throw (new Error ("x"))} ()); -} catch (raw_x) { - let x = Primitive_exceptions.internalToException(raw_x); - f = x.RE_EXN_ID === A ? x._1 : 2; -} - -let ff; - -try { - ff = (function () {throw 3} ()); -} catch (raw_x$1) { - let x$1 = Primitive_exceptions.internalToException(raw_x$1); - ff = x$1.RE_EXN_ID === A ? x$1._1 : 2; -} - -let fff; - -try { - fff = (function () {throw 2} ()); -} catch (raw_x$2) { - let x$2 = Primitive_exceptions.internalToException(raw_x$2); - fff = x$2.RE_EXN_ID === A ? x$2._1 : 2; -} - -let a0; - -try { - a0 = (function (){throw 2} ()); -} catch (raw_x$3) { - let x$3 = Primitive_exceptions.internalToException(raw_x$3); - if (x$3.RE_EXN_ID === A || x$3.RE_EXN_ID === Exn.$$Error) { - a0 = x$3._1; - } else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_raise_test.res", - 104, - 7 - ], - Error: new Error() - }; - } -} - -let a1; - -try { - a1 = (function (){throw 2} ()); -} catch (raw_e) { - a1 = Primitive_exceptions.internalToException(raw_e); -} - -let a2; - -try { - a2 = (function (){throw (new Error("x"))} ()); -} catch (raw_e$1) { - a2 = Primitive_exceptions.internalToException(raw_e$1); -} - -let suites = { - contents: { - hd: [ - "File \"exception_raise_test.res\", line 120, characters 5-12", - () => ({ - TAG: "Eq", - _0: [ - f, - ff, - fff, - a0 - ], - _1: [ - 2, - 2, - 2, - 2 - ] - }) - ], - tl: { - hd: [ - "File \"exception_raise_test.res\", line 123, characters 6-13", - () => { - if (a1.RE_EXN_ID === Exn.$$Error) { - return { - TAG: "Eq", - _0: a1._1, - _1: 2 - }; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_raise_test.res", - 127, - 15 - ], - Error: new Error() - }; - } - ], - tl: /* [] */0 - } - } -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -try { - ((()=>{throw 2})()); -} catch (raw_e$2) { - let e = Primitive_exceptions.internalToException(raw_e$2); - eq("File \"exception_raise_test.res\", line 137, characters 10-17", Exn.asJsExn(e) !== undefined, true); -} - -try { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -} catch (raw_e$3) { - let e$1 = Primitive_exceptions.internalToException(raw_e$3); - eq("File \"exception_raise_test.res\", line 141, characters 10-17", Exn.asJsExn(e$1) !== undefined, false); -} - -function fff0(x, g) { - let val; - try { - val = x(); - } catch (exn) { - return 1; - } - return g(); -} - -function input_lines(ic, _acc) { - while (true) { - let acc = _acc; - let line; - try { - line = input_line(ic); - } catch (exn) { - return Belt_List.reverse(acc); - } - _acc = { - hd: line, - tl: acc - }; - continue; - }; -} - -eq("File \"exception_raise_test.res\", line 157, characters 12-19", ((a,b,c,_) => a + b + c)(1, 2, 3, 4), 6); - -Mt.from_pair_suites("Exception_raise_test", suites.contents); - -exports.Local = Local; -exports.B = B; -exports.C = C; -exports.D = D; -exports.appf = appf; -exports.A = A; -exports.f = f; -exports.ff = ff; -exports.fff = fff; -exports.a0 = a0; -exports.a1 = a1; -exports.a2 = a2; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.fff0 = fff0; -exports.input_lines = input_lines; -/* f Not a pure module */ diff --git a/tests/tests/src/exception_raise_test.mjs b/tests/tests/src/exception_raise_test.mjs new file mode 100644 index 0000000000..571bbff0e5 --- /dev/null +++ b/tests/tests/src/exception_raise_test.mjs @@ -0,0 +1,245 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Exn from "rescript/lib/es6/Exn.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let Local = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.Local"); + +let B = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.B"); + +let C = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.C"); + +let D = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.D"); + +function appf(g, x) { + let A = /* @__PURE__ */Primitive_exceptions.create("A"); + try { + return g(x); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === Local) { + return 3; + } + if (exn.RE_EXN_ID === "Not_found") { + return 2; + } + if (exn.RE_EXN_ID === A) { + return 3; + } + if (exn.RE_EXN_ID !== B) { + if (exn.RE_EXN_ID === C) { + return exn._1; + } else if (exn.RE_EXN_ID === D) { + return exn._1[0]; + } else { + return 4; + } + } + let match = exn._1; + if (!match) { + return 4; + } + let match$1 = match.tl; + if (!match$1) { + return 4; + } + let match$2 = match$1.tl; + if (match$2) { + return match$2.hd; + } else { + return 4; + } + } +} + +let A = /* @__PURE__ */Primitive_exceptions.create("Exception_raise_test.A"); + +let f; + +try { + f = (function () {throw (new Error ("x"))} ()); +} catch (raw_x) { + let x = Primitive_exceptions.internalToException(raw_x); + f = x.RE_EXN_ID === A ? x._1 : 2; +} + +let ff; + +try { + ff = (function () {throw 3} ()); +} catch (raw_x$1) { + let x$1 = Primitive_exceptions.internalToException(raw_x$1); + ff = x$1.RE_EXN_ID === A ? x$1._1 : 2; +} + +let fff; + +try { + fff = (function () {throw 2} ()); +} catch (raw_x$2) { + let x$2 = Primitive_exceptions.internalToException(raw_x$2); + fff = x$2.RE_EXN_ID === A ? x$2._1 : 2; +} + +let a0; + +try { + a0 = (function (){throw 2} ()); +} catch (raw_x$3) { + let x$3 = Primitive_exceptions.internalToException(raw_x$3); + if (x$3.RE_EXN_ID === A || x$3.RE_EXN_ID === Exn.$$Error) { + a0 = x$3._1; + } else { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 104, + 7 + ], + Error: new Error() + }; + } +} + +let a1; + +try { + a1 = (function (){throw 2} ()); +} catch (raw_e) { + a1 = Primitive_exceptions.internalToException(raw_e); +} + +let a2; + +try { + a2 = (function (){throw (new Error("x"))} ()); +} catch (raw_e$1) { + a2 = Primitive_exceptions.internalToException(raw_e$1); +} + +let suites = { + contents: { + hd: [ + "File \"exception_raise_test.res\", line 120, characters 5-12", + () => ({ + TAG: "Eq", + _0: [ + f, + ff, + fff, + a0 + ], + _1: [ + 2, + 2, + 2, + 2 + ] + }) + ], + tl: { + hd: [ + "File \"exception_raise_test.res\", line 123, characters 6-13", + () => { + if (a1.RE_EXN_ID === Exn.$$Error) { + return { + TAG: "Eq", + _0: a1._1, + _1: 2 + }; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_raise_test.res", + 127, + 15 + ], + Error: new Error() + }; + } + ], + tl: /* [] */0 + } + } +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +try { + ((()=>{throw 2})()); +} catch (raw_e$2) { + let e = Primitive_exceptions.internalToException(raw_e$2); + eq("File \"exception_raise_test.res\", line 137, characters 10-17", Exn.asJsExn(e) !== undefined, true); +} + +try { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; +} catch (raw_e$3) { + let e$1 = Primitive_exceptions.internalToException(raw_e$3); + eq("File \"exception_raise_test.res\", line 141, characters 10-17", Exn.asJsExn(e$1) !== undefined, false); +} + +function fff0(x, g) { + let val; + try { + val = x(); + } catch (exn) { + return 1; + } + return g(); +} + +function input_lines(ic, _acc) { + while (true) { + let acc = _acc; + let line; + try { + line = input_line(ic); + } catch (exn) { + return Belt_List.reverse(acc); + } + _acc = { + hd: line, + tl: acc + }; + continue; + }; +} + +eq("File \"exception_raise_test.res\", line 157, characters 12-19", ((a,b,c,_) => a + b + c)(1, 2, 3, 4), 6); + +Mt.from_pair_suites("Exception_raise_test", suites.contents); + +export { + Local, + B, + C, + D, + appf, + A, + f, + ff, + fff, + a0, + a1, + a2, + suites, + test_id, + eq, + fff0, + input_lines, +} +/* f Not a pure module */ diff --git a/tests/tests/src/exception_rebound_err_test.js b/tests/tests/src/exception_rebound_err_test.js deleted file mode 100644 index 4852b7d73d..0000000000 --- a/tests/tests/src/exception_rebound_err_test.js +++ /dev/null @@ -1,88 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let A = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.A"); - -let B = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.B"); - -let C = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.C"); - -function test_js_error4() { - try { - JSON.parse(" {\"x\"}"); - return 1; - } catch (raw_e) { - let e = Primitive_exceptions.internalToException(raw_e); - if (e.RE_EXN_ID === "Not_found") { - return 2; - } - if (e.RE_EXN_ID === "Invalid_argument" && e._1 === "x") { - return 3; - } - if (e.RE_EXN_ID === A) { - if (e._1 !== 2) { - return 7; - } else { - return 4; - } - } else if (e.RE_EXN_ID === B) { - return 5; - } else if (e.RE_EXN_ID === C && !(e._1 !== 1 || e._2 !== 2)) { - return 6; - } else { - return 7; - } - } -} - -function f(g) { - try { - return g(); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "Not_found") { - return 1; - } - throw exn; - } -} - -eq("File \"exception_rebound_err_test.res\", line 34, characters 3-10", test_js_error4(), 7); - -Mt.from_pair_suites("Exception_rebound_err_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.A = A; -exports.B = B; -exports.C = C; -exports.test_js_error4 = test_js_error4; -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/exception_rebound_err_test.mjs b/tests/tests/src/exception_rebound_err_test.mjs new file mode 100644 index 0000000000..a43cea2ec0 --- /dev/null +++ b/tests/tests/src/exception_rebound_err_test.mjs @@ -0,0 +1,89 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let A = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.A"); + +let B = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.B"); + +let C = /* @__PURE__ */Primitive_exceptions.create("Exception_rebound_err_test.C"); + +function test_js_error4() { + try { + JSON.parse(" {\"x\"}"); + return 1; + } catch (raw_e) { + let e = Primitive_exceptions.internalToException(raw_e); + if (e.RE_EXN_ID === "Not_found") { + return 2; + } + if (e.RE_EXN_ID === "Invalid_argument" && e._1 === "x") { + return 3; + } + if (e.RE_EXN_ID === A) { + if (e._1 !== 2) { + return 7; + } else { + return 4; + } + } else if (e.RE_EXN_ID === B) { + return 5; + } else if (e.RE_EXN_ID === C && !(e._1 !== 1 || e._2 !== 2)) { + return 6; + } else { + return 7; + } + } +} + +function f(g) { + try { + return g(); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "Not_found") { + return 1; + } + throw exn; + } +} + +eq("File \"exception_rebound_err_test.res\", line 34, characters 3-10", test_js_error4(), 7); + +Mt.from_pair_suites("Exception_rebound_err_test", suites.contents); + +export { + suites, + test_id, + eq, + A, + B, + C, + test_js_error4, + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/exception_value_test.js b/tests/tests/src/exception_value_test.js deleted file mode 100644 index dccedce368..0000000000 --- a/tests/tests/src/exception_value_test.js +++ /dev/null @@ -1,91 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Exn = require("rescript/lib/js/Exn.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -function f() { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -} - -function assert_f(x) { - if (x <= 3) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "exception_value_test.res", - 4, - 11 - ], - Error: new Error() - }; - } - return 3; -} - -function hh() { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -} - -let A = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.A"); - -let B = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.B"); - -let C = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.C"); - -let u = { - RE_EXN_ID: A, - _1: 3 -}; - -function test_not_found(f, param) { - try { - return f(); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "Not_found") { - return 2; - } - throw exn; - } -} - -function test_js_error2() { - try { - return JSON.parse(" {\"x\" : }"); - } catch (raw_e) { - let e = Primitive_exceptions.internalToException(raw_e); - if (e.RE_EXN_ID === Exn.$$Error) { - console.log(e._1.stack); - throw e; - } - throw e; - } -} - -function test_js_error3() { - try { - JSON.parse(" {\"x\"}"); - return 1; - } catch (e) { - return 0; - } -} - -exports.f = f; -exports.assert_f = assert_f; -exports.hh = hh; -exports.A = A; -exports.B = B; -exports.C = C; -exports.u = u; -exports.test_not_found = test_not_found; -exports.test_js_error2 = test_js_error2; -exports.test_js_error3 = test_js_error3; -/* No side effect */ diff --git a/tests/tests/src/exception_value_test.mjs b/tests/tests/src/exception_value_test.mjs new file mode 100644 index 0000000000..4b84d820d4 --- /dev/null +++ b/tests/tests/src/exception_value_test.mjs @@ -0,0 +1,92 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Exn from "rescript/lib/es6/Exn.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +function f() { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; +} + +function assert_f(x) { + if (x <= 3) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "exception_value_test.res", + 4, + 11 + ], + Error: new Error() + }; + } + return 3; +} + +function hh() { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; +} + +let A = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.A"); + +let B = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.B"); + +let C = /* @__PURE__ */Primitive_exceptions.create("Exception_value_test.C"); + +let u = { + RE_EXN_ID: A, + _1: 3 +}; + +function test_not_found(f, param) { + try { + return f(); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "Not_found") { + return 2; + } + throw exn; + } +} + +function test_js_error2() { + try { + return JSON.parse(" {\"x\" : }"); + } catch (raw_e) { + let e = Primitive_exceptions.internalToException(raw_e); + if (e.RE_EXN_ID === Exn.$$Error) { + console.log(e._1.stack); + throw e; + } + throw e; + } +} + +function test_js_error3() { + try { + JSON.parse(" {\"x\"}"); + return 1; + } catch (e) { + return 0; + } +} + +export { + f, + assert_f, + hh, + A, + B, + C, + u, + test_not_found, + test_js_error2, + test_js_error3, +} +/* No side effect */ diff --git a/tests/tests/src/exotic_labels_test.js b/tests/tests/src/exotic_labels_test.js deleted file mode 100644 index f2287e6b87..0000000000 --- a/tests/tests/src/exotic_labels_test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function fn1(v) { - return v.field; -} - -let dict = { - key: 1, - KEY: 1 -}; - -exports.fn1 = fn1; -exports.dict = dict; -/* No side effect */ diff --git a/tests/tests/src/exotic_labels_test.mjs b/tests/tests/src/exotic_labels_test.mjs new file mode 100644 index 0000000000..6aceb11261 --- /dev/null +++ b/tests/tests/src/exotic_labels_test.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function fn1(v) { + return v.field; +} + +let dict = { + key: 1, + KEY: 1 +}; + +export { + fn1, + dict, +} +/* No side effect */ diff --git a/tests/tests/src/exponentiation_precedence_test.js b/tests/tests/src/exponentiation_precedence_test.js deleted file mode 100644 index 9b5fbe7102..0000000000 --- a/tests/tests/src/exponentiation_precedence_test.js +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let a = Math.pow(2, Math.pow(3, 2)); - -let b = Math.pow(2, Math.pow(-3, 2)); - -let c = Math.pow(Math.pow(2, 3), 2); - -let d = Math.pow(-2, 2); - -exports.a = a; -exports.b = b; -exports.c = c; -exports.d = d; -/* a Not a pure module */ diff --git a/tests/tests/src/exponentiation_precedence_test.mjs b/tests/tests/src/exponentiation_precedence_test.mjs new file mode 100644 index 0000000000..1f84a4ec3c --- /dev/null +++ b/tests/tests/src/exponentiation_precedence_test.mjs @@ -0,0 +1,18 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let a = Math.pow(2, Math.pow(3, 2)); + +let b = Math.pow(2, Math.pow(-3, 2)); + +let c = Math.pow(Math.pow(2, 3), 2); + +let d = Math.pow(-2, 2); + +export { + a, + b, + c, + d, +} +/* a Not a pure module */ diff --git a/tests/tests/src/export_keyword.js b/tests/tests/src/export_keyword.js deleted file mode 100644 index 7d53aca900..0000000000 --- a/tests/tests/src/export_keyword.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let $$case = 3; - -let window = 2; - -let $$switch = 3; - -exports.$$case = $$case; -exports.window = window; -exports.$$switch = $$switch; -/* No side effect */ diff --git a/tests/tests/src/export_keyword.mjs b/tests/tests/src/export_keyword.mjs new file mode 100644 index 0000000000..43fcd33f8c --- /dev/null +++ b/tests/tests/src/export_keyword.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let $$case = 3; + +let window = 2; + +let $$switch = 3; + +export { + $$case, + window, + $$switch, +} +/* No side effect */ diff --git a/tests/tests/src/ext_array_test.js b/tests/tests/src/ext_array_test.js deleted file mode 100644 index d506904b7f..0000000000 --- a/tests/tests/src/ext_array_test.js +++ /dev/null @@ -1,298 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -function reverse_range(a, i, len) { - if (len === 0) { - return; - } - for (let k = 0, k_finish = (len - 1 | 0) / 2 | 0; k <= k_finish; ++k) { - let t = a[i + k | 0]; - a[i + k | 0] = a[((i + len | 0) - 1 | 0) - k | 0]; - a[((i + len | 0) - 1 | 0) - k | 0] = t; - } -} - -function reverse_in_place(a) { - reverse_range(a, 0, a.length); -} - -function reverse(a) { - let b_len = a.length; - if (b_len === 0) { - return []; - } - let b = a.slice(0); - for (let i = 0; i < b_len; ++i) { - b[i] = a[(b_len - 1 | 0) - i | 0]; - } - return b; -} - -function reverse_of_list(x) { - if (!x) { - return []; - } - let len = Belt_List.length(x); - let a = Belt_Array.make(len, x.hd); - let _i = 0; - let _x = x.tl; - while (true) { - let x$1 = _x; - let i = _i; - if (!x$1) { - return a; - } - a[(len - i | 0) - 2 | 0] = x$1.hd; - _x = x$1.tl; - _i = i + 1 | 0; - continue; - }; -} - -function filter(f, a) { - let arr_len = a.length; - let _acc = /* [] */0; - let _i = 0; - while (true) { - let i = _i; - let acc = _acc; - if (i === arr_len) { - return reverse_of_list(acc); - } - let v = a[i]; - if (f(v)) { - _i = i + 1 | 0; - _acc = { - hd: v, - tl: acc - }; - continue; - } - _i = i + 1 | 0; - continue; - }; -} - -function filter_map(f, a) { - let arr_len = a.length; - let _acc = /* [] */0; - let _i = 0; - while (true) { - let i = _i; - let acc = _acc; - if (i === arr_len) { - return reverse_of_list(acc); - } - let v = a[i]; - let v$1 = f(v); - if (v$1 !== undefined) { - _i = i + 1 | 0; - _acc = { - hd: Primitive_option.valFromOption(v$1), - tl: acc - }; - continue; - } - _i = i + 1 | 0; - continue; - }; -} - -function range(from, to_) { - if (from > to_) { - return Pervasives.invalid_arg("Ext_array_test.range"); - } else { - return Belt_Array.init((to_ - from | 0) + 1 | 0, i => i + from | 0); - } -} - -function map2i(f, a, b) { - let len = a.length; - if (len !== b.length) { - return Pervasives.invalid_arg("Ext_array_test.map2i"); - } else { - return Belt_Array.mapWithIndex(a, (i, a) => f(i, a, b[i])); - } -} - -function tolist_aux(a, f, _i, _res) { - while (true) { - let res = _res; - let i = _i; - if (i < 0) { - return res; - } - let v = a[i]; - let v$1 = f(v); - _res = v$1 !== undefined ? ({ - hd: Primitive_option.valFromOption(v$1), - tl: res - }) : res; - _i = i - 1 | 0; - continue; - }; -} - -function to_list_map(f, a) { - return tolist_aux(a, f, a.length - 1 | 0, /* [] */0); -} - -function to_list_map_acc(f, a, acc) { - return tolist_aux(a, f, a.length - 1 | 0, acc); -} - -function of_list_map(f, a) { - if (!a) { - return []; - } - let tl = a.tl; - let hd = f(a.hd); - let len = Belt_List.length(tl) + 1 | 0; - let arr = Belt_Array.make(len, hd); - let _i = 1; - let _x = tl; - while (true) { - let x = _x; - let i = _i; - if (!x) { - return arr; - } - arr[i] = f(x.hd); - _x = x.tl; - _i = i + 1 | 0; - continue; - }; -} - -function rfind_with_index(arr, cmp, v) { - let len = arr.length; - let _i = len - 1 | 0; - while (true) { - let i = _i; - if (i < 0) { - return i; - } - if (cmp(arr[i], v)) { - return i; - } - _i = i - 1 | 0; - continue; - }; -} - -function rfind_and_split(arr, cmp, v) { - let i = rfind_with_index(arr, cmp, v); - if (i < 0) { - return "No_split"; - } else { - return { - NAME: "Split", - VAL: [ - Belt_Array.slice(arr, 0, i), - Belt_Array.slice(arr, i + 1 | 0, (arr.length - i | 0) - 1 | 0) - ] - }; - } -} - -function find_with_index(arr, cmp, v) { - let len = arr.length; - let _i = 0; - while (true) { - let i = _i; - if (i >= len) { - return -1; - } - if (cmp(arr[i], v)) { - return i; - } - _i = i + 1 | 0; - continue; - }; -} - -function find_and_split(arr, cmp, v) { - let i = find_with_index(arr, cmp, v); - if (i < 0) { - return "No_split"; - } else { - return { - NAME: "Split", - VAL: [ - Belt_Array.slice(arr, 0, i), - Belt_Array.slice(arr, i + 1 | 0, (arr.length - i | 0) - 1 | 0) - ] - }; - } -} - -function exists(p, a) { - let n = a.length; - let _i = 0; - while (true) { - let i = _i; - if (i === n) { - return false; - } - if (p(a[i])) { - return true; - } - _i = i + 1 | 0; - continue; - }; -} - -function is_empty(arr) { - return arr.length === 0; -} - -function unsafe_loop(_index, len, p, xs, ys) { - while (true) { - let index = _index; - if (index >= len) { - return true; - } - if (!p(xs[index], ys[index])) { - return false; - } - _index = index + 1 | 0; - continue; - }; -} - -function for_all2_no_exn(p, xs, ys) { - let len_xs = xs.length; - let len_ys = ys.length; - if (len_xs === len_ys) { - return unsafe_loop(0, len_xs, p, xs, ys); - } else { - return false; - } -} - -exports.reverse_range = reverse_range; -exports.reverse_in_place = reverse_in_place; -exports.reverse = reverse; -exports.reverse_of_list = reverse_of_list; -exports.filter = filter; -exports.filter_map = filter_map; -exports.range = range; -exports.map2i = map2i; -exports.tolist_aux = tolist_aux; -exports.to_list_map = to_list_map; -exports.to_list_map_acc = to_list_map_acc; -exports.of_list_map = of_list_map; -exports.rfind_with_index = rfind_with_index; -exports.rfind_and_split = rfind_and_split; -exports.find_with_index = find_with_index; -exports.find_and_split = find_and_split; -exports.exists = exists; -exports.is_empty = is_empty; -exports.unsafe_loop = unsafe_loop; -exports.for_all2_no_exn = for_all2_no_exn; -/* No side effect */ diff --git a/tests/tests/src/ext_array_test.mjs b/tests/tests/src/ext_array_test.mjs new file mode 100644 index 0000000000..0ca8a94fe9 --- /dev/null +++ b/tests/tests/src/ext_array_test.mjs @@ -0,0 +1,299 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +function reverse_range(a, i, len) { + if (len === 0) { + return; + } + for (let k = 0, k_finish = (len - 1 | 0) / 2 | 0; k <= k_finish; ++k) { + let t = a[i + k | 0]; + a[i + k | 0] = a[((i + len | 0) - 1 | 0) - k | 0]; + a[((i + len | 0) - 1 | 0) - k | 0] = t; + } +} + +function reverse_in_place(a) { + reverse_range(a, 0, a.length); +} + +function reverse(a) { + let b_len = a.length; + if (b_len === 0) { + return []; + } + let b = a.slice(0); + for (let i = 0; i < b_len; ++i) { + b[i] = a[(b_len - 1 | 0) - i | 0]; + } + return b; +} + +function reverse_of_list(x) { + if (!x) { + return []; + } + let len = Belt_List.length(x); + let a = Belt_Array.make(len, x.hd); + let _i = 0; + let _x = x.tl; + while (true) { + let x$1 = _x; + let i = _i; + if (!x$1) { + return a; + } + a[(len - i | 0) - 2 | 0] = x$1.hd; + _x = x$1.tl; + _i = i + 1 | 0; + continue; + }; +} + +function filter(f, a) { + let arr_len = a.length; + let _acc = /* [] */0; + let _i = 0; + while (true) { + let i = _i; + let acc = _acc; + if (i === arr_len) { + return reverse_of_list(acc); + } + let v = a[i]; + if (f(v)) { + _i = i + 1 | 0; + _acc = { + hd: v, + tl: acc + }; + continue; + } + _i = i + 1 | 0; + continue; + }; +} + +function filter_map(f, a) { + let arr_len = a.length; + let _acc = /* [] */0; + let _i = 0; + while (true) { + let i = _i; + let acc = _acc; + if (i === arr_len) { + return reverse_of_list(acc); + } + let v = a[i]; + let v$1 = f(v); + if (v$1 !== undefined) { + _i = i + 1 | 0; + _acc = { + hd: Primitive_option.valFromOption(v$1), + tl: acc + }; + continue; + } + _i = i + 1 | 0; + continue; + }; +} + +function range(from, to_) { + if (from > to_) { + return Pervasives.invalid_arg("Ext_array_test.range"); + } else { + return Belt_Array.init((to_ - from | 0) + 1 | 0, i => i + from | 0); + } +} + +function map2i(f, a, b) { + let len = a.length; + if (len !== b.length) { + return Pervasives.invalid_arg("Ext_array_test.map2i"); + } else { + return Belt_Array.mapWithIndex(a, (i, a) => f(i, a, b[i])); + } +} + +function tolist_aux(a, f, _i, _res) { + while (true) { + let res = _res; + let i = _i; + if (i < 0) { + return res; + } + let v = a[i]; + let v$1 = f(v); + _res = v$1 !== undefined ? ({ + hd: Primitive_option.valFromOption(v$1), + tl: res + }) : res; + _i = i - 1 | 0; + continue; + }; +} + +function to_list_map(f, a) { + return tolist_aux(a, f, a.length - 1 | 0, /* [] */0); +} + +function to_list_map_acc(f, a, acc) { + return tolist_aux(a, f, a.length - 1 | 0, acc); +} + +function of_list_map(f, a) { + if (!a) { + return []; + } + let tl = a.tl; + let hd = f(a.hd); + let len = Belt_List.length(tl) + 1 | 0; + let arr = Belt_Array.make(len, hd); + let _i = 1; + let _x = tl; + while (true) { + let x = _x; + let i = _i; + if (!x) { + return arr; + } + arr[i] = f(x.hd); + _x = x.tl; + _i = i + 1 | 0; + continue; + }; +} + +function rfind_with_index(arr, cmp, v) { + let len = arr.length; + let _i = len - 1 | 0; + while (true) { + let i = _i; + if (i < 0) { + return i; + } + if (cmp(arr[i], v)) { + return i; + } + _i = i - 1 | 0; + continue; + }; +} + +function rfind_and_split(arr, cmp, v) { + let i = rfind_with_index(arr, cmp, v); + if (i < 0) { + return "No_split"; + } else { + return { + NAME: "Split", + VAL: [ + Belt_Array.slice(arr, 0, i), + Belt_Array.slice(arr, i + 1 | 0, (arr.length - i | 0) - 1 | 0) + ] + }; + } +} + +function find_with_index(arr, cmp, v) { + let len = arr.length; + let _i = 0; + while (true) { + let i = _i; + if (i >= len) { + return -1; + } + if (cmp(arr[i], v)) { + return i; + } + _i = i + 1 | 0; + continue; + }; +} + +function find_and_split(arr, cmp, v) { + let i = find_with_index(arr, cmp, v); + if (i < 0) { + return "No_split"; + } else { + return { + NAME: "Split", + VAL: [ + Belt_Array.slice(arr, 0, i), + Belt_Array.slice(arr, i + 1 | 0, (arr.length - i | 0) - 1 | 0) + ] + }; + } +} + +function exists(p, a) { + let n = a.length; + let _i = 0; + while (true) { + let i = _i; + if (i === n) { + return false; + } + if (p(a[i])) { + return true; + } + _i = i + 1 | 0; + continue; + }; +} + +function is_empty(arr) { + return arr.length === 0; +} + +function unsafe_loop(_index, len, p, xs, ys) { + while (true) { + let index = _index; + if (index >= len) { + return true; + } + if (!p(xs[index], ys[index])) { + return false; + } + _index = index + 1 | 0; + continue; + }; +} + +function for_all2_no_exn(p, xs, ys) { + let len_xs = xs.length; + let len_ys = ys.length; + if (len_xs === len_ys) { + return unsafe_loop(0, len_xs, p, xs, ys); + } else { + return false; + } +} + +export { + reverse_range, + reverse_in_place, + reverse, + reverse_of_list, + filter, + filter_map, + range, + map2i, + tolist_aux, + to_list_map, + to_list_map_acc, + of_list_map, + rfind_with_index, + rfind_and_split, + find_with_index, + find_and_split, + exists, + is_empty, + unsafe_loop, + for_all2_no_exn, +} +/* No side effect */ diff --git a/tests/tests/src/ext_pervasives_test.js b/tests/tests/src/ext_pervasives_test.js deleted file mode 100644 index abdc710db7..0000000000 --- a/tests/tests/src/ext_pervasives_test.js +++ /dev/null @@ -1,37 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function $$finally(v, action, f) { - let e; - try { - e = f(v); - } catch (e$1) { - action(v); - throw e$1; - } - action(v); - return e; -} - -function hash_variant(s) { - let accu = 0; - for (let i = 0, i_finish = s.length; i < i_finish; ++i) { - accu = Math.imul(223, accu) + s.codePointAt(i) | 0; - } - accu = accu & 2147483647; - if (accu > 1073741823) { - return accu - -2147483648 | 0; - } else { - return accu; - } -} - -let LargeFile = { - u: 3 -}; - -exports.$$finally = $$finally; -exports.hash_variant = hash_variant; -exports.LargeFile = LargeFile; -/* No side effect */ diff --git a/tests/tests/src/ext_pervasives_test.mjs b/tests/tests/src/ext_pervasives_test.mjs new file mode 100644 index 0000000000..f15c564ef2 --- /dev/null +++ b/tests/tests/src/ext_pervasives_test.mjs @@ -0,0 +1,38 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function $$finally(v, action, f) { + let e; + try { + e = f(v); + } catch (e$1) { + action(v); + throw e$1; + } + action(v); + return e; +} + +function hash_variant(s) { + let accu = 0; + for (let i = 0, i_finish = s.length; i < i_finish; ++i) { + accu = Math.imul(223, accu) + s.codePointAt(i) | 0; + } + accu = accu & 2147483647; + if (accu > 1073741823) { + return accu - -2147483648 | 0; + } else { + return accu; + } +} + +let LargeFile = { + u: 3 +}; + +export { + $$finally, + hash_variant, + LargeFile, +} +/* No side effect */ diff --git a/tests/tests/src/extensible_variant_test.js b/tests/tests/src/extensible_variant_test.js deleted file mode 100644 index 99285b1ab9..0000000000 --- a/tests/tests/src/extensible_variant_test.js +++ /dev/null @@ -1,92 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let Str = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.Str"); - -let Int = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.N.Int"); - -let N = { - Int: Int -}; - -let Int$1 = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.Int"); - -function to_int(x) { - if (x.RE_EXN_ID === Str) { - return -1; - } - if (x.RE_EXN_ID === Int) { - return x._1; - } - if (x.RE_EXN_ID === Int$1) { - return x._2; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "extensible_variant_test.res", - 16, - 9 - ], - Error: new Error() - }; -} - -let suites_0 = [ - "test_int", - param => ({ - TAG: "Eq", - _0: 3, - _1: to_int({ - RE_EXN_ID: Int, - _1: 3, - _2: 0 - }) - }) -]; - -let suites_1 = { - hd: [ - "test_int2", - param => ({ - TAG: "Eq", - _0: 0, - _1: to_int({ - RE_EXN_ID: Int$1, - _1: 3, - _2: 0 - }) - }) - ], - tl: { - hd: [ - "test_string", - param => ({ - TAG: "Eq", - _0: -1, - _1: to_int({ - RE_EXN_ID: Str, - _1: "x" - }) - }) - ], - tl: /* [] */0 - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Extensible_variant_test", suites); - -exports.Str = Str; -exports.N = N; -exports.Int = Int$1; -exports.to_int = to_int; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/extensible_variant_test.mjs b/tests/tests/src/extensible_variant_test.mjs new file mode 100644 index 0000000000..b6d8da5bbc --- /dev/null +++ b/tests/tests/src/extensible_variant_test.mjs @@ -0,0 +1,93 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let Str = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.Str"); + +let Int = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.N.Int"); + +let N = { + Int: Int +}; + +let Int$1 = /* @__PURE__ */Primitive_exceptions.create("Extensible_variant_test.Int"); + +function to_int(x) { + if (x.RE_EXN_ID === Str) { + return -1; + } + if (x.RE_EXN_ID === Int) { + return x._1; + } + if (x.RE_EXN_ID === Int$1) { + return x._2; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "extensible_variant_test.res", + 16, + 9 + ], + Error: new Error() + }; +} + +let suites_0 = [ + "test_int", + param => ({ + TAG: "Eq", + _0: 3, + _1: to_int({ + RE_EXN_ID: Int, + _1: 3, + _2: 0 + }) + }) +]; + +let suites_1 = { + hd: [ + "test_int2", + param => ({ + TAG: "Eq", + _0: 0, + _1: to_int({ + RE_EXN_ID: Int$1, + _1: 3, + _2: 0 + }) + }) + ], + tl: { + hd: [ + "test_string", + param => ({ + TAG: "Eq", + _0: -1, + _1: to_int({ + RE_EXN_ID: Str, + _1: "x" + }) + }) + ], + tl: /* [] */0 + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Extensible_variant_test", suites); + +export { + Str, + N, + Int$1 as Int, + to_int, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/external_ppx.js b/tests/tests/src/external_ppx.js deleted file mode 100644 index c5dd25dc0e..0000000000 --- a/tests/tests/src/external_ppx.js +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let External_ppxGen = require("./external_ppx.gen"); - -let renamed = { - type: "123", - normal: 12 -}; - -let u = { - hi: 2, - lo: 3, - lo2: {hi:-3 }, - lo3: -1, - lo4: -3 -}; - -function f(prim) { - return External_ppxGen.f(prim); -} - -exports.renamed = renamed; -exports.u = u; -exports.f = f; -/* ./external_ppx.gen Not a pure module */ diff --git a/tests/tests/src/external_ppx.mjs b/tests/tests/src/external_ppx.mjs new file mode 100644 index 0000000000..41d0d27f60 --- /dev/null +++ b/tests/tests/src/external_ppx.mjs @@ -0,0 +1,27 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as External_ppxGen from "./external_ppx.gen"; + +let renamed = { + type: "123", + normal: 12 +}; + +let u = { + hi: 2, + lo: 3, + lo2: {hi:-3 }, + lo3: -1, + lo4: -3 +}; + +function f(prim) { + return External_ppxGen.f(prim); +} + +export { + renamed, + u, + f, +} +/* ./external_ppx.gen Not a pure module */ diff --git a/tests/tests/src/external_ppx2.js b/tests/tests/src/external_ppx2.js deleted file mode 100644 index f4c9318e9d..0000000000 --- a/tests/tests/src/external_ppx2.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -f("\h\e\l\lo", 42); - -let x = "\h\e\l\lo"; - -let y; - -exports.x = x; -exports.y = y; -/* Not a pure module */ diff --git a/tests/tests/src/external_ppx2.mjs b/tests/tests/src/external_ppx2.mjs new file mode 100644 index 0000000000..ab97a23df5 --- /dev/null +++ b/tests/tests/src/external_ppx2.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +f("\h\e\l\lo", 42); + +let x = "\h\e\l\lo"; + +let y; + +export { + x, + y, +} +/* Not a pure module */ diff --git a/tests/tests/src/ffi_arity_test.js b/tests/tests/src/ffi_arity_test.js deleted file mode 100644 index ad382cb1b0..0000000000 --- a/tests/tests/src/ffi_arity_test.js +++ /dev/null @@ -1,121 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function f(v) { - if (v % 2 === 0) { - return v => Math.imul(v, v); - } else { - return v => v + v | 0; - } -} - -let v = [ - 1, - 2, - 3 -].map((a, b) => f(a)(b)); - -let vv = [ - 1, - 2, - 3 -].map((a, b) => a + b | 0); - -let hh = [ - "1", - "2", - "3" -].map(x => parseInt(x)); - -function u() { - return 3; -} - -let vvv = { - contents: 0 -}; - -function fff() { - console.log("x"); - console.log("x"); - vvv.contents = vvv.contents + 1 | 0; -} - -function g() { - fff(); -} - -function abc(x, y, z) { - console.log("xx"); - console.log("yy"); - return (x + y | 0) + z | 0; -} - -let abc_u = abc; - -fff(); - -Mt.from_pair_suites("Ffi_arity_test", { - hd: [ - "File \"ffi_arity_test.res\", line 51, characters 7-14", - () => ({ - TAG: "Eq", - _0: v, - _1: [ - 0, - 1, - 4 - ] - }) - ], - tl: { - hd: [ - "File \"ffi_arity_test.res\", line 52, characters 7-14", - () => ({ - TAG: "Eq", - _0: vv, - _1: [ - 1, - 3, - 5 - ] - }) - ], - tl: { - hd: [ - "File \"ffi_arity_test.res\", line 53, characters 7-14", - () => ({ - TAG: "Eq", - _0: hh, - _1: [ - 1, - 2, - 3 - ] - }) - ], - tl: /* [] */0 - } - } -}); - -function bar(fn) { - return fn(); -} - -((function(){console.log("forgiving arity")})()); - -exports.f = f; -exports.v = v; -exports.vv = vv; -exports.hh = hh; -exports.u = u; -exports.vvv = vvv; -exports.fff = fff; -exports.g = g; -exports.abc = abc; -exports.abc_u = abc_u; -exports.bar = bar; -/* v Not a pure module */ diff --git a/tests/tests/src/ffi_arity_test.mjs b/tests/tests/src/ffi_arity_test.mjs new file mode 100644 index 0000000000..155e3928f7 --- /dev/null +++ b/tests/tests/src/ffi_arity_test.mjs @@ -0,0 +1,122 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function f(v) { + if (v % 2 === 0) { + return v => Math.imul(v, v); + } else { + return v => v + v | 0; + } +} + +let v = [ + 1, + 2, + 3 +].map((a, b) => f(a)(b)); + +let vv = [ + 1, + 2, + 3 +].map((a, b) => a + b | 0); + +let hh = [ + "1", + "2", + "3" +].map(x => parseInt(x)); + +function u() { + return 3; +} + +let vvv = { + contents: 0 +}; + +function fff() { + console.log("x"); + console.log("x"); + vvv.contents = vvv.contents + 1 | 0; +} + +function g() { + fff(); +} + +function abc(x, y, z) { + console.log("xx"); + console.log("yy"); + return (x + y | 0) + z | 0; +} + +let abc_u = abc; + +fff(); + +Mt.from_pair_suites("Ffi_arity_test", { + hd: [ + "File \"ffi_arity_test.res\", line 51, characters 7-14", + () => ({ + TAG: "Eq", + _0: v, + _1: [ + 0, + 1, + 4 + ] + }) + ], + tl: { + hd: [ + "File \"ffi_arity_test.res\", line 52, characters 7-14", + () => ({ + TAG: "Eq", + _0: vv, + _1: [ + 1, + 3, + 5 + ] + }) + ], + tl: { + hd: [ + "File \"ffi_arity_test.res\", line 53, characters 7-14", + () => ({ + TAG: "Eq", + _0: hh, + _1: [ + 1, + 2, + 3 + ] + }) + ], + tl: /* [] */0 + } + } +}); + +function bar(fn) { + return fn(); +} + +((function(){console.log("forgiving arity")})()); + +export { + f, + v, + vv, + hh, + u, + vvv, + fff, + g, + abc, + abc_u, + bar, +} +/* v Not a pure module */ diff --git a/tests/tests/src/ffi_array_test.js b/tests/tests/src/ffi_array_test.js deleted file mode 100644 index 1249fd62cd..0000000000 --- a/tests/tests/src/ffi_array_test.js +++ /dev/null @@ -1,46 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"ffi_array_test.res\", line 14, characters 12-19", [ - 1, - 2, - 3, - 4 -].map(x => x + 1 | 0), [ - 2, - 3, - 4, - 5 -]); - -Mt.from_pair_suites("Ffi_array_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/ffi_array_test.mjs b/tests/tests/src/ffi_array_test.mjs new file mode 100644 index 0000000000..7945bf9ef9 --- /dev/null +++ b/tests/tests/src/ffi_array_test.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"ffi_array_test.res\", line 14, characters 12-19", [ + 1, + 2, + 3, + 4 +].map(x => x + 1 | 0), [ + 2, + 3, + 4, + 5 +]); + +Mt.from_pair_suites("Ffi_array_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/ffi_js_test.js b/tests/tests/src/ffi_js_test.js deleted file mode 100644 index bc0b64e95d..0000000000 --- a/tests/tests/src/ffi_js_test.js +++ /dev/null @@ -1,177 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let keys = (function (x){return Object.keys(x)}); - -function $$higher_order(x){ - return function(y,z){ - return x + y + z - } - } -; - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, param) { - let y = param[1]; - let x = param[0]; - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let int_config = { - hi: 3, - low: 32 -}; - -let string_config = { - hi: 3, - low: "32" -}; - -eq("File \"ffi_js_test.res\", line 33, characters 12-19", [ - 6, - $$higher_order(1)(2, 3) -]); - -let same_type_0 = { - hd: int_config, - tl: { - hd: { - hi: 3, - low: 32 - }, - tl: /* [] */0 - } -}; - -let same_type_1 = { - hd: string_config, - tl: { - hd: { - hi: 3, - low: "32" - }, - tl: /* [] */0 - } -}; - -let same_type = [ - same_type_0, - same_type_1 -]; - -eq("File \"ffi_js_test.res\", line 41, characters 5-12", [ - Object.keys(int_config).length, - 2 -]); - -eq("File \"ffi_js_test.res\", line 42, characters 5-12", [ - Object.keys(string_config).length, - 2 -]); - -let u = { - contents: 3 -}; - -let side_effect_config = (u.contents = u.contents + 1 | 0, "Int", { - hi: 3, - low: 32 -}); - -eq("File \"ffi_js_test.res\", line 56, characters 12-19", [ - u.contents, - 4 -]); - -function vv(z) { - return z.hh(); -} - -function v(z) { - return z.ff(); -} - -function vvv(z) { - return z.ff_pipe(); -} - -function vvvv(z) { - return z.ff_pipe2(); -} - -function create_prim() { - return { - "x'": 3, - "x''": 3, - "x''''": 2 - }; -} - -function ffff(x) { - x.setGADT = 3; - x.setGADT2 = [ - 3, - "3" - ]; - x.setGADT2 = [ - "3", - 3 - ]; - let match = x[3]; - console.log([ - match[0], - match[1] - ]); - console.log(x.getGADT); - let match$1 = x.getGADT2; - console.log(match$1[0], match$1[1]); - let match$2 = x[0]; - console.log(match$2[0], match$2[1]); - x[0] = [ - 1, - "x" - ]; - x[3] = [ - 3, - "x" - ]; -} - -Mt.from_pair_suites("Ffi_js_test", suites.contents); - -exports.keys = keys; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.int_config = int_config; -exports.string_config = string_config; -exports.same_type = same_type; -exports.u = u; -exports.side_effect_config = side_effect_config; -exports.vv = vv; -exports.v = v; -exports.vvv = vvv; -exports.vvvv = vvvv; -exports.create_prim = create_prim; -exports.ffff = ffff; -/* Not a pure module */ diff --git a/tests/tests/src/ffi_js_test.mjs b/tests/tests/src/ffi_js_test.mjs new file mode 100644 index 0000000000..038c5489b1 --- /dev/null +++ b/tests/tests/src/ffi_js_test.mjs @@ -0,0 +1,178 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let keys = (function (x){return Object.keys(x)}); + +function $$higher_order(x){ + return function(y,z){ + return x + y + z + } + } +; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, param) { + let y = param[1]; + let x = param[0]; + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let int_config = { + hi: 3, + low: 32 +}; + +let string_config = { + hi: 3, + low: "32" +}; + +eq("File \"ffi_js_test.res\", line 33, characters 12-19", [ + 6, + $$higher_order(1)(2, 3) +]); + +let same_type_0 = { + hd: int_config, + tl: { + hd: { + hi: 3, + low: 32 + }, + tl: /* [] */0 + } +}; + +let same_type_1 = { + hd: string_config, + tl: { + hd: { + hi: 3, + low: "32" + }, + tl: /* [] */0 + } +}; + +let same_type = [ + same_type_0, + same_type_1 +]; + +eq("File \"ffi_js_test.res\", line 41, characters 5-12", [ + Object.keys(int_config).length, + 2 +]); + +eq("File \"ffi_js_test.res\", line 42, characters 5-12", [ + Object.keys(string_config).length, + 2 +]); + +let u = { + contents: 3 +}; + +let side_effect_config = (u.contents = u.contents + 1 | 0, "Int", { + hi: 3, + low: 32 +}); + +eq("File \"ffi_js_test.res\", line 56, characters 12-19", [ + u.contents, + 4 +]); + +function vv(z) { + return z.hh(); +} + +function v(z) { + return z.ff(); +} + +function vvv(z) { + return z.ff_pipe(); +} + +function vvvv(z) { + return z.ff_pipe2(); +} + +function create_prim() { + return { + "x'": 3, + "x''": 3, + "x''''": 2 + }; +} + +function ffff(x) { + x.setGADT = 3; + x.setGADT2 = [ + 3, + "3" + ]; + x.setGADT2 = [ + "3", + 3 + ]; + let match = x[3]; + console.log([ + match[0], + match[1] + ]); + console.log(x.getGADT); + let match$1 = x.getGADT2; + console.log(match$1[0], match$1[1]); + let match$2 = x[0]; + console.log(match$2[0], match$2[1]); + x[0] = [ + 1, + "x" + ]; + x[3] = [ + 3, + "x" + ]; +} + +Mt.from_pair_suites("Ffi_js_test", suites.contents); + +export { + keys, + suites, + test_id, + eq, + int_config, + string_config, + same_type, + u, + side_effect_config, + vv, + v, + vvv, + vvvv, + create_prim, + ffff, +} +/* Not a pure module */ diff --git a/tests/tests/src/ffi_splice_test.js b/tests/tests/src/ffi_splice_test.js deleted file mode 100644 index afed162b54..0000000000 --- a/tests/tests/src/ffi_splice_test.js +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function Make (){ - this.data = [] - for(var i = 0; i < arguments.length; ++i){ - this.data[i] = arguments[i] -} -} - -Make.prototype.sum = function(){ - var result = 0; - for(var k = 0; k < this.data.length; ++k){ - result = result + this.data[k] - }; - return result -} - -Make.prototype.add = function(){ - -} -; - -function f(x) { - return x.test("a", "b").test("a", "b"); -} - -let v = new Make(1, 2, 3, 4); - -let u = v.sum(); - -eq("File \"ffi_splice_test.res\", line 54, characters 12-19", u, 10); - -Mt.from_pair_suites("Ffi_splice_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.v = v; -exports.u = u; -/* Not a pure module */ diff --git a/tests/tests/src/ffi_splice_test.mjs b/tests/tests/src/ffi_splice_test.mjs new file mode 100644 index 0000000000..23ff2a8691 --- /dev/null +++ b/tests/tests/src/ffi_splice_test.mjs @@ -0,0 +1,68 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function Make (){ + this.data = [] + for(var i = 0; i < arguments.length; ++i){ + this.data[i] = arguments[i] +} +} + +Make.prototype.sum = function(){ + var result = 0; + for(var k = 0; k < this.data.length; ++k){ + result = result + this.data[k] + }; + return result +} + +Make.prototype.add = function(){ + +} +; + +function f(x) { + return x.test("a", "b").test("a", "b"); +} + +let v = new Make(1, 2, 3, 4); + +let u = v.sum(); + +eq("File \"ffi_splice_test.res\", line 54, characters 12-19", u, 10); + +Mt.from_pair_suites("Ffi_splice_test", suites.contents); + +export { + suites, + test_id, + eq, + f, + v, + u, +} +/* Not a pure module */ diff --git a/tests/tests/src/ffi_test.js b/tests/tests/src/ffi_test.js deleted file mode 100644 index e677b1fbff..0000000000 --- a/tests/tests/src/ffi_test.js +++ /dev/null @@ -1,42 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function u() { - return xx(3); -} - -let Textarea = {}; - -let $$Int32Array = {}; - -function v() { - let u = new TextArea(); - u.minHeight = 3; - return u.minHeight; -} - -function f() { - let v = new Int32Array(32); - v[0] = 3; - return v[0]; -} - -let a = true; - -let b = false; - -let c = null; - -let d; - -exports.u = u; -exports.a = a; -exports.b = b; -exports.c = c; -exports.d = d; -exports.Textarea = Textarea; -exports.$$Int32Array = $$Int32Array; -exports.v = v; -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/ffi_test.mjs b/tests/tests/src/ffi_test.mjs new file mode 100644 index 0000000000..a2b2abaf23 --- /dev/null +++ b/tests/tests/src/ffi_test.mjs @@ -0,0 +1,43 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function u() { + return xx(3); +} + +let Textarea = {}; + +let $$Int32Array = {}; + +function v() { + let u = new TextArea(); + u.minHeight = 3; + return u.minHeight; +} + +function f() { + let v = new Int32Array(32); + v[0] = 3; + return v[0]; +} + +let a = true; + +let b = false; + +let c = null; + +let d; + +export { + u, + a, + b, + c, + d, + Textarea, + $$Int32Array, + v, + f, +} +/* No side effect */ diff --git a/tests/tests/src/fib.js b/tests/tests/src/fib.js deleted file mode 100644 index 40074bd13e..0000000000 --- a/tests/tests/src/fib.js +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function fib(x) { - if (x === 0 || x === 1) { - return 1; - } else { - return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; - } -} - -function fib2(n) { - let _a = 1; - let _b = 1; - let _i = 0; - while (true) { - let i = _i; - let b = _b; - let a = _a; - if (n === i) { - return a; - } - _i = i + 1 | 0; - _b = a + b | 0; - _a = b; - continue; - }; -} - -function fib3(n) { - let a = 1; - let b = 1; - for (let i = 1; i <= n; ++i) { - let tmp = a; - a = b; - b = b + tmp | 0; - } - return a; -} - -exports.fib = fib; -exports.fib2 = fib2; -exports.fib3 = fib3; -/* No side effect */ diff --git a/tests/tests/src/fib.mjs b/tests/tests/src/fib.mjs new file mode 100644 index 0000000000..40a3b661f3 --- /dev/null +++ b/tests/tests/src/fib.mjs @@ -0,0 +1,46 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function fib(x) { + if (x === 0 || x === 1) { + return 1; + } else { + return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; + } +} + +function fib2(n) { + let _a = 1; + let _b = 1; + let _i = 0; + while (true) { + let i = _i; + let b = _b; + let a = _a; + if (n === i) { + return a; + } + _i = i + 1 | 0; + _b = a + b | 0; + _a = b; + continue; + }; +} + +function fib3(n) { + let a = 1; + let b = 1; + for (let i = 1; i <= n; ++i) { + let tmp = a; + a = b; + b = b + tmp | 0; + } + return a; +} + +export { + fib, + fib2, + fib3, +} +/* No side effect */ diff --git a/tests/tests/src/flattern_order_test.js b/tests/tests/src/flattern_order_test.js deleted file mode 100644 index f89f8bd401..0000000000 --- a/tests/tests/src/flattern_order_test.js +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function even(_n) { - while (true) { - let n = _n; - if (n === 0) { - return true; - } - _n = n - 1 | 0; - continue; - }; -} - -function even2(n) { - if (n === 0) { - return true; - } else { - let n$1 = n - 1 | 0; - if (n$1 === 1) { - return true; - } else { - return even2(n$1 - 1 | 0); - } - } -} - -let v = { - contents: 0 -}; - -function obj_get() { - return v.contents; -} - -function obj_set(i) { - v.contents = i; -} - -let obj = { - get: obj_get, - set: obj_set -}; - -exports.even = even; -exports.even2 = even2; -exports.v = v; -exports.obj = obj; -/* No side effect */ diff --git a/tests/tests/src/flattern_order_test.mjs b/tests/tests/src/flattern_order_test.mjs new file mode 100644 index 0000000000..bb4d043d55 --- /dev/null +++ b/tests/tests/src/flattern_order_test.mjs @@ -0,0 +1,51 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function even(_n) { + while (true) { + let n = _n; + if (n === 0) { + return true; + } + _n = n - 1 | 0; + continue; + }; +} + +function even2(n) { + if (n === 0) { + return true; + } else { + let n$1 = n - 1 | 0; + if (n$1 === 1) { + return true; + } else { + return even2(n$1 - 1 | 0); + } + } +} + +let v = { + contents: 0 +}; + +function obj_get() { + return v.contents; +} + +function obj_set(i) { + v.contents = i; +} + +let obj = { + get: obj_get, + set: obj_set +}; + +export { + even, + even2, + v, + obj, +} +/* No side effect */ diff --git a/tests/tests/src/flexible_array_test.js b/tests/tests/src/flexible_array_test.js deleted file mode 100644 index 34b52f9366..0000000000 --- a/tests/tests/src/flexible_array_test.js +++ /dev/null @@ -1,327 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -function sub(_tr, _k) { - while (true) { - let k = _k; - let tr = _tr; - if (typeof tr !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - if (k === 1) { - return tr._0; - } - if (k % 2 === 0) { - _k = k / 2 | 0; - _tr = tr._1; - continue; - } - _k = k / 2 | 0; - _tr = tr._2; - continue; - }; -} - -function update(tr, k, w) { - if (typeof tr !== "object") { - if (k === 1) { - return { - TAG: "Br", - _0: w, - _1: "Lf", - _2: "Lf" - }; - } - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let r = tr._2; - let l = tr._1; - if (k === 1) { - return { - TAG: "Br", - _0: w, - _1: l, - _2: r - }; - } - let v = tr._0; - if (k % 2 === 0) { - return { - TAG: "Br", - _0: v, - _1: update(l, k / 2 | 0, w), - _2: r - }; - } else { - return { - TAG: "Br", - _0: v, - _1: l, - _2: update(r, k / 2 | 0, w) - }; - } -} - -function $$delete(tr, n) { - if (typeof tr !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - if (n === 1) { - return "Lf"; - } - let r = tr._2; - let l = tr._1; - let v = tr._0; - if (n % 2 === 0) { - return { - TAG: "Br", - _0: v, - _1: $$delete(l, n / 2 | 0), - _2: r - }; - } else { - return { - TAG: "Br", - _0: v, - _1: l, - _2: $$delete(r, n / 2 | 0) - }; - } -} - -function loext(tr, w) { - if (typeof tr !== "object") { - return { - TAG: "Br", - _0: w, - _1: "Lf", - _2: "Lf" - }; - } else { - return { - TAG: "Br", - _0: w, - _1: loext(tr._2, tr._0), - _2: tr._1 - }; - } -} - -function lorem(tr) { - if (typeof tr !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let l = tr._1; - if (typeof l === "object") { - return { - TAG: "Br", - _0: l._0, - _1: tr._2, - _2: lorem(l) - }; - } - let tmp = tr._2; - if (typeof tmp !== "object") { - return "Lf"; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "flexible_array_test.res", - 82, - 9 - ], - Error: new Error() - }; -} - -let empty = [ - "Lf", - 0 -]; - -function length(param) { - return param[1]; -} - -function get(param, i) { - if (i >= 0 && i < param[1]) { - return sub(param[0], i + 1 | 0); - } else { - return Pervasives.invalid_arg("Array.get"); - } -} - -function set(param, i, v) { - let k = param[1]; - if (i >= 0 && i < k) { - return [ - update(param[0], i + 1 | 0, v), - k - ]; - } else { - return Pervasives.invalid_arg("Array.set"); - } -} - -function push_front(param, v) { - return [ - loext(param[0], v), - param[1] + 1 | 0 - ]; -} - -function pop_front(param) { - let k = param[1]; - if (k > 0) { - return [ - lorem(param[0]), - k - 1 | 0 - ]; - } else { - return Pervasives.invalid_arg("Array.pop_front"); - } -} - -function push_back(param, v) { - let k = param[1]; - return [ - update(param[0], k + 1 | 0, v), - k + 1 | 0 - ]; -} - -function pop_back(param) { - let k = param[1]; - if (k > 0) { - return [ - $$delete(param[0], k), - k - 1 | 0 - ]; - } else { - return Pervasives.invalid_arg("Array.pop_back"); - } -} - -function filter_from(i, p, s) { - let u = empty; - for (let i$1 = i, i_finish = length(s); i$1 < i_finish; ++i$1) { - let ele = get(s, i$1); - if (p(ele)) { - u = push_back(u, ele); - } - - } - return u; -} - -function append(a, b) { - let empty$1 = empty; - for (let i = 0, i_finish = length(a); i < i_finish; ++i) { - empty$1 = push_back(empty$1, get(a, i)); - } - for (let i$1 = 0, i_finish$1 = length(b); i$1 < i_finish$1; ++i$1) { - empty$1 = push_back(empty$1, get(b, i$1)); - } - return empty$1; -} - -function sort(s) { - let size = length(s); - if (size <= 1) { - return s; - } - let head = get(s, 0); - let larger = sort(filter_from(1, x => Primitive_object.greaterthan(x, head), s)); - let smaller = sort(filter_from(1, x => Primitive_object.lessequal(x, head), s)); - return append(smaller, push_front(larger, head)); -} - -function of_array(arr) { - let v = empty; - for (let i = 0, i_finish = arr.length; i < i_finish; ++i) { - v = push_back(v, Primitive_array.get(arr, i)); - } - return v; -} - -let equal = Primitive_object.equal; - -let Int_array = { - empty: empty, - get: get, - set: set, - push_front: push_front, - pop_front: pop_front, - push_back: push_back, - pop_back: pop_back, - append: append, - sort: sort, - of_array: of_array, - equal: equal -}; - -function $eq$tilde(x, y) { - return Primitive_object.equal(x, of_array(y)); -} - -let u = of_array([ - 1, - 2, - 2, - 5, - 3, - 6 -]); - -if (!$eq$tilde(sort(u), [ - 1, - 2, - 2, - 3, - 5, - 6 - ])) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "flexible_array_test.res", - 186, - 2 - ], - Error: new Error() - }; -} - -let v = Belt_Array.init(500, i => 500 - i | 0); - -$eq$tilde(sort(of_array(v)), Belt_Array.init(500, i => i + 1 | 0)); - -let $$Array; - -exports.$$Array = $$Array; -exports.sub = sub; -exports.update = update; -exports.$$delete = $$delete; -exports.loext = loext; -exports.lorem = lorem; -exports.Int_array = Int_array; -exports.$eq$tilde = $eq$tilde; -/* u Not a pure module */ diff --git a/tests/tests/src/flexible_array_test.mjs b/tests/tests/src/flexible_array_test.mjs new file mode 100644 index 0000000000..3859e57047 --- /dev/null +++ b/tests/tests/src/flexible_array_test.mjs @@ -0,0 +1,328 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +function sub(_tr, _k) { + while (true) { + let k = _k; + let tr = _tr; + if (typeof tr !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + if (k === 1) { + return tr._0; + } + if (k % 2 === 0) { + _k = k / 2 | 0; + _tr = tr._1; + continue; + } + _k = k / 2 | 0; + _tr = tr._2; + continue; + }; +} + +function update(tr, k, w) { + if (typeof tr !== "object") { + if (k === 1) { + return { + TAG: "Br", + _0: w, + _1: "Lf", + _2: "Lf" + }; + } + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let r = tr._2; + let l = tr._1; + if (k === 1) { + return { + TAG: "Br", + _0: w, + _1: l, + _2: r + }; + } + let v = tr._0; + if (k % 2 === 0) { + return { + TAG: "Br", + _0: v, + _1: update(l, k / 2 | 0, w), + _2: r + }; + } else { + return { + TAG: "Br", + _0: v, + _1: l, + _2: update(r, k / 2 | 0, w) + }; + } +} + +function $$delete(tr, n) { + if (typeof tr !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + if (n === 1) { + return "Lf"; + } + let r = tr._2; + let l = tr._1; + let v = tr._0; + if (n % 2 === 0) { + return { + TAG: "Br", + _0: v, + _1: $$delete(l, n / 2 | 0), + _2: r + }; + } else { + return { + TAG: "Br", + _0: v, + _1: l, + _2: $$delete(r, n / 2 | 0) + }; + } +} + +function loext(tr, w) { + if (typeof tr !== "object") { + return { + TAG: "Br", + _0: w, + _1: "Lf", + _2: "Lf" + }; + } else { + return { + TAG: "Br", + _0: w, + _1: loext(tr._2, tr._0), + _2: tr._1 + }; + } +} + +function lorem(tr) { + if (typeof tr !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let l = tr._1; + if (typeof l === "object") { + return { + TAG: "Br", + _0: l._0, + _1: tr._2, + _2: lorem(l) + }; + } + let tmp = tr._2; + if (typeof tmp !== "object") { + return "Lf"; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 82, + 9 + ], + Error: new Error() + }; +} + +let empty = [ + "Lf", + 0 +]; + +function length(param) { + return param[1]; +} + +function get(param, i) { + if (i >= 0 && i < param[1]) { + return sub(param[0], i + 1 | 0); + } else { + return Pervasives.invalid_arg("Array.get"); + } +} + +function set(param, i, v) { + let k = param[1]; + if (i >= 0 && i < k) { + return [ + update(param[0], i + 1 | 0, v), + k + ]; + } else { + return Pervasives.invalid_arg("Array.set"); + } +} + +function push_front(param, v) { + return [ + loext(param[0], v), + param[1] + 1 | 0 + ]; +} + +function pop_front(param) { + let k = param[1]; + if (k > 0) { + return [ + lorem(param[0]), + k - 1 | 0 + ]; + } else { + return Pervasives.invalid_arg("Array.pop_front"); + } +} + +function push_back(param, v) { + let k = param[1]; + return [ + update(param[0], k + 1 | 0, v), + k + 1 | 0 + ]; +} + +function pop_back(param) { + let k = param[1]; + if (k > 0) { + return [ + $$delete(param[0], k), + k - 1 | 0 + ]; + } else { + return Pervasives.invalid_arg("Array.pop_back"); + } +} + +function filter_from(i, p, s) { + let u = empty; + for (let i$1 = i, i_finish = length(s); i$1 < i_finish; ++i$1) { + let ele = get(s, i$1); + if (p(ele)) { + u = push_back(u, ele); + } + + } + return u; +} + +function append(a, b) { + let empty$1 = empty; + for (let i = 0, i_finish = length(a); i < i_finish; ++i) { + empty$1 = push_back(empty$1, get(a, i)); + } + for (let i$1 = 0, i_finish$1 = length(b); i$1 < i_finish$1; ++i$1) { + empty$1 = push_back(empty$1, get(b, i$1)); + } + return empty$1; +} + +function sort(s) { + let size = length(s); + if (size <= 1) { + return s; + } + let head = get(s, 0); + let larger = sort(filter_from(1, x => Primitive_object.greaterthan(x, head), s)); + let smaller = sort(filter_from(1, x => Primitive_object.lessequal(x, head), s)); + return append(smaller, push_front(larger, head)); +} + +function of_array(arr) { + let v = empty; + for (let i = 0, i_finish = arr.length; i < i_finish; ++i) { + v = push_back(v, Primitive_array.get(arr, i)); + } + return v; +} + +let equal = Primitive_object.equal; + +let Int_array = { + empty: empty, + get: get, + set: set, + push_front: push_front, + pop_front: pop_front, + push_back: push_back, + pop_back: pop_back, + append: append, + sort: sort, + of_array: of_array, + equal: equal +}; + +function $eq$tilde(x, y) { + return Primitive_object.equal(x, of_array(y)); +} + +let u = of_array([ + 1, + 2, + 2, + 5, + 3, + 6 +]); + +if (!$eq$tilde(sort(u), [ + 1, + 2, + 2, + 3, + 5, + 6 + ])) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "flexible_array_test.res", + 186, + 2 + ], + Error: new Error() + }; +} + +let v = Belt_Array.init(500, i => 500 - i | 0); + +$eq$tilde(sort(of_array(v)), Belt_Array.init(500, i => i + 1 | 0)); + +let $$Array; + +export { + $$Array, + sub, + update, + $$delete, + loext, + lorem, + Int_array, + $eq$tilde, +} +/* u Not a pure module */ diff --git a/tests/tests/src/float_array.js b/tests/tests/src/float_array.js deleted file mode 100644 index 148cd53002..0000000000 --- a/tests/tests/src/float_array.js +++ /dev/null @@ -1,66 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function small_float_array(x) { - return [ - [ - 1, - 2, - 3 - ], - x - ]; -} - -function longer_float_array(x) { - return [ - [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 0 - ], - x - ]; -} - -exports.small_float_array = small_float_array; -exports.longer_float_array = longer_float_array; -/* No side effect */ diff --git a/tests/tests/src/float_array.mjs b/tests/tests/src/float_array.mjs new file mode 100644 index 0000000000..48f469b64b --- /dev/null +++ b/tests/tests/src/float_array.mjs @@ -0,0 +1,67 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function small_float_array(x) { + return [ + [ + 1, + 2, + 3 + ], + x + ]; +} + +function longer_float_array(x) { + return [ + [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0 + ], + x + ]; +} + +export { + small_float_array, + longer_float_array, +} +/* No side effect */ diff --git a/tests/tests/src/float_record.js b/tests/tests/src/float_record.js deleted file mode 100644 index 32f9d95d0f..0000000000 --- a/tests/tests/src/float_record.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function make(f) { - return f; -} - -function from(t) { - return t; -} - -exports.make = make; -exports.from = from; -/* No side effect */ diff --git a/tests/tests/src/float_record.mjs b/tests/tests/src/float_record.mjs new file mode 100644 index 0000000000..e67289b6e5 --- /dev/null +++ b/tests/tests/src/float_record.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function make(f) { + return f; +} + +function from(t) { + return t; +} + +export { + make, + from, +} +/* No side effect */ diff --git a/tests/tests/src/float_test.js b/tests/tests/src/float_test.js deleted file mode 100644 index ae51edf98f..0000000000 --- a/tests/tests/src/float_test.js +++ /dev/null @@ -1,218 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Mt_global = require("./mt_global.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_float = require("rescript/lib/js/Primitive_float.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let test_id = { - contents: 0 -}; - -let suites = { - contents: /* [] */0 -}; - -function eq(loc, x, y) { - Mt_global.collect_eq(test_id, suites, loc, x, y); -} - -function approx(loc, x, y) { - Mt_global.collect_approx(test_id, suites, loc, x, y); -} - -function from_pairs(ps) { - return Belt_List.fromArray(Belt_Array.mapWithIndex(ps, (i, param) => { - let b = param[1]; - let a = param[0]; - return [ - "pair " + i, - param => ({ - TAG: "Approx", - _0: a, - _1: b - }) - ]; - })); -} - -let float_compare = Primitive_float.compare; - -let generic_compare = Primitive_object.compare; - -function float_equal(x, y) { - return x === y; -} - -let generic_equal = Primitive_object.equal; - -function float_notequal(x, y) { - return x !== y; -} - -let generic_notequal = Primitive_object.notequal; - -function float_lessthan(x, y) { - return x < y; -} - -let generic_lessthan = Primitive_object.lessthan; - -function float_greaterthan(x, y) { - return x > y; -} - -let generic_greaterthan = Primitive_object.greaterthan; - -function float_lessequal(x, y) { - return x <= y; -} - -let generic_lessequal = Primitive_object.lessequal; - -function float_greaterequal(x, y) { - return x >= y; -} - -let generic_greaterequal = Primitive_object.greaterequal; - -eq("File \"float_test.res\", line 28, characters 5-12", Pervasives.classify_float(3), "FP_normal"); - -eq("File \"float_test.res\", line 30, characters 4-11", [ - -1, - 1, - 1 -], Belt_Array.map(Belt_Array.map([ - [ - 1, - 3 - ], - [ - 2, - 1 - ], - [ - 3, - 2 - ] -], param => Primitive_float.compare(param[0], param[1])), x => { - if (x > 0) { - return 1; - } else if (x < 0) { - return -1; - } else { - return 0; - } -})); - -eq("File \"float_test.res\", line 44, characters 5-12", Math.log10(10), 1); - -eq("File \"float_test.res\", line 45, characters 5-12", Number("3.0"), 3.0); - -eq("File \"float_test.res\", line 46, characters 5-12", Primitive_float.compare(NaN, NaN), 0); - -eq("File \"float_test.res\", line 47, characters 5-12", Primitive_object.compare(NaN, NaN), 0); - -eq("File \"float_test.res\", line 48, characters 5-12", Primitive_float.compare(NaN, Pervasives.neg_infinity), -1); - -eq("File \"float_test.res\", line 49, characters 5-12", Primitive_object.compare(NaN, Pervasives.neg_infinity), -1); - -eq("File \"float_test.res\", line 50, characters 5-12", Primitive_float.compare(Pervasives.neg_infinity, NaN), 1); - -eq("File \"float_test.res\", line 51, characters 5-12", Primitive_object.compare(Pervasives.neg_infinity, NaN), 1); - -eq("File \"float_test.res\", line 52, characters 5-12", NaN === NaN, false); - -eq("File \"float_test.res\", line 53, characters 5-12", Primitive_object.equal(NaN, NaN), false); - -eq("File \"float_test.res\", line 54, characters 5-12", 4.2 === NaN, false); - -eq("File \"float_test.res\", line 55, characters 5-12", Primitive_object.equal(4.2, NaN), false); - -eq("File \"float_test.res\", line 56, characters 5-12", NaN === 4.2, false); - -eq("File \"float_test.res\", line 57, characters 5-12", Primitive_object.equal(NaN, 4.2), false); - -eq("File \"float_test.res\", line 58, characters 5-12", NaN !== NaN, true); - -eq("File \"float_test.res\", line 59, characters 5-12", Primitive_object.notequal(NaN, NaN), true); - -eq("File \"float_test.res\", line 60, characters 5-12", 4.2 !== NaN, true); - -eq("File \"float_test.res\", line 61, characters 5-12", Primitive_object.notequal(4.2, NaN), true); - -eq("File \"float_test.res\", line 62, characters 5-12", NaN !== 4.2, true); - -eq("File \"float_test.res\", line 63, characters 5-12", Primitive_object.notequal(NaN, 4.2), true); - -eq("File \"float_test.res\", line 64, characters 5-12", NaN < NaN, false); - -eq("File \"float_test.res\", line 65, characters 5-12", Primitive_object.lessthan(NaN, NaN), false); - -eq("File \"float_test.res\", line 66, characters 5-12", 4.2 < NaN, false); - -eq("File \"float_test.res\", line 67, characters 5-12", Primitive_object.lessthan(4.2, NaN), false); - -eq("File \"float_test.res\", line 68, characters 5-12", NaN < 4.2, false); - -eq("File \"float_test.res\", line 69, characters 5-12", Primitive_object.lessthan(NaN, 4.2), false); - -eq("File \"float_test.res\", line 70, characters 5-12", NaN > NaN, false); - -eq("File \"float_test.res\", line 71, characters 5-12", Primitive_object.greaterthan(NaN, NaN), false); - -eq("File \"float_test.res\", line 72, characters 5-12", 4.2 > NaN, false); - -eq("File \"float_test.res\", line 73, characters 5-12", Primitive_object.greaterthan(4.2, NaN), false); - -eq("File \"float_test.res\", line 74, characters 5-12", NaN > 4.2, false); - -eq("File \"float_test.res\", line 75, characters 5-12", Primitive_object.greaterthan(NaN, 4.2), false); - -eq("File \"float_test.res\", line 76, characters 5-12", NaN <= NaN, false); - -eq("File \"float_test.res\", line 77, characters 5-12", Primitive_object.lessequal(NaN, NaN), false); - -eq("File \"float_test.res\", line 78, characters 5-12", 4.2 <= NaN, false); - -eq("File \"float_test.res\", line 79, characters 5-12", Primitive_object.lessequal(4.2, NaN), false); - -eq("File \"float_test.res\", line 80, characters 5-12", NaN <= 4.2, false); - -eq("File \"float_test.res\", line 81, characters 5-12", Primitive_object.lessequal(NaN, 4.2), false); - -eq("File \"float_test.res\", line 82, characters 5-12", NaN >= NaN, false); - -eq("File \"float_test.res\", line 83, characters 5-12", Primitive_object.greaterequal(NaN, NaN), false); - -eq("File \"float_test.res\", line 84, characters 5-12", 4.2 >= NaN, false); - -eq("File \"float_test.res\", line 85, characters 5-12", Primitive_object.greaterequal(4.2, NaN), false); - -eq("File \"float_test.res\", line 86, characters 5-12", NaN >= 4.2, false); - -eq("File \"float_test.res\", line 87, characters 5-12", Primitive_object.greaterequal(NaN, 4.2), false); - -exports.test_id = test_id; -exports.suites = suites; -exports.eq = eq; -exports.approx = approx; -exports.from_pairs = from_pairs; -exports.float_compare = float_compare; -exports.generic_compare = generic_compare; -exports.float_equal = float_equal; -exports.generic_equal = generic_equal; -exports.float_notequal = float_notequal; -exports.generic_notequal = generic_notequal; -exports.float_lessthan = float_lessthan; -exports.generic_lessthan = generic_lessthan; -exports.float_greaterthan = float_greaterthan; -exports.generic_greaterthan = generic_greaterthan; -exports.float_lessequal = float_lessequal; -exports.generic_lessequal = generic_lessequal; -exports.float_greaterequal = float_greaterequal; -exports.generic_greaterequal = generic_greaterequal; -/* Not a pure module */ diff --git a/tests/tests/src/float_test.mjs b/tests/tests/src/float_test.mjs new file mode 100644 index 0000000000..59943ba5d5 --- /dev/null +++ b/tests/tests/src/float_test.mjs @@ -0,0 +1,219 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Mt_global from "./mt_global.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_float from "rescript/lib/es6/Primitive_float.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let test_id = { + contents: 0 +}; + +let suites = { + contents: /* [] */0 +}; + +function eq(loc, x, y) { + Mt_global.collect_eq(test_id, suites, loc, x, y); +} + +function approx(loc, x, y) { + Mt_global.collect_approx(test_id, suites, loc, x, y); +} + +function from_pairs(ps) { + return Belt_List.fromArray(Belt_Array.mapWithIndex(ps, (i, param) => { + let b = param[1]; + let a = param[0]; + return [ + "pair " + i, + param => ({ + TAG: "Approx", + _0: a, + _1: b + }) + ]; + })); +} + +let float_compare = Primitive_float.compare; + +let generic_compare = Primitive_object.compare; + +function float_equal(x, y) { + return x === y; +} + +let generic_equal = Primitive_object.equal; + +function float_notequal(x, y) { + return x !== y; +} + +let generic_notequal = Primitive_object.notequal; + +function float_lessthan(x, y) { + return x < y; +} + +let generic_lessthan = Primitive_object.lessthan; + +function float_greaterthan(x, y) { + return x > y; +} + +let generic_greaterthan = Primitive_object.greaterthan; + +function float_lessequal(x, y) { + return x <= y; +} + +let generic_lessequal = Primitive_object.lessequal; + +function float_greaterequal(x, y) { + return x >= y; +} + +let generic_greaterequal = Primitive_object.greaterequal; + +eq("File \"float_test.res\", line 28, characters 5-12", Pervasives.classify_float(3), "FP_normal"); + +eq("File \"float_test.res\", line 30, characters 4-11", [ + -1, + 1, + 1 +], Belt_Array.map(Belt_Array.map([ + [ + 1, + 3 + ], + [ + 2, + 1 + ], + [ + 3, + 2 + ] +], param => Primitive_float.compare(param[0], param[1])), x => { + if (x > 0) { + return 1; + } else if (x < 0) { + return -1; + } else { + return 0; + } +})); + +eq("File \"float_test.res\", line 44, characters 5-12", Math.log10(10), 1); + +eq("File \"float_test.res\", line 45, characters 5-12", Number("3.0"), 3.0); + +eq("File \"float_test.res\", line 46, characters 5-12", Primitive_float.compare(NaN, NaN), 0); + +eq("File \"float_test.res\", line 47, characters 5-12", Primitive_object.compare(NaN, NaN), 0); + +eq("File \"float_test.res\", line 48, characters 5-12", Primitive_float.compare(NaN, Pervasives.neg_infinity), -1); + +eq("File \"float_test.res\", line 49, characters 5-12", Primitive_object.compare(NaN, Pervasives.neg_infinity), -1); + +eq("File \"float_test.res\", line 50, characters 5-12", Primitive_float.compare(Pervasives.neg_infinity, NaN), 1); + +eq("File \"float_test.res\", line 51, characters 5-12", Primitive_object.compare(Pervasives.neg_infinity, NaN), 1); + +eq("File \"float_test.res\", line 52, characters 5-12", NaN === NaN, false); + +eq("File \"float_test.res\", line 53, characters 5-12", Primitive_object.equal(NaN, NaN), false); + +eq("File \"float_test.res\", line 54, characters 5-12", 4.2 === NaN, false); + +eq("File \"float_test.res\", line 55, characters 5-12", Primitive_object.equal(4.2, NaN), false); + +eq("File \"float_test.res\", line 56, characters 5-12", NaN === 4.2, false); + +eq("File \"float_test.res\", line 57, characters 5-12", Primitive_object.equal(NaN, 4.2), false); + +eq("File \"float_test.res\", line 58, characters 5-12", NaN !== NaN, true); + +eq("File \"float_test.res\", line 59, characters 5-12", Primitive_object.notequal(NaN, NaN), true); + +eq("File \"float_test.res\", line 60, characters 5-12", 4.2 !== NaN, true); + +eq("File \"float_test.res\", line 61, characters 5-12", Primitive_object.notequal(4.2, NaN), true); + +eq("File \"float_test.res\", line 62, characters 5-12", NaN !== 4.2, true); + +eq("File \"float_test.res\", line 63, characters 5-12", Primitive_object.notequal(NaN, 4.2), true); + +eq("File \"float_test.res\", line 64, characters 5-12", NaN < NaN, false); + +eq("File \"float_test.res\", line 65, characters 5-12", Primitive_object.lessthan(NaN, NaN), false); + +eq("File \"float_test.res\", line 66, characters 5-12", 4.2 < NaN, false); + +eq("File \"float_test.res\", line 67, characters 5-12", Primitive_object.lessthan(4.2, NaN), false); + +eq("File \"float_test.res\", line 68, characters 5-12", NaN < 4.2, false); + +eq("File \"float_test.res\", line 69, characters 5-12", Primitive_object.lessthan(NaN, 4.2), false); + +eq("File \"float_test.res\", line 70, characters 5-12", NaN > NaN, false); + +eq("File \"float_test.res\", line 71, characters 5-12", Primitive_object.greaterthan(NaN, NaN), false); + +eq("File \"float_test.res\", line 72, characters 5-12", 4.2 > NaN, false); + +eq("File \"float_test.res\", line 73, characters 5-12", Primitive_object.greaterthan(4.2, NaN), false); + +eq("File \"float_test.res\", line 74, characters 5-12", NaN > 4.2, false); + +eq("File \"float_test.res\", line 75, characters 5-12", Primitive_object.greaterthan(NaN, 4.2), false); + +eq("File \"float_test.res\", line 76, characters 5-12", NaN <= NaN, false); + +eq("File \"float_test.res\", line 77, characters 5-12", Primitive_object.lessequal(NaN, NaN), false); + +eq("File \"float_test.res\", line 78, characters 5-12", 4.2 <= NaN, false); + +eq("File \"float_test.res\", line 79, characters 5-12", Primitive_object.lessequal(4.2, NaN), false); + +eq("File \"float_test.res\", line 80, characters 5-12", NaN <= 4.2, false); + +eq("File \"float_test.res\", line 81, characters 5-12", Primitive_object.lessequal(NaN, 4.2), false); + +eq("File \"float_test.res\", line 82, characters 5-12", NaN >= NaN, false); + +eq("File \"float_test.res\", line 83, characters 5-12", Primitive_object.greaterequal(NaN, NaN), false); + +eq("File \"float_test.res\", line 84, characters 5-12", 4.2 >= NaN, false); + +eq("File \"float_test.res\", line 85, characters 5-12", Primitive_object.greaterequal(4.2, NaN), false); + +eq("File \"float_test.res\", line 86, characters 5-12", NaN >= 4.2, false); + +eq("File \"float_test.res\", line 87, characters 5-12", Primitive_object.greaterequal(NaN, 4.2), false); + +export { + test_id, + suites, + eq, + approx, + from_pairs, + float_compare, + generic_compare, + float_equal, + generic_equal, + float_notequal, + generic_notequal, + float_lessthan, + generic_lessthan, + float_greaterthan, + generic_greaterthan, + float_lessequal, + generic_lessequal, + float_greaterequal, + generic_greaterequal, +} +/* Not a pure module */ diff --git a/tests/tests/src/for_loop_test.js b/tests/tests/src/for_loop_test.js deleted file mode 100644 index 4dfe8ec842..0000000000 --- a/tests/tests/src/for_loop_test.js +++ /dev/null @@ -1,265 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -function for_3(x) { - let v = { - contents: 0 - }; - let arr = Belt_Array.map(x, param => (() => {})); - for (let i = 0, i_finish = x.length; i < i_finish; ++i) { - let j = (i << 1); - arr[i] = () => { - v.contents = v.contents + j | 0; - }; - } - Belt_Array.forEach(arr, x => x()); - return v.contents; -} - -function for_4(x) { - let v = { - contents: 0 - }; - let arr = Belt_Array.map(x, param => (() => {})); - for (let i = 0, i_finish = x.length; i < i_finish; ++i) { - let j = (i << 1); - let k = (j << 1); - arr[i] = () => { - v.contents = v.contents + k | 0; - }; - } - Belt_Array.forEach(arr, x => x()); - return v.contents; -} - -function for_5(x, u) { - let v = { - contents: 0 - }; - let arr = Belt_Array.map(x, param => (() => {})); - for (let i = 0, i_finish = x.length; i < i_finish; ++i) { - let k = Math.imul((u << 1), u); - arr[i] = () => { - v.contents = v.contents + k | 0; - }; - } - Belt_Array.forEach(arr, x => x()); - return v.contents; -} - -function for_6(x, u) { - let v = { - contents: 0 - }; - let arr = Belt_Array.map(x, param => (() => {})); - let v4 = { - contents: 0 - }; - let v5 = { - contents: 0 - }; - let inspect_3 = -1; - v4.contents = v4.contents + 1 | 0; - for (let j = 0; j <= 1; ++j) { - v5.contents = v5.contents + 1 | 0; - let v2 = { - contents: 0 - }; - for (let i = 0, i_finish = x.length; i < i_finish; ++i) { - let k = Math.imul((u << 1), u); - let h = (v5.contents << 1); - v2.contents = v2.contents + 1 | 0; - arr[i] = () => { - v.contents = (((((v.contents + k | 0) + v2.contents | 0) + v4.contents | 0) + v5.contents | 0) + h | 0) + u | 0; - }; - } - inspect_3 = v2.contents; - } - Belt_Array.forEach(arr, x => x()); - return [ - v.contents, - v4.contents, - v5.contents, - inspect_3 - ]; -} - -function for_7() { - let v = { - contents: 0 - }; - let arr = Belt_Array.make(21, () => {}); - for (let i = 0; i <= 6; ++i) { - for (let j = 0; j <= 2; ++j) { - arr[Math.imul(i, 3) + j | 0] = () => { - v.contents = (v.contents + i | 0) + j | 0; - }; - } - } - Belt_Array.forEach(arr, f => f()); - return v.contents; -} - -function for_8() { - let v = { - contents: 0 - }; - let arr = Belt_Array.make(21, () => {}); - for (let i = 0; i <= 6; ++i) { - let k = (i << 1); - for (let j = 0; j <= 2; ++j) { - let h = i + j | 0; - arr[Math.imul(i, 3) + j | 0] = () => { - v.contents = (((v.contents + i | 0) + j | 0) + h | 0) + k | 0; - }; - } - } - Belt_Array.forEach(arr, f => f()); - return v.contents; -} - -function for_9() { - let v = { - contents: /* [] */0 - }; - let collect = x => { - v.contents = { - hd: x, - tl: v.contents - }; - }; - let vv = { - contents: 0 - }; - let vv2 = { - contents: 0 - }; - let arr = Belt_Array.make(4, () => {}); - let arr2 = Belt_Array.make(2, () => {}); - for (let i = 0; i <= 1; ++i) { - let v$1 = { - contents: 0 - }; - v$1.contents = v$1.contents + i | 0; - for (let j = 0; j <= 1; ++j) { - v$1.contents = v$1.contents + 1 | 0; - collect(v$1.contents); - arr[(i << 1) + j | 0] = () => { - vv.contents = vv.contents + v$1.contents | 0; - }; - } - arr2[i] = () => { - vv2.contents = vv2.contents + v$1.contents | 0; - }; - } - Belt_Array.forEach(arr, f => f()); - Belt_Array.forEach(arr2, f => f()); - return [[ - vv.contents, - Belt_List.toArray(Belt_List.reverse(v.contents)), - vv2.contents - ]]; -} - -let suites_0 = [ - "for_loop_test_3", - param => ({ - TAG: "Eq", - _0: 90, - _1: for_3(Belt_Array.make(10, 2)) - }) -]; - -let suites_1 = { - hd: [ - "for_loop_test_4", - param => ({ - TAG: "Eq", - _0: 180, - _1: for_4(Belt_Array.make(10, 2)) - }) - ], - tl: { - hd: [ - "for_loop_test_5", - param => ({ - TAG: "Eq", - _0: 2420, - _1: for_5(Belt_Array.make(10, 2), 11) - }) - ], - tl: { - hd: [ - "for_loop_test_6", - param => ({ - TAG: "Eq", - _0: [ - 30, - 1, - 2, - 3 - ], - _1: for_6(Belt_Array.make(3, 0), 0) - }) - ], - tl: { - hd: [ - "for_loop_test_7", - param => ({ - TAG: "Eq", - _0: 84, - _1: for_7() - }) - ], - tl: { - hd: [ - "for_loop_test_8", - param => ({ - TAG: "Eq", - _0: 294, - _1: for_8() - }) - ], - tl: { - hd: [ - "for_loop_test_9", - param => ({ - TAG: "Eq", - _0: [[ - 10, - [ - 1, - 2, - 2, - 3 - ], - 5 - ]], - _1: for_9() - }) - ], - tl: /* [] */0 - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -exports.for_3 = for_3; -exports.for_4 = for_4; -exports.for_5 = for_5; -exports.for_6 = for_6; -exports.for_7 = for_7; -exports.for_8 = for_8; -exports.for_9 = for_9; -exports.suites = suites; -/* No side effect */ diff --git a/tests/tests/src/for_loop_test.mjs b/tests/tests/src/for_loop_test.mjs new file mode 100644 index 0000000000..773daf9f45 --- /dev/null +++ b/tests/tests/src/for_loop_test.mjs @@ -0,0 +1,266 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +function for_3(x) { + let v = { + contents: 0 + }; + let arr = Belt_Array.map(x, param => (() => {})); + for (let i = 0, i_finish = x.length; i < i_finish; ++i) { + let j = (i << 1); + arr[i] = () => { + v.contents = v.contents + j | 0; + }; + } + Belt_Array.forEach(arr, x => x()); + return v.contents; +} + +function for_4(x) { + let v = { + contents: 0 + }; + let arr = Belt_Array.map(x, param => (() => {})); + for (let i = 0, i_finish = x.length; i < i_finish; ++i) { + let j = (i << 1); + let k = (j << 1); + arr[i] = () => { + v.contents = v.contents + k | 0; + }; + } + Belt_Array.forEach(arr, x => x()); + return v.contents; +} + +function for_5(x, u) { + let v = { + contents: 0 + }; + let arr = Belt_Array.map(x, param => (() => {})); + for (let i = 0, i_finish = x.length; i < i_finish; ++i) { + let k = Math.imul((u << 1), u); + arr[i] = () => { + v.contents = v.contents + k | 0; + }; + } + Belt_Array.forEach(arr, x => x()); + return v.contents; +} + +function for_6(x, u) { + let v = { + contents: 0 + }; + let arr = Belt_Array.map(x, param => (() => {})); + let v4 = { + contents: 0 + }; + let v5 = { + contents: 0 + }; + let inspect_3 = -1; + v4.contents = v4.contents + 1 | 0; + for (let j = 0; j <= 1; ++j) { + v5.contents = v5.contents + 1 | 0; + let v2 = { + contents: 0 + }; + for (let i = 0, i_finish = x.length; i < i_finish; ++i) { + let k = Math.imul((u << 1), u); + let h = (v5.contents << 1); + v2.contents = v2.contents + 1 | 0; + arr[i] = () => { + v.contents = (((((v.contents + k | 0) + v2.contents | 0) + v4.contents | 0) + v5.contents | 0) + h | 0) + u | 0; + }; + } + inspect_3 = v2.contents; + } + Belt_Array.forEach(arr, x => x()); + return [ + v.contents, + v4.contents, + v5.contents, + inspect_3 + ]; +} + +function for_7() { + let v = { + contents: 0 + }; + let arr = Belt_Array.make(21, () => {}); + for (let i = 0; i <= 6; ++i) { + for (let j = 0; j <= 2; ++j) { + arr[Math.imul(i, 3) + j | 0] = () => { + v.contents = (v.contents + i | 0) + j | 0; + }; + } + } + Belt_Array.forEach(arr, f => f()); + return v.contents; +} + +function for_8() { + let v = { + contents: 0 + }; + let arr = Belt_Array.make(21, () => {}); + for (let i = 0; i <= 6; ++i) { + let k = (i << 1); + for (let j = 0; j <= 2; ++j) { + let h = i + j | 0; + arr[Math.imul(i, 3) + j | 0] = () => { + v.contents = (((v.contents + i | 0) + j | 0) + h | 0) + k | 0; + }; + } + } + Belt_Array.forEach(arr, f => f()); + return v.contents; +} + +function for_9() { + let v = { + contents: /* [] */0 + }; + let collect = x => { + v.contents = { + hd: x, + tl: v.contents + }; + }; + let vv = { + contents: 0 + }; + let vv2 = { + contents: 0 + }; + let arr = Belt_Array.make(4, () => {}); + let arr2 = Belt_Array.make(2, () => {}); + for (let i = 0; i <= 1; ++i) { + let v$1 = { + contents: 0 + }; + v$1.contents = v$1.contents + i | 0; + for (let j = 0; j <= 1; ++j) { + v$1.contents = v$1.contents + 1 | 0; + collect(v$1.contents); + arr[(i << 1) + j | 0] = () => { + vv.contents = vv.contents + v$1.contents | 0; + }; + } + arr2[i] = () => { + vv2.contents = vv2.contents + v$1.contents | 0; + }; + } + Belt_Array.forEach(arr, f => f()); + Belt_Array.forEach(arr2, f => f()); + return [[ + vv.contents, + Belt_List.toArray(Belt_List.reverse(v.contents)), + vv2.contents + ]]; +} + +let suites_0 = [ + "for_loop_test_3", + param => ({ + TAG: "Eq", + _0: 90, + _1: for_3(Belt_Array.make(10, 2)) + }) +]; + +let suites_1 = { + hd: [ + "for_loop_test_4", + param => ({ + TAG: "Eq", + _0: 180, + _1: for_4(Belt_Array.make(10, 2)) + }) + ], + tl: { + hd: [ + "for_loop_test_5", + param => ({ + TAG: "Eq", + _0: 2420, + _1: for_5(Belt_Array.make(10, 2), 11) + }) + ], + tl: { + hd: [ + "for_loop_test_6", + param => ({ + TAG: "Eq", + _0: [ + 30, + 1, + 2, + 3 + ], + _1: for_6(Belt_Array.make(3, 0), 0) + }) + ], + tl: { + hd: [ + "for_loop_test_7", + param => ({ + TAG: "Eq", + _0: 84, + _1: for_7() + }) + ], + tl: { + hd: [ + "for_loop_test_8", + param => ({ + TAG: "Eq", + _0: 294, + _1: for_8() + }) + ], + tl: { + hd: [ + "for_loop_test_9", + param => ({ + TAG: "Eq", + _0: [[ + 10, + [ + 1, + 2, + 2, + 3 + ], + 5 + ]], + _1: for_9() + }) + ], + tl: /* [] */0 + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +export { + for_3, + for_4, + for_5, + for_6, + for_7, + for_8, + for_9, + suites, +} +/* No side effect */ diff --git a/tests/tests/src/for_side_effect_test.js b/tests/tests/src/for_side_effect_test.js deleted file mode 100644 index 5ad59cf45d..0000000000 --- a/tests/tests/src/for_side_effect_test.js +++ /dev/null @@ -1,41 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function tst() { - for (let i = (console.log("hi"), 0), i_finish = (console.log("hello"), 3); i <= i_finish; ++i) { - - } -} - -function test2() { - let v = 0; - v = 3; - v = 10; - for (let i = 0; i <= 1; ++i) { - - } - return v; -} - -let suites_0 = [ - "for_order", - param => ({ - TAG: "Eq", - _0: 10, - _1: test2() - }) -]; - -let suites = { - hd: suites_0, - tl: /* [] */0 -}; - -Mt.from_pair_suites("For_side_effect_test", suites); - -exports.tst = tst; -exports.test2 = test2; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/for_side_effect_test.mjs b/tests/tests/src/for_side_effect_test.mjs new file mode 100644 index 0000000000..b6cd3db629 --- /dev/null +++ b/tests/tests/src/for_side_effect_test.mjs @@ -0,0 +1,42 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function tst() { + for (let i = (console.log("hi"), 0), i_finish = (console.log("hello"), 3); i <= i_finish; ++i) { + + } +} + +function test2() { + let v = 0; + v = 3; + v = 10; + for (let i = 0; i <= 1; ++i) { + + } + return v; +} + +let suites_0 = [ + "for_order", + param => ({ + TAG: "Eq", + _0: 10, + _1: test2() + }) +]; + +let suites = { + hd: suites_0, + tl: /* [] */0 +}; + +Mt.from_pair_suites("For_side_effect_test", suites); + +export { + tst, + test2, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/format_regression.js b/tests/tests/src/format_regression.js deleted file mode 100644 index 4f2a36aadf..0000000000 --- a/tests/tests/src/format_regression.js +++ /dev/null @@ -1,76 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function peek_queue(param) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 10, - 22 - ], - Error: new Error() - }; -} - -function int_of_size(param) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 11, - 23 - ], - Error: new Error() - }; -} - -function take_queue(param) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 12, - 22 - ], - Error: new Error() - }; -} - -function format_pp_token(param, param$1, param$2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "format_regression.res", - 13, - 35 - ], - Error: new Error() - }; -} - -function advance_loop(state) { - while (true) { - let match = peek_queue(state.pp_queue); - let size = match.elem_size; - let size$1 = int_of_size(size); - if (size$1 < 0 && (state.pp_right_total - state.pp_left_total | 0) < state.pp_space_left) { - return; - } - take_queue(state.pp_queue); - format_pp_token(state, size$1 < 0 ? 1000000010 : size$1, match.token); - state.pp_left_total = match.length + state.pp_left_total | 0; - continue; - }; -} - -let pp_infinity = 1000000010; - -exports.peek_queue = peek_queue; -exports.int_of_size = int_of_size; -exports.take_queue = take_queue; -exports.format_pp_token = format_pp_token; -exports.pp_infinity = pp_infinity; -exports.advance_loop = advance_loop; -/* No side effect */ diff --git a/tests/tests/src/format_regression.mjs b/tests/tests/src/format_regression.mjs new file mode 100644 index 0000000000..f06f105f26 --- /dev/null +++ b/tests/tests/src/format_regression.mjs @@ -0,0 +1,77 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function peek_queue(param) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 10, + 22 + ], + Error: new Error() + }; +} + +function int_of_size(param) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 11, + 23 + ], + Error: new Error() + }; +} + +function take_queue(param) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 12, + 22 + ], + Error: new Error() + }; +} + +function format_pp_token(param, param$1, param$2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "format_regression.res", + 13, + 35 + ], + Error: new Error() + }; +} + +function advance_loop(state) { + while (true) { + let match = peek_queue(state.pp_queue); + let size = match.elem_size; + let size$1 = int_of_size(size); + if (size$1 < 0 && (state.pp_right_total - state.pp_left_total | 0) < state.pp_space_left) { + return; + } + take_queue(state.pp_queue); + format_pp_token(state, size$1 < 0 ? 1000000010 : size$1, match.token); + state.pp_left_total = match.length + state.pp_left_total | 0; + continue; + }; +} + +let pp_infinity = 1000000010; + +export { + peek_queue, + int_of_size, + take_queue, + format_pp_token, + pp_infinity, + advance_loop, +} +/* No side effect */ diff --git a/tests/tests/src/fun_pattern_match.js b/tests/tests/src/fun_pattern_match.js deleted file mode 100644 index 1759104a45..0000000000 --- a/tests/tests/src/fun_pattern_match.js +++ /dev/null @@ -1,96 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -function f(param, v) { - return ((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + v | 0; -} - -function f2(param, param$1) { - return (((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + param$1.a | 0) + param$1.b | 0; -} - -function f3(param, param$1) { - let lhs = param.rank; - let rhs = param$1.rank; - if (typeof lhs !== "object") { - lhs === "Uninitialized"; - } else { - if (typeof rhs === "object") { - return Primitive_int.compare(lhs._0, rhs._0); - } - rhs === "Uninitialized"; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 33, - 9 - ], - Error: new Error() - }; -} - -function f4(param, param$1) { - let lhs = param.rank; - let rhs = param$1.rank; - if (typeof lhs !== "object") { - lhs === "Uninitialized"; - } else { - if (typeof rhs === "object") { - return Primitive_int.compare(lhs._0, rhs._0); - } - rhs === "Uninitialized"; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "fun_pattern_match.res", - 39, - 9 - ], - Error: new Error() - }; -} - -let x = { - NAME: "A", - VAL: r -}; - -function r() { - return x; -} - -let match = r(); - -let v = match.VAL(); - -console.log(v); - -function handle_tuple(x, y) { - if (x !== 0) { - if (x === 1 && y === 2) { - return 3; - } - - } else if (y === 1) { - return 2; - } - console.log([ - x, - y - ]); - return x + y | 0; -} - -exports.f = f; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -exports.r = r; -exports.v = v; -exports.handle_tuple = handle_tuple; -/* match Not a pure module */ diff --git a/tests/tests/src/fun_pattern_match.mjs b/tests/tests/src/fun_pattern_match.mjs new file mode 100644 index 0000000000..1a175d381d --- /dev/null +++ b/tests/tests/src/fun_pattern_match.mjs @@ -0,0 +1,97 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +function f(param, v) { + return ((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + v | 0; +} + +function f2(param, param$1) { + return (((((param.x0 + param.x1 | 0) + param.x2 | 0) + param.x3 | 0) + param.x4 | 0) + param$1.a | 0) + param$1.b | 0; +} + +function f3(param, param$1) { + let lhs = param.rank; + let rhs = param$1.rank; + if (typeof lhs !== "object") { + lhs === "Uninitialized"; + } else { + if (typeof rhs === "object") { + return Primitive_int.compare(lhs._0, rhs._0); + } + rhs === "Uninitialized"; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 33, + 9 + ], + Error: new Error() + }; +} + +function f4(param, param$1) { + let lhs = param.rank; + let rhs = param$1.rank; + if (typeof lhs !== "object") { + lhs === "Uninitialized"; + } else { + if (typeof rhs === "object") { + return Primitive_int.compare(lhs._0, rhs._0); + } + rhs === "Uninitialized"; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "fun_pattern_match.res", + 39, + 9 + ], + Error: new Error() + }; +} + +let x = { + NAME: "A", + VAL: r +}; + +function r() { + return x; +} + +let match = r(); + +let v = match.VAL(); + +console.log(v); + +function handle_tuple(x, y) { + if (x !== 0) { + if (x === 1 && y === 2) { + return 3; + } + + } else if (y === 1) { + return 2; + } + console.log([ + x, + y + ]); + return x + y | 0; +} + +export { + f, + f2, + f3, + f4, + r, + v, + handle_tuple, +} +/* match Not a pure module */ diff --git a/tests/tests/src/function_directives.js b/tests/tests/src/function_directives.js deleted file mode 100644 index 0899e32f5f..0000000000 --- a/tests/tests/src/function_directives.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function testFnWithDirective(name) { - 'use memo'; - return "Hello " + name; -} - -exports.testFnWithDirective = testFnWithDirective; -/* No side effect */ diff --git a/tests/tests/src/function_directives.mjs b/tests/tests/src/function_directives.mjs new file mode 100644 index 0000000000..c52fde9713 --- /dev/null +++ b/tests/tests/src/function_directives.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function testFnWithDirective(name) { + 'use memo'; + return "Hello " + name; +} + +export { + testFnWithDirective, +} +/* No side effect */ diff --git a/tests/tests/src/function_directives_no_inline.js b/tests/tests/src/function_directives_no_inline.js deleted file mode 100644 index 722bb4ca81..0000000000 --- a/tests/tests/src/function_directives_no_inline.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function testFnWithDirective(name) { - 'use server'; - return "Hello " + name; -} - -let x = testFnWithDirective("test"); - -exports.testFnWithDirective = testFnWithDirective; -exports.x = x; -/* x Not a pure module */ diff --git a/tests/tests/src/function_directives_no_inline.mjs b/tests/tests/src/function_directives_no_inline.mjs new file mode 100644 index 0000000000..b75084c2a8 --- /dev/null +++ b/tests/tests/src/function_directives_no_inline.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function testFnWithDirective(name) { + 'use server'; + return "Hello " + name; +} + +let x = testFnWithDirective("test"); + +export { + testFnWithDirective, + x, +} +/* x Not a pure module */ diff --git a/tests/tests/src/functor_app_test.js b/tests/tests/src/functor_app_test.js deleted file mode 100644 index f989957a63..0000000000 --- a/tests/tests/src/functor_app_test.js +++ /dev/null @@ -1,51 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Functor_def = require("./functor_def.js"); -let Functor_inst = require("./functor_inst.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let Y0 = Functor_def.Make(Functor_inst); - -let Y1 = Functor_def.Make(Functor_inst); - -eq("File \"functor_app_test.res\", line 18, characters 3-10", Y0.h(1, 2), 4); - -eq("File \"functor_app_test.res\", line 19, characters 3-10", Y1.h(2, 3), 6); - -let v = Functor_def.$$return(); - -eq("File \"functor_app_test.res\", line 23, characters 3-10", v, 2); - -Mt.from_pair_suites("Functor_app_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.Y0 = Y0; -exports.Y1 = Y1; -exports.v = v; -/* Y0 Not a pure module */ diff --git a/tests/tests/src/functor_app_test.mjs b/tests/tests/src/functor_app_test.mjs new file mode 100644 index 0000000000..affd2cd6d4 --- /dev/null +++ b/tests/tests/src/functor_app_test.mjs @@ -0,0 +1,52 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Functor_def from "./functor_def.mjs"; +import * as Functor_inst from "./functor_inst.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let Y0 = Functor_def.Make(Functor_inst); + +let Y1 = Functor_def.Make(Functor_inst); + +eq("File \"functor_app_test.res\", line 18, characters 3-10", Y0.h(1, 2), 4); + +eq("File \"functor_app_test.res\", line 19, characters 3-10", Y1.h(2, 3), 6); + +let v = Functor_def.$$return(); + +eq("File \"functor_app_test.res\", line 23, characters 3-10", v, 2); + +Mt.from_pair_suites("Functor_app_test", suites.contents); + +export { + suites, + test_id, + eq, + Y0, + Y1, + v, +} +/* Y0 Not a pure module */ diff --git a/tests/tests/src/functor_def.js b/tests/tests/src/functor_def.js deleted file mode 100644 index 756262d85a..0000000000 --- a/tests/tests/src/functor_def.js +++ /dev/null @@ -1,32 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = { - contents: 0 -}; - -function f(x, x$1) { - v.contents = v.contents + 1 | 0; - return x$1 + x$1 | 0; -} - -function $$return() { - return v.contents; -} - -function Make(U) { - let h = (x, x$1) => { - console.log(f(x$1, x$1)); - return U.say(x$1, x$1); - }; - return { - h: h - }; -} - -exports.v = v; -exports.f = f; -exports.$$return = $$return; -exports.Make = Make; -/* No side effect */ diff --git a/tests/tests/src/functor_def.mjs b/tests/tests/src/functor_def.mjs new file mode 100644 index 0000000000..87baf8c358 --- /dev/null +++ b/tests/tests/src/functor_def.mjs @@ -0,0 +1,33 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = { + contents: 0 +}; + +function f(x, x$1) { + v.contents = v.contents + 1 | 0; + return x$1 + x$1 | 0; +} + +function $$return() { + return v.contents; +} + +function Make(U) { + let h = (x, x$1) => { + console.log(f(x$1, x$1)); + return U.say(x$1, x$1); + }; + return { + h: h + }; +} + +export { + v, + f, + $$return, + Make, +} +/* No side effect */ diff --git a/tests/tests/src/functor_ffi.js b/tests/tests/src/functor_ffi.js deleted file mode 100644 index 077b43ce90..0000000000 --- a/tests/tests/src/functor_ffi.js +++ /dev/null @@ -1,31 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -function Make(S) { - let opt_get = (f, i) => Primitive_option.fromUndefined(f[i]); - return { - opt_get: opt_get - }; -} - -function opt_get(f, i) { - return Primitive_option.fromUndefined(f[i]); -} - -let Int_arr = { - opt_get: opt_get -}; - -function f(v) { - return [ - v[0], - Primitive_option.fromUndefined(v[1]) - ]; -} - -exports.Make = Make; -exports.Int_arr = Int_arr; -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/functor_ffi.mjs b/tests/tests/src/functor_ffi.mjs new file mode 100644 index 0000000000..8ea2c8aafe --- /dev/null +++ b/tests/tests/src/functor_ffi.mjs @@ -0,0 +1,32 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +function Make(S) { + let opt_get = (f, i) => Primitive_option.fromUndefined(f[i]); + return { + opt_get: opt_get + }; +} + +function opt_get(f, i) { + return Primitive_option.fromUndefined(f[i]); +} + +let Int_arr = { + opt_get: opt_get +}; + +function f(v) { + return [ + v[0], + Primitive_option.fromUndefined(v[1]) + ]; +} + +export { + Make, + Int_arr, + f, +} +/* No side effect */ diff --git a/tests/tests/src/functor_inst.js b/tests/tests/src/functor_inst.js deleted file mode 100644 index 9dcca2304c..0000000000 --- a/tests/tests/src/functor_inst.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function say(x, y) { - return x + y | 0; -} - -exports.say = say; -/* No side effect */ diff --git a/tests/tests/src/functor_inst.mjs b/tests/tests/src/functor_inst.mjs new file mode 100644 index 0000000000..9f6fa2406f --- /dev/null +++ b/tests/tests/src/functor_inst.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function say(x, y) { + return x + y | 0; +} + +export { + say, +} +/* No side effect */ diff --git a/tests/tests/src/functors.js b/tests/tests/src/functors.js deleted file mode 100644 index 44b8b1ef0a..0000000000 --- a/tests/tests/src/functors.js +++ /dev/null @@ -1,51 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function O(X) { - let cow = x => X.foo(x); - let sheep = x => 1 + X.foo(x) | 0; - return { - cow: cow, - sheep: sheep - }; -} - -function F(X, Y) { - let cow = x => Y.foo(X.foo(x)); - let sheep = x => 1 + Y.foo(X.foo(x)) | 0; - return { - cow: cow, - sheep: sheep - }; -} - -function F1(X, Y) { - let sheep = x => 1 + Y.foo(X.foo(x)) | 0; - return { - sheep: sheep - }; -} - -function F2(X, Y) { - let sheep = x => 1 + Y.foo(X.foo(x)) | 0; - return { - sheep: sheep - }; -} - -let M = { - F: (funarg, funarg$1) => { - let sheep = x => 1 + funarg$1.foo(funarg.foo(x)) | 0; - return { - sheep: sheep - }; - } -}; - -exports.O = O; -exports.F = F; -exports.F1 = F1; -exports.F2 = F2; -exports.M = M; -/* No side effect */ diff --git a/tests/tests/src/functors.mjs b/tests/tests/src/functors.mjs new file mode 100644 index 0000000000..3552471b2e --- /dev/null +++ b/tests/tests/src/functors.mjs @@ -0,0 +1,52 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function O(X) { + let cow = x => X.foo(x); + let sheep = x => 1 + X.foo(x) | 0; + return { + cow: cow, + sheep: sheep + }; +} + +function F(X, Y) { + let cow = x => Y.foo(X.foo(x)); + let sheep = x => 1 + Y.foo(X.foo(x)) | 0; + return { + cow: cow, + sheep: sheep + }; +} + +function F1(X, Y) { + let sheep = x => 1 + Y.foo(X.foo(x)) | 0; + return { + sheep: sheep + }; +} + +function F2(X, Y) { + let sheep = x => 1 + Y.foo(X.foo(x)) | 0; + return { + sheep: sheep + }; +} + +let M = { + F: (funarg, funarg$1) => { + let sheep = x => 1 + funarg$1.foo(funarg.foo(x)) | 0; + return { + sheep: sheep + }; + } +}; + +export { + O, + F, + F1, + F2, + M, +} +/* No side effect */ diff --git a/tests/tests/src/gbk.js b/tests/tests/src/gbk.js deleted file mode 100644 index 431b05718e..0000000000 --- a/tests/tests/src/gbk.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log("你好"); - -console.log("你好"); - -console.log("你好"); - -console.log("你好你好"); - -console.log("\\u4f60\\u597d"); - -/* Not a pure module */ diff --git a/tests/tests/src/gbk.mjs b/tests/tests/src/gbk.mjs new file mode 100644 index 0000000000..4713069ee1 --- /dev/null +++ b/tests/tests/src/gbk.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log("你好"); + +console.log("你好"); + +console.log("你好"); + +console.log("你好你好"); + +console.log("\\u4f60\\u597d"); + +/* Not a pure module */ diff --git a/tests/tests/src/gentTypeReTest.js b/tests/tests/src/gentTypeReTest.js deleted file mode 100644 index 7f7b74c9d4..0000000000 --- a/tests/tests/src/gentTypeReTest.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let GentTypeReTestGen = require("./gentTypeReTest.gen"); - -function f(prim) { - return GentTypeReTestGen.f(prim); -} - -exports.f = f; -/* ./gentTypeReTest.gen Not a pure module */ diff --git a/tests/tests/src/gentTypeReTest.mjs b/tests/tests/src/gentTypeReTest.mjs new file mode 100644 index 0000000000..6238d3ae03 --- /dev/null +++ b/tests/tests/src/gentTypeReTest.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as GentTypeReTestGen from "./gentTypeReTest.gen"; + +function f(prim) { + return GentTypeReTestGen.f(prim); +} + +export { + f, +} +/* ./gentTypeReTest.gen Not a pure module */ diff --git a/tests/tests/src/glob_test_add.js b/tests/tests/src/glob_test_add.js deleted file mode 100644 index 236426944d..0000000000 --- a/tests/tests/src/glob_test_add.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function add(x, y) { - return x + y | 0; -} - -exports.add = add; -/* No side effect */ diff --git a/tests/tests/src/glob_test_add.mjs b/tests/tests/src/glob_test_add.mjs new file mode 100644 index 0000000000..6411d2fe35 --- /dev/null +++ b/tests/tests/src/glob_test_add.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function add(x, y) { + return x + y | 0; +} + +export { + add, +} +/* No side effect */ diff --git a/tests/tests/src/glob_test_u.js b/tests/tests/src/glob_test_u.js deleted file mode 100644 index 7fe7ff01f9..0000000000 --- a/tests/tests/src/glob_test_u.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Glob_u = require("./glob_u.js"); - -let v = Glob_u.v; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/glob_test_u.mjs b/tests/tests/src/glob_test_u.mjs new file mode 100644 index 0000000000..d10ba715a1 --- /dev/null +++ b/tests/tests/src/glob_test_u.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Glob_u from "./glob_u.mjs"; + +let v = Glob_u.v; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/glob_u.js b/tests/tests/src/glob_u.js deleted file mode 100644 index e49a9a2be3..0000000000 --- a/tests/tests/src/glob_u.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = 3; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/glob_u.mjs b/tests/tests/src/glob_u.mjs new file mode 100644 index 0000000000..cf0b79fe71 --- /dev/null +++ b/tests/tests/src/glob_u.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = 3; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/glob_x.js b/tests/tests/src/glob_x.js deleted file mode 100644 index 8e4cf0d74c..0000000000 --- a/tests/tests/src/glob_x.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = 32; - -exports.v = v; -/* No side effect */ diff --git a/tests/tests/src/glob_x.mjs b/tests/tests/src/glob_x.mjs new file mode 100644 index 0000000000..6bf5005a51 --- /dev/null +++ b/tests/tests/src/glob_x.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = 32; + +export { + v, +} +/* No side effect */ diff --git a/tests/tests/src/global_exception_regression_test.js b/tests/tests/src/global_exception_regression_test.js deleted file mode 100644 index a659c2d3fb..0000000000 --- a/tests/tests/src/global_exception_regression_test.js +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let v = { - RE_EXN_ID: "Not_found" -}; - -let u = { - RE_EXN_ID: "Not_found" -}; - -let s = { - RE_EXN_ID: "End_of_file" -}; - -let suites_0 = [ - "not_found_equal", - param => ({ - TAG: "Eq", - _0: u, - _1: v - }) -]; - -let suites_1 = { - hd: [ - "not_found_not_equal_end_of_file", - param => ({ - TAG: "Neq", - _0: u, - _1: s - }) - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Global_exception_regression_test", suites); - -exports.v = v; -exports.u = u; -exports.s = s; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/global_exception_regression_test.mjs b/tests/tests/src/global_exception_regression_test.mjs new file mode 100644 index 0000000000..13326c86f5 --- /dev/null +++ b/tests/tests/src/global_exception_regression_test.mjs @@ -0,0 +1,51 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let v = { + RE_EXN_ID: "Not_found" +}; + +let u = { + RE_EXN_ID: "Not_found" +}; + +let s = { + RE_EXN_ID: "End_of_file" +}; + +let suites_0 = [ + "not_found_equal", + param => ({ + TAG: "Eq", + _0: u, + _1: v + }) +]; + +let suites_1 = { + hd: [ + "not_found_not_equal_end_of_file", + param => ({ + TAG: "Neq", + _0: u, + _1: s + }) + ], + tl: /* [] */0 +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Global_exception_regression_test", suites); + +export { + v, + u, + s, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/global_mangles.js b/tests/tests/src/global_mangles.js deleted file mode 100644 index 134806694a..0000000000 --- a/tests/tests/src/global_mangles.js +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let $$__dirname = 1; - -let $$__filename = 2; - -let $$exports = 3; - -let $$require = 4; - -exports.$$__dirname = $$__dirname; -exports.$$__filename = $$__filename; -exports.$$exports = $$exports; -exports.$$require = $$require; -/* No side effect */ diff --git a/tests/tests/src/global_mangles.mjs b/tests/tests/src/global_mangles.mjs new file mode 100644 index 0000000000..e507b65f58 --- /dev/null +++ b/tests/tests/src/global_mangles.mjs @@ -0,0 +1,18 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let $$__dirname = 1; + +let $$__filename = 2; + +let $$exports = 3; + +let $$require = 4; + +export { + $$__dirname, + $$__filename, + $$exports, + $$require, +} +/* No side effect */ diff --git a/tests/tests/src/global_module_alias_test.js b/tests/tests/src/global_module_alias_test.js deleted file mode 100644 index 59ea350887..0000000000 --- a/tests/tests/src/global_module_alias_test.js +++ /dev/null @@ -1,168 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let v = { - contents: 0 -}; - -function Make(U) { - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - return U; -} - -function f() { - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - return Belt_List; -} - -eq("File \"global_module_alias_test.res\", line 53, characters 12-19", Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}), 2); - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -v.contents = v.contents + 1 | 0; - -let H = Belt_List; - -eq("File \"global_module_alias_test.res\", line 57, characters 12-19", v.contents, 12); - -function g() { - return Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: { - hd: 4, - tl: /* [] */0 - } - } - } - }); -} - -function xx() { - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - v.contents = v.contents + 1 | 0; - return Belt_List; -} - -eq("File \"global_module_alias_test.res\", line 85, characters 12-19", g(), 4); - -let V = xx(); - -eq("File \"global_module_alias_test.res\", line 89, characters 5-12", V.length({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}), 3); - -eq("File \"global_module_alias_test.res\", line 90, characters 5-12", v.contents, 15); - -let H$1 = f(); - -eq("File \"global_module_alias_test.res\", line 92, characters 5-12", H$1.length({ - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}), 2); - -eq("File \"global_module_alias_test.res\", line 93, characters 5-12", v.contents, 21); - -Mt.from_pair_suites("Global_module_alias_test", suites.contents); - -let A; - -let B; - -let C; - -let D; - -let E; - -let F; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.A = A; -exports.B = B; -exports.C = C; -exports.D = D; -exports.E = E; -exports.F = F; -exports.v = v; -exports.Make = Make; -exports.f = f; -exports.H = H; -exports.g = g; -exports.xx = xx; -/* Not a pure module */ diff --git a/tests/tests/src/global_module_alias_test.mjs b/tests/tests/src/global_module_alias_test.mjs new file mode 100644 index 0000000000..8e04b8914c --- /dev/null +++ b/tests/tests/src/global_module_alias_test.mjs @@ -0,0 +1,169 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let v = { + contents: 0 +}; + +function Make(U) { + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + return U; +} + +function f() { + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + return Belt_List; +} + +eq("File \"global_module_alias_test.res\", line 53, characters 12-19", Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}), 2); + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +v.contents = v.contents + 1 | 0; + +let H = Belt_List; + +eq("File \"global_module_alias_test.res\", line 57, characters 12-19", v.contents, 12); + +function g() { + return Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: { + hd: 4, + tl: /* [] */0 + } + } + } + }); +} + +function xx() { + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + v.contents = v.contents + 1 | 0; + return Belt_List; +} + +eq("File \"global_module_alias_test.res\", line 85, characters 12-19", g(), 4); + +let V = xx(); + +eq("File \"global_module_alias_test.res\", line 89, characters 5-12", V.length({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}), 3); + +eq("File \"global_module_alias_test.res\", line 90, characters 5-12", v.contents, 15); + +let H$1 = f(); + +eq("File \"global_module_alias_test.res\", line 92, characters 5-12", H$1.length({ + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}), 2); + +eq("File \"global_module_alias_test.res\", line 93, characters 5-12", v.contents, 21); + +Mt.from_pair_suites("Global_module_alias_test", suites.contents); + +let A; + +let B; + +let C; + +let D; + +let E; + +let F; + +export { + suites, + test_id, + eq, + A, + B, + C, + D, + E, + F, + v, + Make, + f, + H, + g, + xx, +} +/* Not a pure module */ diff --git a/tests/tests/src/google_closure_test.js b/tests/tests/src/google_closure_test.js deleted file mode 100644 index 2e9cbe212d..0000000000 --- a/tests/tests/src/google_closure_test.js +++ /dev/null @@ -1,30 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Test_google_closure = require("./test_google_closure.js"); - -Mt.from_pair_suites("Closure", { - hd: [ - "partial", - () => ({ - TAG: "Eq", - _0: [ - Test_google_closure.a, - Test_google_closure.b, - Test_google_closure.c - ], - _1: [ - "3", - 101, - [ - 1, - 2 - ] - ] - }) - ], - tl: /* [] */0 -}); - -/* Not a pure module */ diff --git a/tests/tests/src/google_closure_test.mjs b/tests/tests/src/google_closure_test.mjs new file mode 100644 index 0000000000..0b7b69a2f5 --- /dev/null +++ b/tests/tests/src/google_closure_test.mjs @@ -0,0 +1,29 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Test_google_closure from "./test_google_closure.mjs"; + +Mt.from_pair_suites("Closure", { + hd: [ + "partial", + () => ({ + TAG: "Eq", + _0: [ + Test_google_closure.a, + Test_google_closure.b, + Test_google_closure.c + ], + _1: [ + "3", + 101, + [ + 1, + 2 + ] + ] + }) + ], + tl: /* [] */0 +}); + +/* Not a pure module */ diff --git a/tests/tests/src/gpr496_test.js b/tests/tests/src/gpr496_test.js deleted file mode 100644 index ad6cc10094..0000000000 --- a/tests/tests/src/gpr496_test.js +++ /dev/null @@ -1,82 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_bool = require("rescript/lib/js/Primitive_bool.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let expected = [ - false, - false, - true, - true, - -1, - 1, - 0, - 0 -]; - -let expected2 = [ - false, - false, - true, - true, - -1, - 1, - 0, - 0 -]; - -let u = [ - false, - false, - true, - true, - -1, - 1, - 0, - 0 -]; - -eq("File \"gpr496_test.res\", line 35, characters 12-19", expected, u); - -eq("File \"gpr496_test.res\", line 37, characters 12-19", expected, expected2); - -function ff(x, y) { - return Primitive_bool.min(x, y()); -} - -eq("File \"gpr496_test.res\", line 40, characters 12-19", true < false ? true : false, false); - -Mt.from_pair_suites("Gpr496_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.expected = expected; -exports.expected2 = expected2; -exports.u = u; -exports.ff = ff; -/* Not a pure module */ diff --git a/tests/tests/src/gpr496_test.mjs b/tests/tests/src/gpr496_test.mjs new file mode 100644 index 0000000000..99190d9362 --- /dev/null +++ b/tests/tests/src/gpr496_test.mjs @@ -0,0 +1,83 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_bool from "rescript/lib/es6/Primitive_bool.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let expected = [ + false, + false, + true, + true, + -1, + 1, + 0, + 0 +]; + +let expected2 = [ + false, + false, + true, + true, + -1, + 1, + 0, + 0 +]; + +let u = [ + false, + false, + true, + true, + -1, + 1, + 0, + 0 +]; + +eq("File \"gpr496_test.res\", line 35, characters 12-19", expected, u); + +eq("File \"gpr496_test.res\", line 37, characters 12-19", expected, expected2); + +function ff(x, y) { + return Primitive_bool.min(x, y()); +} + +eq("File \"gpr496_test.res\", line 40, characters 12-19", true < false ? true : false, false); + +Mt.from_pair_suites("Gpr496_test", suites.contents); + +export { + suites, + test_id, + eq, + expected, + expected2, + u, + ff, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1072.js b/tests/tests/src/gpr_1072.js deleted file mode 100644 index 5331e079e6..0000000000 --- a/tests/tests/src/gpr_1072.js +++ /dev/null @@ -1,192 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let u = { - y: 3 -}; - -let v_ice_cream3_0 = { - flavor: "vanilla", - num: 3 -}; - -let v_ice_cream3_1 = { - hd: { - flavor: "x", - num: 3 - }, - tl: { - hd: { - flavor: "vanilla", - num: 3 - }, - tl: /* [] */0 - } -}; - -let v_ice_cream3 = { - hd: v_ice_cream3_0, - tl: v_ice_cream3_1 -}; - -let v_ice_cream4_0 = { - flavor: "vanilla", - num: 3 -}; - -let v_ice_cream4_1 = { - hd: { - flavor: "x", - num: 3 - }, - tl: /* [] */0 -}; - -let v_ice_cream4 = { - hd: v_ice_cream4_0, - tl: v_ice_cream4_1 -}; - -let vv = { - x__ignore: 3 -}; - -let int_expect = { - x__ignore: 0 -}; - -let int_expect2 = { - x__ignore: 0 -}; - -let int_expects_0 = {}; - -let int_expects_1 = { - hd: { - x__ignore: 2 - }, - tl: { - hd: { - x__ignore: 3 - }, - tl: /* [] */0 - } -}; - -let int_expects = { - hd: int_expects_0, - tl: int_expects_1 -}; - -let mk_ice = { - flavour: "vanilla", - num: 3 -}; - -let my_ice2 = { - flavour: "vanilla", - num: 1 -}; - -let my_ice3 = { - num: 2 -}; - -let v_mk4 = { - y: 3 -}; - -let v_mk5 = { - x: undefined, - y: 3 -}; - -let v_mk6 = { - y: 3 -}; - -let v_mk6_1 = { - x: undefined, - y: 3 -}; - -let mk_u = { - x__ignore: 0 -}; - -let v_mk7_0 = { - y: 3 -}; - -let v_mk7_1 = { - hd: { - y: 2 - }, - tl: { - hd: { - y: 2 - }, - tl: /* [] */0 - } -}; - -let v_mk7 = { - hd: v_mk7_0, - tl: v_mk7_1 -}; - -again("a", 3); - -again(undefined, 3); - -again(undefined, 3); - -again(undefined, 3); - -again2("a", 3); - -again3(3); - -again3(2); - -let side_effect = { - contents: 0 -}; - -again4(undefined, undefined, 141); - -again4(undefined, undefined, 142); - -again4(undefined, undefined, 143); - -again4(undefined, undefined, 144); - -again4(undefined, undefined, 145); - -again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), undefined, 152); - -again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), (side_effect.contents = side_effect.contents - 1 | 0, undefined), 164); - -again4(undefined, (side_effect.contents = side_effect.contents - 1 | 0, undefined), 172); - -again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), undefined, 175); - -exports.u = u; -exports.v_ice_cream3 = v_ice_cream3; -exports.v_ice_cream4 = v_ice_cream4; -exports.vv = vv; -exports.int_expect = int_expect; -exports.int_expect2 = int_expect2; -exports.int_expects = int_expects; -exports.mk_ice = mk_ice; -exports.my_ice2 = my_ice2; -exports.my_ice3 = my_ice3; -exports.v_mk4 = v_mk4; -exports.v_mk5 = v_mk5; -exports.v_mk6 = v_mk6; -exports.v_mk6_1 = v_mk6_1; -exports.mk_u = mk_u; -exports.v_mk7 = v_mk7; -exports.side_effect = side_effect; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1072.mjs b/tests/tests/src/gpr_1072.mjs new file mode 100644 index 0000000000..eb64957172 --- /dev/null +++ b/tests/tests/src/gpr_1072.mjs @@ -0,0 +1,193 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let u = { + y: 3 +}; + +let v_ice_cream3_0 = { + flavor: "vanilla", + num: 3 +}; + +let v_ice_cream3_1 = { + hd: { + flavor: "x", + num: 3 + }, + tl: { + hd: { + flavor: "vanilla", + num: 3 + }, + tl: /* [] */0 + } +}; + +let v_ice_cream3 = { + hd: v_ice_cream3_0, + tl: v_ice_cream3_1 +}; + +let v_ice_cream4_0 = { + flavor: "vanilla", + num: 3 +}; + +let v_ice_cream4_1 = { + hd: { + flavor: "x", + num: 3 + }, + tl: /* [] */0 +}; + +let v_ice_cream4 = { + hd: v_ice_cream4_0, + tl: v_ice_cream4_1 +}; + +let vv = { + x__ignore: 3 +}; + +let int_expect = { + x__ignore: 0 +}; + +let int_expect2 = { + x__ignore: 0 +}; + +let int_expects_0 = {}; + +let int_expects_1 = { + hd: { + x__ignore: 2 + }, + tl: { + hd: { + x__ignore: 3 + }, + tl: /* [] */0 + } +}; + +let int_expects = { + hd: int_expects_0, + tl: int_expects_1 +}; + +let mk_ice = { + flavour: "vanilla", + num: 3 +}; + +let my_ice2 = { + flavour: "vanilla", + num: 1 +}; + +let my_ice3 = { + num: 2 +}; + +let v_mk4 = { + y: 3 +}; + +let v_mk5 = { + x: undefined, + y: 3 +}; + +let v_mk6 = { + y: 3 +}; + +let v_mk6_1 = { + x: undefined, + y: 3 +}; + +let mk_u = { + x__ignore: 0 +}; + +let v_mk7_0 = { + y: 3 +}; + +let v_mk7_1 = { + hd: { + y: 2 + }, + tl: { + hd: { + y: 2 + }, + tl: /* [] */0 + } +}; + +let v_mk7 = { + hd: v_mk7_0, + tl: v_mk7_1 +}; + +again("a", 3); + +again(undefined, 3); + +again(undefined, 3); + +again(undefined, 3); + +again2("a", 3); + +again3(3); + +again3(2); + +let side_effect = { + contents: 0 +}; + +again4(undefined, undefined, 141); + +again4(undefined, undefined, 142); + +again4(undefined, undefined, 143); + +again4(undefined, undefined, 144); + +again4(undefined, undefined, 145); + +again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), undefined, 152); + +again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), (side_effect.contents = side_effect.contents - 1 | 0, undefined), 164); + +again4(undefined, (side_effect.contents = side_effect.contents - 1 | 0, undefined), 172); + +again4((side_effect.contents = side_effect.contents + 1 | 0, undefined), undefined, 175); + +export { + u, + v_ice_cream3, + v_ice_cream4, + vv, + int_expect, + int_expect2, + int_expects, + mk_ice, + my_ice2, + my_ice3, + v_mk4, + v_mk5, + v_mk6, + v_mk6_1, + mk_u, + v_mk7, + side_effect, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1072_reg.js b/tests/tests/src/gpr_1072_reg.js deleted file mode 100644 index 282186115c..0000000000 --- a/tests/tests/src/gpr_1072_reg.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v1 = { - localeMatcher: "best fit", - formatMatcher: "basic", - day: "2-digit", - timeZoneName: "short" -}; - -exports.v1 = v1; -/* No side effect */ diff --git a/tests/tests/src/gpr_1072_reg.mjs b/tests/tests/src/gpr_1072_reg.mjs new file mode 100644 index 0000000000..693b7b72fe --- /dev/null +++ b/tests/tests/src/gpr_1072_reg.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v1 = { + localeMatcher: "best fit", + formatMatcher: "basic", + day: "2-digit", + timeZoneName: "short" +}; + +export { + v1, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1150.js b/tests/tests/src/gpr_1150.js deleted file mode 100644 index b5cc9c15ab..0000000000 --- a/tests/tests/src/gpr_1150.js +++ /dev/null @@ -1,249 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(children) { - if (!children) { - return []; - } - let children$1 = children.tl; - let a0 = children.hd; - if (!children$1) { - return [a0]; - } - let children$2 = children$1.tl; - let a1 = children$1.hd; - if (!children$2) { - return [ - a0, - a1 - ]; - } - let children$3 = children$2.tl; - let a2 = children$2.hd; - if (!children$3) { - return [ - a0, - a1, - a2 - ]; - } - let children$4 = children$3.tl; - let a3 = children$3.hd; - if (!children$4) { - return [ - a0, - a1, - a2, - a3 - ]; - } - let children$5 = children$4.tl; - let a4 = children$4.hd; - if (!children$5) { - return [ - a0, - a1, - a2, - a3, - a4 - ]; - } - let children$6 = children$5.tl; - let a5 = children$5.hd; - if (!children$6) { - return [ - a0, - a1, - a2, - a3, - a4, - a5 - ]; - } - let children$7 = children$6.tl; - let a6 = children$6.hd; - if (!children$7) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6 - ]; - } - let children$8 = children$7.tl; - let a7 = children$7.hd; - if (!children$8) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7 - ]; - } - let children$9 = children$8.tl; - let a8 = children$8.hd; - if (!children$9) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8 - ]; - } - let children$10 = children$9.tl; - let a9 = children$9.hd; - if (!children$10) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9 - ]; - } - let children$11 = children$10.tl; - let a10 = children$10.hd; - if (!children$11) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10 - ]; - } - let children$12 = children$11.tl; - let a11 = children$11.hd; - if (!children$12) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11 - ]; - } - let children$13 = children$12.tl; - let a12 = children$12.hd; - if (!children$13) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12 - ]; - } - let children$14 = children$13.tl; - let a13 = children$13.hd; - if (!children$14) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13 - ]; - } - let children$15 = children$14.tl; - let a14 = children$14.hd; - if (!children$15) { - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14 - ]; - } - if (children$15.tl) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1150.res", - 100, - 62 - ], - Error: new Error() - }; - } - return [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - children$15.hd - ]; -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_1150.mjs b/tests/tests/src/gpr_1150.mjs new file mode 100644 index 0000000000..6485e77f1c --- /dev/null +++ b/tests/tests/src/gpr_1150.mjs @@ -0,0 +1,250 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(children) { + if (!children) { + return []; + } + let children$1 = children.tl; + let a0 = children.hd; + if (!children$1) { + return [a0]; + } + let children$2 = children$1.tl; + let a1 = children$1.hd; + if (!children$2) { + return [ + a0, + a1 + ]; + } + let children$3 = children$2.tl; + let a2 = children$2.hd; + if (!children$3) { + return [ + a0, + a1, + a2 + ]; + } + let children$4 = children$3.tl; + let a3 = children$3.hd; + if (!children$4) { + return [ + a0, + a1, + a2, + a3 + ]; + } + let children$5 = children$4.tl; + let a4 = children$4.hd; + if (!children$5) { + return [ + a0, + a1, + a2, + a3, + a4 + ]; + } + let children$6 = children$5.tl; + let a5 = children$5.hd; + if (!children$6) { + return [ + a0, + a1, + a2, + a3, + a4, + a5 + ]; + } + let children$7 = children$6.tl; + let a6 = children$6.hd; + if (!children$7) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6 + ]; + } + let children$8 = children$7.tl; + let a7 = children$7.hd; + if (!children$8) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7 + ]; + } + let children$9 = children$8.tl; + let a8 = children$8.hd; + if (!children$9) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8 + ]; + } + let children$10 = children$9.tl; + let a9 = children$9.hd; + if (!children$10) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9 + ]; + } + let children$11 = children$10.tl; + let a10 = children$10.hd; + if (!children$11) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10 + ]; + } + let children$12 = children$11.tl; + let a11 = children$11.hd; + if (!children$12) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11 + ]; + } + let children$13 = children$12.tl; + let a12 = children$12.hd; + if (!children$13) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12 + ]; + } + let children$14 = children$13.tl; + let a13 = children$13.hd; + if (!children$14) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13 + ]; + } + let children$15 = children$14.tl; + let a14 = children$14.hd; + if (!children$15) { + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14 + ]; + } + if (children$15.tl) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1150.res", + 100, + 62 + ], + Error: new Error() + }; + } + return [ + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + children$15.hd + ]; +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1170.js b/tests/tests/src/gpr_1170.js deleted file mode 100644 index 17d775348e..0000000000 --- a/tests/tests/src/gpr_1170.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(resp) { - resp.statusCode = 200; - resp.hi = "hi"; -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_1170.mjs b/tests/tests/src/gpr_1170.mjs new file mode 100644 index 0000000000..29c0e9438c --- /dev/null +++ b/tests/tests/src/gpr_1170.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(resp) { + resp.statusCode = 200; + resp.hi = "hi"; +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1240_missing_unbox.js b/tests/tests/src/gpr_1240_missing_unbox.js deleted file mode 100644 index abd18ac83d..0000000000 --- a/tests/tests/src/gpr_1240_missing_unbox.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x, y) { - let x$1 = x; - let y$1 = y; - return [ - x$1, - y$1 - ]; -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_1240_missing_unbox.mjs b/tests/tests/src/gpr_1240_missing_unbox.mjs new file mode 100644 index 0000000000..2719a6e2a6 --- /dev/null +++ b/tests/tests/src/gpr_1240_missing_unbox.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x, y) { + let x$1 = x; + let y$1 = y; + return [ + x$1, + y$1 + ]; +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1245_test.js b/tests/tests/src/gpr_1245_test.js deleted file mode 100644 index b711c99090..0000000000 --- a/tests/tests/src/gpr_1245_test.js +++ /dev/null @@ -1,64 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let x = { - contents: 1 -}; - -let y = { - contents: 2 -}; - -function f(param) { - let a = { - contents: param[0] - }; - let b = { - contents: param[1] - }; - console.log(a, b); -} - -function g() { - return 3; -} - -function a0(f) { - let u = f(); - if (u !== null) { - console.log(u); - console.log(u); - return 1; - } else { - return 0; - } -} - -function a1(f) { - let E = /* @__PURE__ */Primitive_exceptions.create("E"); - try { - return f(); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === E) { - return 1; - } - throw exn; - } -} - -let a = 1; - -let b = 2; - -exports.a = a; -exports.b = b; -exports.x = x; -exports.y = y; -exports.f = f; -exports.g = g; -exports.a0 = a0; -exports.a1 = a1; -/* No side effect */ diff --git a/tests/tests/src/gpr_1245_test.mjs b/tests/tests/src/gpr_1245_test.mjs new file mode 100644 index 0000000000..ac31796aa0 --- /dev/null +++ b/tests/tests/src/gpr_1245_test.mjs @@ -0,0 +1,65 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let x = { + contents: 1 +}; + +let y = { + contents: 2 +}; + +function f(param) { + let a = { + contents: param[0] + }; + let b = { + contents: param[1] + }; + console.log(a, b); +} + +function g() { + return 3; +} + +function a0(f) { + let u = f(); + if (u !== null) { + console.log(u); + console.log(u); + return 1; + } else { + return 0; + } +} + +function a1(f) { + let E = /* @__PURE__ */Primitive_exceptions.create("E"); + try { + return f(); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === E) { + return 1; + } + throw exn; + } +} + +let a = 1; + +let b = 2; + +export { + a, + b, + x, + y, + f, + g, + a0, + a1, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1268.js b/tests/tests/src/gpr_1268.js deleted file mode 100644 index ffc1dafced..0000000000 --- a/tests/tests/src/gpr_1268.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f_add2(a, b, x, y) { - return add(b(y), a(x)); -} - -function f(a, b, x, y) { - return a(x) + b(y) | 0; -} - -function f1(a, b, x, y) { - return add(a(x), b(y)); -} - -function f2(x) { - console.log(x); -} - -function f3(x) { - console.log(x); -} - -function f4(x, y) { - return add(y, x); -} - -exports.f_add2 = f_add2; -exports.f = f; -exports.f1 = f1; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -/* No side effect */ diff --git a/tests/tests/src/gpr_1268.mjs b/tests/tests/src/gpr_1268.mjs new file mode 100644 index 0000000000..e4148a134a --- /dev/null +++ b/tests/tests/src/gpr_1268.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f_add2(a, b, x, y) { + return add(b(y), a(x)); +} + +function f(a, b, x, y) { + return a(x) + b(y) | 0; +} + +function f1(a, b, x, y) { + return add(a(x), b(y)); +} + +function f2(x) { + console.log(x); +} + +function f3(x) { + console.log(x); +} + +function f4(x, y) { + return add(y, x); +} + +export { + f_add2, + f, + f1, + f2, + f3, + f4, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1409_test.js b/tests/tests/src/gpr_1409_test.js deleted file mode 100644 index dd1dd10a8e..0000000000 --- a/tests/tests/src/gpr_1409_test.js +++ /dev/null @@ -1,175 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let String_set = require("./string_set.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let a = {}; - -let b = { - foo: "42" -}; - -function map(f, x) { - if (x !== undefined) { - return Primitive_option.some(f(Primitive_option.valFromOption(x))); - } - -} - -function make(foo, param) { - let tmp = {}; - let tmp$1 = map(prim => prim.toString(), foo); - if (tmp$1 !== undefined) { - tmp.foo = tmp$1; - } - return tmp; -} - -let a_ = make(undefined, undefined); - -let b_ = make(42, undefined); - -eq("File \"gpr_1409_test.res\", line 31, characters 3-10", b_.foo, "42"); - -console.log(Object.keys(a_)); - -console.log(a, b, a_, b_); - -eq("File \"gpr_1409_test.res\", line 36, characters 3-10", Object.keys(a_).length, 0); - -let test2 = { - hi: 2 -}; - -function test3(_open, xx__hi) { - let tmp = { - hi: 2 - }; - if (_open !== undefined) { - tmp._open = _open; - } - if (xx__hi !== undefined) { - tmp.xx__hi = xx__hi; - } - return tmp; -} - -function test4(_open, xx__hi) { - console.log("no inlin"); - let tmp = { - _open: _open, - hi: 2 - }; - if (xx__hi !== undefined) { - tmp.xx__hi = xx__hi; - } - return tmp; -} - -function test5(f, x) { - console.log("no inline"); - let tmp = { - hi: 2 - }; - let tmp$1 = f(x); - if (tmp$1 !== undefined) { - tmp._open = tmp$1; - } - let tmp$2 = f(x); - if (tmp$2 !== undefined) { - tmp.xx__hi = tmp$2; - } - return tmp; -} - -function test6(f, x) { - console.log("no inline"); - let x$1 = { - contents: 3 - }; - let tmp = { - hi: 2 - }; - let tmp$1 = (x$1.contents = x$1.contents + 1 | 0, x$1.contents); - if (tmp$1 !== undefined) { - tmp._open = tmp$1; - } - let tmp$2 = f(x$1); - if (tmp$2 !== undefined) { - tmp.xx__hi = tmp$2; - } - return tmp; -} - -function keys(xs, ys) { - return String_set.equal(String_set.of_list(xs), String_set.of_list(Belt_List.fromArray(ys))); -} - -eq("File \"gpr_1409_test.res\", line 74, characters 3-10", keys({ - hd: "hi", - tl: /* [] */0 -}, Object.keys(test3(undefined, undefined))), true); - -eq("File \"gpr_1409_test.res\", line 76, characters 3-10", keys({ - hd: "hi", - tl: { - hd: "_open", - tl: /* [] */0 - } -}, Object.keys(test3(2, undefined))), true); - -eq("File \"gpr_1409_test.res\", line 78, characters 3-10", keys({ - hd: "hi", - tl: { - hd: "_open", - tl: { - hd: "xx__hi", - tl: /* [] */0 - } - } -}, Object.keys(test3(2, 2))), true); - -Mt.from_pair_suites("Gpr_1409_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.a = a; -exports.b = b; -exports.map = map; -exports.make = make; -exports.a_ = a_; -exports.b_ = b_; -exports.test2 = test2; -exports.test3 = test3; -exports.test4 = test4; -exports.test5 = test5; -exports.test6 = test6; -exports.keys = keys; -/* a_ Not a pure module */ diff --git a/tests/tests/src/gpr_1409_test.mjs b/tests/tests/src/gpr_1409_test.mjs new file mode 100644 index 0000000000..e98e5287ef --- /dev/null +++ b/tests/tests/src/gpr_1409_test.mjs @@ -0,0 +1,176 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as String_set from "./string_set.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let a = {}; + +let b = { + foo: "42" +}; + +function map(f, x) { + if (x !== undefined) { + return Primitive_option.some(f(Primitive_option.valFromOption(x))); + } + +} + +function make(foo, param) { + let tmp = {}; + let tmp$1 = map(prim => prim.toString(), foo); + if (tmp$1 !== undefined) { + tmp.foo = tmp$1; + } + return tmp; +} + +let a_ = make(undefined, undefined); + +let b_ = make(42, undefined); + +eq("File \"gpr_1409_test.res\", line 31, characters 3-10", b_.foo, "42"); + +console.log(Object.keys(a_)); + +console.log(a, b, a_, b_); + +eq("File \"gpr_1409_test.res\", line 36, characters 3-10", Object.keys(a_).length, 0); + +let test2 = { + hi: 2 +}; + +function test3(_open, xx__hi) { + let tmp = { + hi: 2 + }; + if (_open !== undefined) { + tmp._open = _open; + } + if (xx__hi !== undefined) { + tmp.xx__hi = xx__hi; + } + return tmp; +} + +function test4(_open, xx__hi) { + console.log("no inlin"); + let tmp = { + _open: _open, + hi: 2 + }; + if (xx__hi !== undefined) { + tmp.xx__hi = xx__hi; + } + return tmp; +} + +function test5(f, x) { + console.log("no inline"); + let tmp = { + hi: 2 + }; + let tmp$1 = f(x); + if (tmp$1 !== undefined) { + tmp._open = tmp$1; + } + let tmp$2 = f(x); + if (tmp$2 !== undefined) { + tmp.xx__hi = tmp$2; + } + return tmp; +} + +function test6(f, x) { + console.log("no inline"); + let x$1 = { + contents: 3 + }; + let tmp = { + hi: 2 + }; + let tmp$1 = (x$1.contents = x$1.contents + 1 | 0, x$1.contents); + if (tmp$1 !== undefined) { + tmp._open = tmp$1; + } + let tmp$2 = f(x$1); + if (tmp$2 !== undefined) { + tmp.xx__hi = tmp$2; + } + return tmp; +} + +function keys(xs, ys) { + return String_set.equal(String_set.of_list(xs), String_set.of_list(Belt_List.fromArray(ys))); +} + +eq("File \"gpr_1409_test.res\", line 74, characters 3-10", keys({ + hd: "hi", + tl: /* [] */0 +}, Object.keys(test3(undefined, undefined))), true); + +eq("File \"gpr_1409_test.res\", line 76, characters 3-10", keys({ + hd: "hi", + tl: { + hd: "_open", + tl: /* [] */0 + } +}, Object.keys(test3(2, undefined))), true); + +eq("File \"gpr_1409_test.res\", line 78, characters 3-10", keys({ + hd: "hi", + tl: { + hd: "_open", + tl: { + hd: "xx__hi", + tl: /* [] */0 + } + } +}, Object.keys(test3(2, 2))), true); + +Mt.from_pair_suites("Gpr_1409_test", suites.contents); + +export { + suites, + test_id, + eq, + a, + b, + map, + make, + a_, + b_, + test2, + test3, + test4, + test5, + test6, + keys, +} +/* a_ Not a pure module */ diff --git a/tests/tests/src/gpr_1423_app_test.js b/tests/tests/src/gpr_1423_app_test.js deleted file mode 100644 index ab493e1656..0000000000 --- a/tests/tests/src/gpr_1423_app_test.js +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Gpr_1423_nav = require("./gpr_1423_nav.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function foo(f) { - console.log(f("a1", undefined)); -} - -foo((none, extra) => Gpr_1423_nav.busted(none, "a2", extra)); - -function foo2(f) { - return f("a1", undefined); -} - -eq("File \"gpr_1423_app_test.res\", line 18, characters 12-19", Gpr_1423_nav.busted("a1", "a2", undefined), "a1a2"); - -Mt.from_pair_suites("Gpr_1423_app_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.foo = foo; -exports.foo2 = foo2; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1423_app_test.mjs b/tests/tests/src/gpr_1423_app_test.mjs new file mode 100644 index 0000000000..6974c66297 --- /dev/null +++ b/tests/tests/src/gpr_1423_app_test.mjs @@ -0,0 +1,50 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Gpr_1423_nav from "./gpr_1423_nav.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function foo(f) { + console.log(f("a1", undefined)); +} + +foo((none, extra) => Gpr_1423_nav.busted(none, "a2", extra)); + +function foo2(f) { + return f("a1", undefined); +} + +eq("File \"gpr_1423_app_test.res\", line 18, characters 12-19", Gpr_1423_nav.busted("a1", "a2", undefined), "a1a2"); + +Mt.from_pair_suites("Gpr_1423_app_test", suites.contents); + +export { + suites, + test_id, + eq, + foo, + foo2, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1423_nav.js b/tests/tests/src/gpr_1423_nav.js deleted file mode 100644 index 0116b45024..0000000000 --- a/tests/tests/src/gpr_1423_nav.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function busted(a1, a2, param) { - return a1 + a2; -} - -exports.busted = busted; -/* No side effect */ diff --git a/tests/tests/src/gpr_1423_nav.mjs b/tests/tests/src/gpr_1423_nav.mjs new file mode 100644 index 0000000000..69c9a7968b --- /dev/null +++ b/tests/tests/src/gpr_1423_nav.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function busted(a1, a2, param) { + return a1 + a2; +} + +export { + busted, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1438.js b/tests/tests/src/gpr_1438.js deleted file mode 100644 index 8f89b09dfb..0000000000 --- a/tests/tests/src/gpr_1438.js +++ /dev/null @@ -1,23 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function actionKey(key, a, b, c, d, e) { - switch (key) { - case 98 : - return c; - case 106 : - return d; - case 107 : - return e; - case 116 : - return b; - case 99 : - case 118 : - return a; - } - return param => {}; -} - -exports.actionKey = actionKey; -/* No side effect */ diff --git a/tests/tests/src/gpr_1438.mjs b/tests/tests/src/gpr_1438.mjs new file mode 100644 index 0000000000..854af721e5 --- /dev/null +++ b/tests/tests/src/gpr_1438.mjs @@ -0,0 +1,24 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function actionKey(key, a, b, c, d, e) { + switch (key) { + case 98 : + return c; + case 106 : + return d; + case 107 : + return e; + case 116 : + return b; + case 99 : + case 118 : + return a; + } + return param => {}; +} + +export { + actionKey, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1481.js b/tests/tests/src/gpr_1481.js deleted file mode 100644 index 71d2813dd7..0000000000 --- a/tests/tests/src/gpr_1481.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Moduleid = require("#moduleid"); - -function f() { - return Moduleid.name; -} - -exports.f = f; -/* #moduleid Not a pure module */ diff --git a/tests/tests/src/gpr_1481.mjs b/tests/tests/src/gpr_1481.mjs new file mode 100644 index 0000000000..efd39acc3e --- /dev/null +++ b/tests/tests/src/gpr_1481.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Moduleid from "#moduleid"; + +function f() { + return Moduleid.name; +} + +export { + f, +} +/* #moduleid Not a pure module */ diff --git a/tests/tests/src/gpr_1484.js b/tests/tests/src/gpr_1484.js deleted file mode 100644 index 5e8a8743ba..0000000000 --- a/tests/tests/src/gpr_1484.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function test(x) { - x.nodeValue = null; -} - -exports.test = test; -/* No side effect */ diff --git a/tests/tests/src/gpr_1484.mjs b/tests/tests/src/gpr_1484.mjs new file mode 100644 index 0000000000..f2dda9b552 --- /dev/null +++ b/tests/tests/src/gpr_1484.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function test(x) { + x.nodeValue = null; +} + +export { + test, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1539_test.js b/tests/tests/src/gpr_1539_test.js deleted file mode 100644 index df9b081966..0000000000 --- a/tests/tests/src/gpr_1539_test.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_module = require("rescript/lib/js/Primitive_module.js"); - -let Point = Primitive_module.init([ - "gpr_1539_test.res", - 11, - 4 -], { - TAG: "Module", - _0: [[ - "Function", - "add" - ]] -}); - -Primitive_module.update({ - TAG: "Module", - _0: [[ - "Function", - "add" - ]] -}, Point, { - add: (prim0, prim1) => prim0.add(prim1) -}); - -let CRS; - -let Layer; - -exports.CRS = CRS; -exports.Layer = Layer; -exports.Point = Point; -/* Point Not a pure module */ diff --git a/tests/tests/src/gpr_1539_test.mjs b/tests/tests/src/gpr_1539_test.mjs new file mode 100644 index 0000000000..10564256b7 --- /dev/null +++ b/tests/tests/src/gpr_1539_test.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_module from "rescript/lib/es6/Primitive_module.js"; + +let Point = Primitive_module.init([ + "gpr_1539_test.res", + 11, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "add" + ]] +}); + +Primitive_module.update({ + TAG: "Module", + _0: [[ + "Function", + "add" + ]] +}, Point, { + add: (prim0, prim1) => prim0.add(prim1) +}); + +let CRS; + +let Layer; + +export { + CRS, + Layer, + Point, +} +/* Point Not a pure module */ diff --git a/tests/tests/src/gpr_1658_test.js b/tests/tests/src/gpr_1658_test.js deleted file mode 100644 index bee607284c..0000000000 --- a/tests/tests/src/gpr_1658_test.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_types = require("rescript/lib/js/Js_types.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"gpr_1658_test.res\", line 13, characters 5-12", null, null); - -let match = Js_types.classify(null); - -if (typeof match !== "object" && match === "JSNull") { - eq("File \"gpr_1658_test.res\", line 15, characters 17-24", true, true); -} else { - eq("File \"gpr_1658_test.res\", line 16, characters 12-19", true, false); -} - -eq("File \"gpr_1658_test.res\", line 18, characters 5-12", true, Js_types.test(null, "Null")); - -Mt.from_pair_suites("File \"gpr_1658_test.res\", line 21, characters 20-27", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1658_test.mjs b/tests/tests/src/gpr_1658_test.mjs new file mode 100644 index 0000000000..78a878d8f0 --- /dev/null +++ b/tests/tests/src/gpr_1658_test.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_types from "rescript/lib/es6/Js_types.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"gpr_1658_test.res\", line 13, characters 5-12", null, null); + +let match = Js_types.classify(null); + +if (typeof match !== "object" && match === "JSNull") { + eq("File \"gpr_1658_test.res\", line 15, characters 17-24", true, true); +} else { + eq("File \"gpr_1658_test.res\", line 16, characters 12-19", true, false); +} + +eq("File \"gpr_1658_test.res\", line 18, characters 5-12", true, Js_types.test(null, "Null")); + +Mt.from_pair_suites("File \"gpr_1658_test.res\", line 21, characters 20-27", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1667_test.js b/tests/tests/src/gpr_1667_test.js deleted file mode 100644 index 71234de8d6..0000000000 --- a/tests/tests/src/gpr_1667_test.js +++ /dev/null @@ -1,36 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"gpr_1667_test.res\", line 28, characters 5-12", 0, 0); - -Mt.from_pair_suites("Gpr_1667_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1667_test.mjs b/tests/tests/src/gpr_1667_test.mjs new file mode 100644 index 0000000000..fdc82775d0 --- /dev/null +++ b/tests/tests/src/gpr_1667_test.mjs @@ -0,0 +1,37 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"gpr_1667_test.res\", line 28, characters 5-12", 0, 0); + +Mt.from_pair_suites("Gpr_1667_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1692_test.js b/tests/tests/src/gpr_1692_test.js deleted file mode 100644 index 7c0694ed44..0000000000 --- a/tests/tests/src/gpr_1692_test.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -(f => 0)(""); - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1692_test.mjs b/tests/tests/src/gpr_1692_test.mjs new file mode 100644 index 0000000000..3863ef51b9 --- /dev/null +++ b/tests/tests/src/gpr_1692_test.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +(f => 0)(""); + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1698_test.js b/tests/tests/src/gpr_1698_test.js deleted file mode 100644 index a85cfeee77..0000000000 --- a/tests/tests/src/gpr_1698_test.js +++ /dev/null @@ -1,216 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function is_number(_expr) { - while (true) { - let expr = _expr; - switch (expr.TAG) { - case "Val" : - if (expr._0.TAG === "Natural") { - return true; - } else { - return false; - } - case "Neg" : - _expr = expr._0; - continue; - case "Sum" : - case "Pow" : - case "Frac" : - case "Gcd" : - return false; - } - }; -} - -function compare(context, state, _a, _b) { - while (true) { - let b = _b; - let a = _a; - let exit = 0; - let na; - let da; - let nb; - let db; - let exit$1 = 0; - let exit$2 = 0; - let exit$3 = 0; - switch (a.TAG) { - case "Val" : - switch (b.TAG) { - case "Val" : - return 111; - case "Neg" : - exit$3 = 5; - break; - case "Sum" : - exit$2 = 4; - break; - case "Frac" : - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1698_test.res", - 41, - 9 - ], - Error: new Error() - }; - case "Pow" : - case "Gcd" : - exit = 1; - break; - } - break; - case "Neg" : - _a = a._0; - continue; - case "Sum" : - case "Pow" : - exit$3 = 5; - break; - case "Frac" : - switch (b.TAG) { - case "Val" : - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_1698_test.res", - 41, - 9 - ], - Error: new Error() - }; - case "Neg" : - exit$3 = 5; - break; - case "Sum" : - exit$2 = 4; - break; - case "Frac" : - na = a._0; - da = a._1; - nb = b._0; - db = b._1; - exit = 2; - break; - case "Pow" : - case "Gcd" : - exit = 1; - break; - } - break; - case "Gcd" : - switch (b.TAG) { - case "Neg" : - exit$3 = 5; - break; - case "Sum" : - exit$2 = 4; - break; - case "Gcd" : - na = a._0; - da = a._1; - nb = b._0; - db = b._1; - exit = 2; - break; - default: - exit$1 = 3; - } - break; - } - if (exit$3 === 5) { - if (b.TAG === "Neg") { - _b = b._0; - continue; - } - if (a.TAG === "Sum") { - if (is_number(b)) { - return 1; - } - exit$2 = 4; - } else { - exit$2 = 4; - } - } - if (exit$2 === 4) { - if (b.TAG === "Sum") { - if (is_number(a)) { - return -1; - } - exit$1 = 3; - } else { - exit$1 = 3; - } - } - if (exit$1 === 3) { - switch (a.TAG) { - case "Sum" : - exit = 1; - break; - case "Pow" : - return -1; - case "Val" : - case "Frac" : - case "Gcd" : - return 1; - } - } - switch (exit) { - case 1 : - switch (b.TAG) { - case "Pow" : - return 1; - default: - return -1; - } - case 2 : - let denom = compare(context, state, da, db); - if (denom !== 0) { - return denom; - } - _b = nb; - _a = na; - continue; - } - }; -} - -let a = { - TAG: "Sum", - _0: { - hd: { - TAG: "Val", - _0: { - TAG: "Symbol", - _0: "a" - } - }, - tl: { - hd: { - TAG: "Val", - _0: { - TAG: "Natural", - _0: 2 - } - }, - tl: /* [] */0 - } - } -}; - -let b = { - TAG: "Val", - _0: { - TAG: "Symbol", - _0: "x" - } -}; - -console.log(compare("InSum", { - complex: true -}, a, b)); - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1698_test.mjs b/tests/tests/src/gpr_1698_test.mjs new file mode 100644 index 0000000000..947fa0a4f2 --- /dev/null +++ b/tests/tests/src/gpr_1698_test.mjs @@ -0,0 +1,215 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function is_number(_expr) { + while (true) { + let expr = _expr; + switch (expr.TAG) { + case "Val" : + if (expr._0.TAG === "Natural") { + return true; + } else { + return false; + } + case "Neg" : + _expr = expr._0; + continue; + case "Sum" : + case "Pow" : + case "Frac" : + case "Gcd" : + return false; + } + }; +} + +function compare(context, state, _a, _b) { + while (true) { + let b = _b; + let a = _a; + let exit = 0; + let na; + let da; + let nb; + let db; + let exit$1 = 0; + let exit$2 = 0; + let exit$3 = 0; + switch (a.TAG) { + case "Val" : + switch (b.TAG) { + case "Val" : + return 111; + case "Neg" : + exit$3 = 5; + break; + case "Sum" : + exit$2 = 4; + break; + case "Frac" : + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ], + Error: new Error() + }; + case "Pow" : + case "Gcd" : + exit = 1; + break; + } + break; + case "Neg" : + _a = a._0; + continue; + case "Sum" : + case "Pow" : + exit$3 = 5; + break; + case "Frac" : + switch (b.TAG) { + case "Val" : + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_1698_test.res", + 41, + 9 + ], + Error: new Error() + }; + case "Neg" : + exit$3 = 5; + break; + case "Sum" : + exit$2 = 4; + break; + case "Frac" : + na = a._0; + da = a._1; + nb = b._0; + db = b._1; + exit = 2; + break; + case "Pow" : + case "Gcd" : + exit = 1; + break; + } + break; + case "Gcd" : + switch (b.TAG) { + case "Neg" : + exit$3 = 5; + break; + case "Sum" : + exit$2 = 4; + break; + case "Gcd" : + na = a._0; + da = a._1; + nb = b._0; + db = b._1; + exit = 2; + break; + default: + exit$1 = 3; + } + break; + } + if (exit$3 === 5) { + if (b.TAG === "Neg") { + _b = b._0; + continue; + } + if (a.TAG === "Sum") { + if (is_number(b)) { + return 1; + } + exit$2 = 4; + } else { + exit$2 = 4; + } + } + if (exit$2 === 4) { + if (b.TAG === "Sum") { + if (is_number(a)) { + return -1; + } + exit$1 = 3; + } else { + exit$1 = 3; + } + } + if (exit$1 === 3) { + switch (a.TAG) { + case "Sum" : + exit = 1; + break; + case "Pow" : + return -1; + case "Val" : + case "Frac" : + case "Gcd" : + return 1; + } + } + switch (exit) { + case 1 : + switch (b.TAG) { + case "Pow" : + return 1; + default: + return -1; + } + case 2 : + let denom = compare(context, state, da, db); + if (denom !== 0) { + return denom; + } + _b = nb; + _a = na; + continue; + } + }; +} + +let a = { + TAG: "Sum", + _0: { + hd: { + TAG: "Val", + _0: { + TAG: "Symbol", + _0: "a" + } + }, + tl: { + hd: { + TAG: "Val", + _0: { + TAG: "Natural", + _0: 2 + } + }, + tl: /* [] */0 + } + } +}; + +let b = { + TAG: "Val", + _0: { + TAG: "Symbol", + _0: "x" + } +}; + +console.log(compare("InSum", { + complex: true +}, a, b)); + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1701_test.js b/tests/tests/src/gpr_1701_test.js deleted file mode 100644 index 57622db869..0000000000 --- a/tests/tests/src/gpr_1701_test.js +++ /dev/null @@ -1,110 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let Foo = /* @__PURE__ */Primitive_exceptions.create("Gpr_1701_test.Foo"); - -function test(n) { - if (n === 0) { - throw { - RE_EXN_ID: Foo, - Error: new Error() - }; - } - try { - return test(n - 1 | 0); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === Foo) { - return; - } - throw exn; - } -} - -test(100); - -function read_lines(inc) { - let _acc = /* [] */0; - while (true) { - let acc = _acc; - let l; - try { - l = input_line(inc); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "End_of_file") { - l = undefined; - } else { - throw exn; - } - } - if (l === undefined) { - return Belt_List.reverse(acc); - } - _acc = { - hd: l, - tl: acc - }; - continue; - }; -} - -function read_lines2(inc) { - let _acc = /* [] */0; - while (true) { - let acc = _acc; - let l; - try { - l = input_line(inc); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "End_of_file") { - return Belt_List.reverse(acc); - } - throw exn; - } - _acc = { - hd: l, - tl: acc - }; - continue; - }; -} - -function read_lines3(inc) { - let loop = acc => { - try { - let l = input_line(inc); - return loop({ - hd: l, - tl: acc - }); - } catch (raw_exn) { - let exn = Primitive_exceptions.internalToException(raw_exn); - if (exn.RE_EXN_ID === "End_of_file") { - return Belt_List.reverse(acc); - } - throw exn; - } - }; - return loop(/* [] */0); -} - -function fff(f, x) { - try { - return fff(f, x); - } catch (exn) { - return x + 1 | 0; - } -} - -exports.Foo = Foo; -exports.test = test; -exports.read_lines = read_lines; -exports.read_lines2 = read_lines2; -exports.read_lines3 = read_lines3; -exports.fff = fff; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1701_test.mjs b/tests/tests/src/gpr_1701_test.mjs new file mode 100644 index 0000000000..8a0f18cd3a --- /dev/null +++ b/tests/tests/src/gpr_1701_test.mjs @@ -0,0 +1,111 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let Foo = /* @__PURE__ */Primitive_exceptions.create("Gpr_1701_test.Foo"); + +function test(n) { + if (n === 0) { + throw { + RE_EXN_ID: Foo, + Error: new Error() + }; + } + try { + return test(n - 1 | 0); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === Foo) { + return; + } + throw exn; + } +} + +test(100); + +function read_lines(inc) { + let _acc = /* [] */0; + while (true) { + let acc = _acc; + let l; + try { + l = input_line(inc); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "End_of_file") { + l = undefined; + } else { + throw exn; + } + } + if (l === undefined) { + return Belt_List.reverse(acc); + } + _acc = { + hd: l, + tl: acc + }; + continue; + }; +} + +function read_lines2(inc) { + let _acc = /* [] */0; + while (true) { + let acc = _acc; + let l; + try { + l = input_line(inc); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "End_of_file") { + return Belt_List.reverse(acc); + } + throw exn; + } + _acc = { + hd: l, + tl: acc + }; + continue; + }; +} + +function read_lines3(inc) { + let loop = acc => { + try { + let l = input_line(inc); + return loop({ + hd: l, + tl: acc + }); + } catch (raw_exn) { + let exn = Primitive_exceptions.internalToException(raw_exn); + if (exn.RE_EXN_ID === "End_of_file") { + return Belt_List.reverse(acc); + } + throw exn; + } + }; + return loop(/* [] */0); +} + +function fff(f, x) { + try { + return fff(f, x); + } catch (exn) { + return x + 1 | 0; + } +} + +export { + Foo, + test, + read_lines, + read_lines2, + read_lines3, + fff, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1716_test.js b/tests/tests/src/gpr_1716_test.js deleted file mode 100644 index 76b85865c4..0000000000 --- a/tests/tests/src/gpr_1716_test.js +++ /dev/null @@ -1,56 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let a = {}; - -let b = {}; - -Primitive_object.updateDummy(a, { - b: b -}); - -Primitive_object.updateDummy(b, { - a: a -}); - -function is_inifite(x) { - return x.b.a === x; -} - -eq("File \"gpr_1716_test.res\", line 19, characters 3-10", true, is_inifite(a)); - -Mt.from_pair_suites("Gpr_1716_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.a = a; -exports.b = b; -exports.is_inifite = is_inifite; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1716_test.mjs b/tests/tests/src/gpr_1716_test.mjs new file mode 100644 index 0000000000..736d033164 --- /dev/null +++ b/tests/tests/src/gpr_1716_test.mjs @@ -0,0 +1,57 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let a = {}; + +let b = {}; + +Primitive_object.updateDummy(a, { + b: b +}); + +Primitive_object.updateDummy(b, { + a: a +}); + +function is_inifite(x) { + return x.b.a === x; +} + +eq("File \"gpr_1716_test.res\", line 19, characters 3-10", true, is_inifite(a)); + +Mt.from_pair_suites("Gpr_1716_test", suites.contents); + +export { + suites, + test_id, + eq, + a, + b, + is_inifite, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1717_test.js b/tests/tests/src/gpr_1717_test.js deleted file mode 100644 index f1543fa85f..0000000000 --- a/tests/tests/src/gpr_1717_test.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let A = {}; - -let A0 = {}; - -let A1 = {}; - -exports.A = A; -exports.A0 = A0; -exports.A1 = A1; -/* No side effect */ diff --git a/tests/tests/src/gpr_1717_test.mjs b/tests/tests/src/gpr_1717_test.mjs new file mode 100644 index 0000000000..a3c3f5cab5 --- /dev/null +++ b/tests/tests/src/gpr_1717_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let A = {}; + +let A0 = {}; + +let A1 = {}; + +export { + A, + A0, + A1, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1728_test.js b/tests/tests/src/gpr_1728_test.js deleted file mode 100644 index 629b951788..0000000000 --- a/tests/tests/src/gpr_1728_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function foo(x) { - return Number.parseInt(x) !== 3; -} - -function badInlining(obj) { - let x = obj.field; - Number.parseInt(x) !== 3; -} - -eq("File \"gpr_1728_test.res\", line 21, characters 3-10", badInlining({ - field: "3" -}), undefined); - -eq("File \"gpr_1728_test.res\", line 23, characters 3-10", Number.parseInt("-13"), -13); - -eq("File \"gpr_1728_test.res\", line 24, characters 3-10", Number.parseInt("+13"), 13); - -eq("File \"gpr_1728_test.res\", line 25, characters 3-10", Number.parseInt("13"), 13); - -eq("File \"gpr_1728_test.res\", line 26, characters 3-10", Number.parseInt("+0x32"), 50); - -eq("File \"gpr_1728_test.res\", line 27, characters 3-10", Number.parseInt("-0x32"), -50); - -eq("File \"gpr_1728_test.res\", line 28, characters 3-10", Number.parseInt("0x32"), 50); - -Mt.from_pair_suites("Gpr_1728_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.foo = foo; -exports.badInlining = badInlining; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1728_test.mjs b/tests/tests/src/gpr_1728_test.mjs new file mode 100644 index 0000000000..d06df97cef --- /dev/null +++ b/tests/tests/src/gpr_1728_test.mjs @@ -0,0 +1,62 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function foo(x) { + return Number.parseInt(x) !== 3; +} + +function badInlining(obj) { + let x = obj.field; + Number.parseInt(x) !== 3; +} + +eq("File \"gpr_1728_test.res\", line 21, characters 3-10", badInlining({ + field: "3" +}), undefined); + +eq("File \"gpr_1728_test.res\", line 23, characters 3-10", Number.parseInt("-13"), -13); + +eq("File \"gpr_1728_test.res\", line 24, characters 3-10", Number.parseInt("+13"), 13); + +eq("File \"gpr_1728_test.res\", line 25, characters 3-10", Number.parseInt("13"), 13); + +eq("File \"gpr_1728_test.res\", line 26, characters 3-10", Number.parseInt("+0x32"), 50); + +eq("File \"gpr_1728_test.res\", line 27, characters 3-10", Number.parseInt("-0x32"), -50); + +eq("File \"gpr_1728_test.res\", line 28, characters 3-10", Number.parseInt("0x32"), 50); + +Mt.from_pair_suites("Gpr_1728_test", suites.contents); + +export { + suites, + test_id, + eq, + foo, + badInlining, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1749_test.js b/tests/tests/src/gpr_1749_test.js deleted file mode 100644 index 72fc1b73ba..0000000000 --- a/tests/tests/src/gpr_1749_test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -eq("File \"gpr_1749_test.res\", line 18, characters 3-10", 0, 0); - -Mt.from_pair_suites("Gpr_1749_test", suites.contents); - -let a = 0; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.a = a; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1749_test.mjs b/tests/tests/src/gpr_1749_test.mjs new file mode 100644 index 0000000000..84539b9ad7 --- /dev/null +++ b/tests/tests/src/gpr_1749_test.mjs @@ -0,0 +1,40 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +eq("File \"gpr_1749_test.res\", line 18, characters 3-10", 0, 0); + +Mt.from_pair_suites("Gpr_1749_test", suites.contents); + +let a = 0; + +export { + suites, + test_id, + eq, + a, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1759_test.js b/tests/tests/src/gpr_1759_test.mjs similarity index 100% rename from tests/tests/src/gpr_1759_test.js rename to tests/tests/src/gpr_1759_test.mjs diff --git a/tests/tests/src/gpr_1760_test.js b/tests/tests/src/gpr_1760_test.js deleted file mode 100644 index 7338f82e64..0000000000 --- a/tests/tests/src/gpr_1760_test.js +++ /dev/null @@ -1,63 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let a0; - -try { - Primitive_int.div(0, 0); - a0 = 0; -} catch (exn) { - a0 = 1; -} - -let a1; - -try { - Primitive_int.mod_(0, 0); - a1 = 0; -} catch (exn$1) { - a1 = 1; -} - -eq("File \"gpr_1760_test.res\", line 26, characters 3-10", [ - a0, - a1 -], [ - 1, - 1 -]); - -Mt.from_pair_suites("Gpr_1760_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.a0 = a0; -exports.a1 = a1; -/* a0 Not a pure module */ diff --git a/tests/tests/src/gpr_1760_test.mjs b/tests/tests/src/gpr_1760_test.mjs new file mode 100644 index 0000000000..37d83370f7 --- /dev/null +++ b/tests/tests/src/gpr_1760_test.mjs @@ -0,0 +1,64 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let a0; + +try { + Primitive_int.div(0, 0); + a0 = 0; +} catch (exn) { + a0 = 1; +} + +let a1; + +try { + Primitive_int.mod_(0, 0); + a1 = 0; +} catch (exn$1) { + a1 = 1; +} + +eq("File \"gpr_1760_test.res\", line 26, characters 3-10", [ + a0, + a1 +], [ + 1, + 1 +]); + +Mt.from_pair_suites("Gpr_1760_test", suites.contents); + +export { + suites, + test_id, + eq, + a0, + a1, +} +/* a0 Not a pure module */ diff --git a/tests/tests/src/gpr_1762_test.js b/tests/tests/src/gpr_1762_test.js deleted file mode 100644 index b17bbc3718..0000000000 --- a/tests/tests/src/gpr_1762_test.js +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let v = { - contents: 3 -}; - -function update() { - v.contents = v.contents + 1 | 0; - return true; -} - -v.contents = v.contents + 1 | 0; - -eq("File \"gpr_1762_test.res\", line 27, characters 3-10", v.contents, 4); - -Mt.from_pair_suites("Gpr_1762_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.update = update; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_1762_test.mjs b/tests/tests/src/gpr_1762_test.mjs new file mode 100644 index 0000000000..23ea3ade99 --- /dev/null +++ b/tests/tests/src/gpr_1762_test.mjs @@ -0,0 +1,50 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let v = { + contents: 3 +}; + +function update() { + v.contents = v.contents + 1 | 0; + return true; +} + +v.contents = v.contents + 1 | 0; + +eq("File \"gpr_1762_test.res\", line 27, characters 3-10", v.contents, 4); + +Mt.from_pair_suites("Gpr_1762_test", suites.contents); + +export { + suites, + test_id, + eq, + v, + update, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_1817_test.js b/tests/tests/src/gpr_1817_test.js deleted file mode 100644 index 44fc6903c2..0000000000 --- a/tests/tests/src/gpr_1817_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f() { - let x = new Date(); - let y = new Date(); - return [ - Primitive_object.greaterthan(y, x), - Primitive_object.lessthan(y, x), - true - ]; -} - -let match = f(); - -let a2 = match[2]; - -let a1 = match[1]; - -let a0 = match[0]; - -console.log(a0, a1); - -eq("File \"gpr_1817_test.res\", line 23, characters 3-10", a2, true); - -Mt.from_pair_suites("Gpr_1817_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.a0 = a0; -exports.a1 = a1; -exports.a2 = a2; -/* match Not a pure module */ diff --git a/tests/tests/src/gpr_1817_test.mjs b/tests/tests/src/gpr_1817_test.mjs new file mode 100644 index 0000000000..44b33b3797 --- /dev/null +++ b/tests/tests/src/gpr_1817_test.mjs @@ -0,0 +1,62 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f() { + let x = new Date(); + let y = new Date(); + return [ + Primitive_object.greaterthan(y, x), + Primitive_object.lessthan(y, x), + true + ]; +} + +let match = f(); + +let a2 = match[2]; + +let a1 = match[1]; + +let a0 = match[0]; + +console.log(a0, a1); + +eq("File \"gpr_1817_test.res\", line 23, characters 3-10", a2, true); + +Mt.from_pair_suites("Gpr_1817_test", suites.contents); + +export { + suites, + test_id, + eq, + f, + a0, + a1, + a2, +} +/* match Not a pure module */ diff --git a/tests/tests/src/gpr_1822_test.js b/tests/tests/src/gpr_1822_test.js deleted file mode 100644 index 71b86d9e3f..0000000000 --- a/tests/tests/src/gpr_1822_test.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let myShape = { - TAG: "Circle", - _0: 10 -}; - -let area; - -area = myShape.TAG === "Circle" ? 100 * 3.14 : Math.imul(10, myShape._1); - -eq("File \"gpr_1822_test.res\", line 23, characters 3-10", area, 314); - -Mt.from_pair_suites("Gpr_1822_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.myShape = myShape; -exports.area = area; -/* area Not a pure module */ diff --git a/tests/tests/src/gpr_1822_test.mjs b/tests/tests/src/gpr_1822_test.mjs new file mode 100644 index 0000000000..9706a4d490 --- /dev/null +++ b/tests/tests/src/gpr_1822_test.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let myShape = { + TAG: "Circle", + _0: 10 +}; + +let area; + +area = myShape.TAG === "Circle" ? 100 * 3.14 : Math.imul(10, myShape._1); + +eq("File \"gpr_1822_test.res\", line 23, characters 3-10", area, 314); + +Mt.from_pair_suites("Gpr_1822_test", suites.contents); + +export { + suites, + test_id, + eq, + myShape, + area, +} +/* area Not a pure module */ diff --git a/tests/tests/src/gpr_1891_test.js b/tests/tests/src/gpr_1891_test.js deleted file mode 100644 index 0be949d234..0000000000 --- a/tests/tests/src/gpr_1891_test.js +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function foo(x) { - if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - console.log("1"); - } else { - console.log("2"); - } -} - -function foo2(x) { - if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - return "xxxx"; - } else { - return "xxx"; - } -} - -function foo3(x) { - if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - return 1; - } else { - return 2; - } -} - -function foo4(x, h) { - if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - return h(); - } - -} - -function foo5(x) { - if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { - console.log("hi"); - } else { - console.log("x"); - } -} - -exports.foo = foo; -exports.foo2 = foo2; -exports.foo3 = foo3; -exports.foo4 = foo4; -exports.foo5 = foo5; -/* No side effect */ diff --git a/tests/tests/src/gpr_1891_test.mjs b/tests/tests/src/gpr_1891_test.mjs new file mode 100644 index 0000000000..7896f4d914 --- /dev/null +++ b/tests/tests/src/gpr_1891_test.mjs @@ -0,0 +1,50 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function foo(x) { + if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { + console.log("1"); + } else { + console.log("2"); + } +} + +function foo2(x) { + if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { + return "xxxx"; + } else { + return "xxx"; + } +} + +function foo3(x) { + if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { + return 1; + } else { + return 2; + } +} + +function foo4(x, h) { + if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { + return h(); + } + +} + +function foo5(x) { + if (typeof x === "object" && x.NAME === "Foo" && x.VAL === 3) { + console.log("hi"); + } else { + console.log("x"); + } +} + +export { + foo, + foo2, + foo3, + foo4, + foo5, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_1943_test.js b/tests/tests/src/gpr_1943_test.js deleted file mode 100644 index a49712564e..0000000000 --- a/tests/tests/src/gpr_1943_test.js +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f(x) { - return [ - x._003, - x._50, - x._50x, - x.__50, - x.__50x, - x["_50x'"], - x["x'"] - ]; -} - -let v = f({ - _003: 0, - _50: 1, - _50x: 2, - __50: 3, - __50x: 4, - "_50x'": 5, - "x'": 6 -}); - -eq("File \"gpr_1943_test.res\", line 26, characters 3-10", [ - 0, - 1, - 2, - 3, - 4, - 5, - 6 -], v); - -Mt.from_pair_suites("Gpr_1943_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.v = v; -/* v Not a pure module */ diff --git a/tests/tests/src/gpr_1943_test.mjs b/tests/tests/src/gpr_1943_test.mjs new file mode 100644 index 0000000000..2b4d0fbaf7 --- /dev/null +++ b/tests/tests/src/gpr_1943_test.mjs @@ -0,0 +1,69 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f(x) { + return [ + x._003, + x._50, + x._50x, + x.__50, + x.__50x, + x["_50x'"], + x["x'"] + ]; +} + +let v = f({ + _003: 0, + _50: 1, + _50x: 2, + __50: 3, + __50x: 4, + "_50x'": 5, + "x'": 6 +}); + +eq("File \"gpr_1943_test.res\", line 26, characters 3-10", [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 +], v); + +Mt.from_pair_suites("Gpr_1943_test", suites.contents); + +export { + suites, + test_id, + eq, + f, + v, +} +/* v Not a pure module */ diff --git a/tests/tests/src/gpr_1946_test.js b/tests/tests/src/gpr_1946_test.js deleted file mode 100644 index f57d17a937..0000000000 --- a/tests/tests/src/gpr_1946_test.js +++ /dev/null @@ -1,64 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let x = ({ - x: 3, - y: 4 -}).x; - -let zz = ({ - _5: 3 -})._5; - -let h = { - "0123": 2, - "123_456": 3 -}; - -function f(id) { - while (false) { - - }; - return id; -} - -eq("File \"gpr_1946_test.res\", line 24, characters 3-10", ({ - _5: 3 -})._5, 3); - -eq("File \"gpr_1946_test.res\", line 25, characters 3-10", [ - 2, - 3 -], [ - f(h)["0123"], - f(h)["123_456"] -]); - -console.log(({ - _5: 3 - }).TAG); - -Mt.from_pair_suites("File \"gpr_1946_test.res\", line 28, characters 20-27", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.x = x; -exports.zz = zz; -exports.h = h; -exports.f = f; -/* x Not a pure module */ diff --git a/tests/tests/src/gpr_1946_test.mjs b/tests/tests/src/gpr_1946_test.mjs new file mode 100644 index 0000000000..22c9c267a8 --- /dev/null +++ b/tests/tests/src/gpr_1946_test.mjs @@ -0,0 +1,65 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let x = ({ + x: 3, + y: 4 +}).x; + +let zz = ({ + _5: 3 +})._5; + +let h = { + "0123": 2, + "123_456": 3 +}; + +function f(id) { + while (false) { + + }; + return id; +} + +eq("File \"gpr_1946_test.res\", line 24, characters 3-10", ({ + _5: 3 +})._5, 3); + +eq("File \"gpr_1946_test.res\", line 25, characters 3-10", [ + 2, + 3 +], [ + f(h)["0123"], + f(h)["123_456"] +]); + +console.log(({ + _5: 3 + }).TAG); + +Mt.from_pair_suites("File \"gpr_1946_test.res\", line 28, characters 20-27", suites.contents); + +export { + suites, + test_id, + eq, + x, + zz, + h, + f, +} +/* x Not a pure module */ diff --git a/tests/tests/src/gpr_2316_test.js b/tests/tests/src/gpr_2316_test.js deleted file mode 100644 index a0bc150bb7..0000000000 --- a/tests/tests/src/gpr_2316_test.js +++ /dev/null @@ -1,79 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let y; - -try { - Pervasives.failwith("boo"); - y = undefined; -} catch (raw_msg) { - let msg = Primitive_exceptions.internalToException(raw_msg); - if (msg.RE_EXN_ID === "Failure") { - y = msg._1; - } else { - throw msg; - } -} - -let x; - -let exit = 0; - -let e; - -try { - e = Pervasives.failwith("boo"); - exit = 1; -} catch (raw_msg$1) { - let msg$1 = Primitive_exceptions.internalToException(raw_msg$1); - if (msg$1.RE_EXN_ID === "Failure") { - x = msg$1._1; - } else { - throw msg$1; - } -} - -if (exit === 1) { - console.log("ok"); - x = undefined; -} - -eq("File \"gpr_2316_test.res\", line 25, characters 5-12", y, "boo"); - -eq("File \"gpr_2316_test.res\", line 26, characters 5-12", x, "boo"); - -Mt.from_pair_suites("Gpr_2316_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.y = y; -exports.x = x; -/* y Not a pure module */ diff --git a/tests/tests/src/gpr_2316_test.mjs b/tests/tests/src/gpr_2316_test.mjs new file mode 100644 index 0000000000..6041bebb16 --- /dev/null +++ b/tests/tests/src/gpr_2316_test.mjs @@ -0,0 +1,80 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let y; + +try { + Pervasives.failwith("boo"); + y = undefined; +} catch (raw_msg) { + let msg = Primitive_exceptions.internalToException(raw_msg); + if (msg.RE_EXN_ID === "Failure") { + y = msg._1; + } else { + throw msg; + } +} + +let x; + +let exit = 0; + +let e; + +try { + e = Pervasives.failwith("boo"); + exit = 1; +} catch (raw_msg$1) { + let msg$1 = Primitive_exceptions.internalToException(raw_msg$1); + if (msg$1.RE_EXN_ID === "Failure") { + x = msg$1._1; + } else { + throw msg$1; + } +} + +if (exit === 1) { + console.log("ok"); + x = undefined; +} + +eq("File \"gpr_2316_test.res\", line 25, characters 5-12", y, "boo"); + +eq("File \"gpr_2316_test.res\", line 26, characters 5-12", x, "boo"); + +Mt.from_pair_suites("Gpr_2316_test", suites.contents); + +export { + suites, + test_id, + eq, + y, + x, +} +/* y Not a pure module */ diff --git a/tests/tests/src/gpr_2352_test.js b/tests/tests/src/gpr_2352_test.js deleted file mode 100644 index 887a6902cf..0000000000 --- a/tests/tests/src/gpr_2352_test.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - x.hey = 22; -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_2352_test.mjs b/tests/tests/src/gpr_2352_test.mjs new file mode 100644 index 0000000000..ec07255ef3 --- /dev/null +++ b/tests/tests/src/gpr_2352_test.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + x.hey = 22; +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2413_test.js b/tests/tests/src/gpr_2413_test.js deleted file mode 100644 index 02d6c20738..0000000000 --- a/tests/tests/src/gpr_2413_test.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - switch (x.TAG) { - case "A" : - let a = x._0; - if (a.TAG === "P") { - let a$1 = a._0; - return a$1 + a$1 | 0; - } - let a$2 = a._0; - return a$2 - a$2 | 0; - case "B" : - case "C" : - break; - } - let a$3 = x._0._0; - return Math.imul(a$3, a$3); -} - -function ff(c) { - c.contents = c.contents + 1 | 0; - let match = (1 + c.contents | 0) + 1 | 0; - if (match > 3 || match < 0) { - return 0; - } else { - return match + 1 | 0; - } -} - -exports.f = f; -exports.ff = ff; -/* No side effect */ diff --git a/tests/tests/src/gpr_2413_test.mjs b/tests/tests/src/gpr_2413_test.mjs new file mode 100644 index 0000000000..1bfc18d21a --- /dev/null +++ b/tests/tests/src/gpr_2413_test.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + switch (x.TAG) { + case "A" : + let a = x._0; + if (a.TAG === "P") { + let a$1 = a._0; + return a$1 + a$1 | 0; + } + let a$2 = a._0; + return a$2 - a$2 | 0; + case "B" : + case "C" : + break; + } + let a$3 = x._0._0; + return Math.imul(a$3, a$3); +} + +function ff(c) { + c.contents = c.contents + 1 | 0; + let match = (1 + c.contents | 0) + 1 | 0; + if (match > 3 || match < 0) { + return 0; + } else { + return match + 1 | 0; + } +} + +export { + f, + ff, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2474.js b/tests/tests/src/gpr_2474.js deleted file mode 100644 index 891bfb92bb..0000000000 --- a/tests/tests/src/gpr_2474.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let coordinates = 1; - -exports.coordinates = coordinates; -/* No side effect */ diff --git a/tests/tests/src/gpr_2474.mjs b/tests/tests/src/gpr_2474.mjs new file mode 100644 index 0000000000..a8c4e71e85 --- /dev/null +++ b/tests/tests/src/gpr_2474.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let coordinates = 1; + +export { + coordinates, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2487.js b/tests/tests/src/gpr_2487.js deleted file mode 100644 index 97d0d0262d..0000000000 --- a/tests/tests/src/gpr_2487.js +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -let b = Belt_Array.eq([ - 1, - 2, - 3 -], [ - 1, - 2, - 3 -], (prim0, prim1) => prim0 === prim1); - -let A; - -exports.A = A; -exports.b = b; -/* b Not a pure module */ diff --git a/tests/tests/src/gpr_2487.mjs b/tests/tests/src/gpr_2487.mjs new file mode 100644 index 0000000000..4a526a73c6 --- /dev/null +++ b/tests/tests/src/gpr_2487.mjs @@ -0,0 +1,21 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +let b = Belt_Array.eq([ + 1, + 2, + 3 +], [ + 1, + 2, + 3 +], (prim0, prim1) => prim0 === prim1); + +let A; + +export { + A, + b, +} +/* b Not a pure module */ diff --git a/tests/tests/src/gpr_2503_test.js b/tests/tests/src/gpr_2503_test.js deleted file mode 100644 index 3d77208865..0000000000 --- a/tests/tests/src/gpr_2503_test.js +++ /dev/null @@ -1,80 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.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, b$1) { - Mt.bool_suites(test_id, suites, loc, b$1); -} - -function makeWrapper(foo, param) { - let tmp = {}; - if (foo !== undefined) { - tmp.foo = Primitive_option.valFromOption(foo); - } - console.log(tmp); -} - -function makeWrapper2(foo, param) { - console.log({ - foo: foo - }); -} - -makeWrapper2("a", undefined); - -function makeWrapper3(foo, param) { - console.log(2); - let tmp = {}; - if (foo !== undefined) { - tmp.foo = Primitive_option.valFromOption(foo); - } - return tmp; -} - -function makeWrapper4(foo, param) { - console.log(2); - let tmp = {}; - let tmp$1 = foo > 100 ? undefined : ( - foo > 10 ? "b" : "a" - ); - if (tmp$1 !== undefined) { - tmp.foo = Primitive_option.valFromOption(tmp$1); - } - return tmp; -} - -b("File \"gpr_2503_test.res\", line 39, characters 2-9", "a" === makeWrapper3("a", undefined).foo); - -b("File \"gpr_2503_test.res\", line 41, characters 2-9", undefined === makeWrapper3(undefined, undefined).foo); - -b("File \"gpr_2503_test.res\", line 43, characters 2-9", "a" === makeWrapper4(1, undefined).foo); - -b("File \"gpr_2503_test.res\", line 45, characters 2-9", "b" === makeWrapper4(11, undefined).foo); - -b("File \"gpr_2503_test.res\", line 47, characters 2-9", undefined === makeWrapper4(111, undefined).foo); - -Mt.from_pair_suites("Gpr_2503_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.makeWrapper = makeWrapper; -exports.makeWrapper2 = makeWrapper2; -exports.makeWrapper3 = makeWrapper3; -exports.makeWrapper4 = makeWrapper4; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_2503_test.mjs b/tests/tests/src/gpr_2503_test.mjs new file mode 100644 index 0000000000..5c814a0086 --- /dev/null +++ b/tests/tests/src/gpr_2503_test.mjs @@ -0,0 +1,81 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.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, b$1) { + Mt.bool_suites(test_id, suites, loc, b$1); +} + +function makeWrapper(foo, param) { + let tmp = {}; + if (foo !== undefined) { + tmp.foo = Primitive_option.valFromOption(foo); + } + console.log(tmp); +} + +function makeWrapper2(foo, param) { + console.log({ + foo: foo + }); +} + +makeWrapper2("a", undefined); + +function makeWrapper3(foo, param) { + console.log(2); + let tmp = {}; + if (foo !== undefined) { + tmp.foo = Primitive_option.valFromOption(foo); + } + return tmp; +} + +function makeWrapper4(foo, param) { + console.log(2); + let tmp = {}; + let tmp$1 = foo > 100 ? undefined : ( + foo > 10 ? "b" : "a" + ); + if (tmp$1 !== undefined) { + tmp.foo = Primitive_option.valFromOption(tmp$1); + } + return tmp; +} + +b("File \"gpr_2503_test.res\", line 39, characters 2-9", "a" === makeWrapper3("a", undefined).foo); + +b("File \"gpr_2503_test.res\", line 41, characters 2-9", undefined === makeWrapper3(undefined, undefined).foo); + +b("File \"gpr_2503_test.res\", line 43, characters 2-9", "a" === makeWrapper4(1, undefined).foo); + +b("File \"gpr_2503_test.res\", line 45, characters 2-9", "b" === makeWrapper4(11, undefined).foo); + +b("File \"gpr_2503_test.res\", line 47, characters 2-9", undefined === makeWrapper4(111, undefined).foo); + +Mt.from_pair_suites("Gpr_2503_test", suites.contents); + +export { + suites, + test_id, + eq, + b, + makeWrapper, + makeWrapper2, + makeWrapper3, + makeWrapper4, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_2608_test.js b/tests/tests/src/gpr_2608_test.js deleted file mode 100644 index d98dae52f4..0000000000 --- a/tests/tests/src/gpr_2608_test.js +++ /dev/null @@ -1,53 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let oppHeroes = { - hd: 0, - tl: /* [] */0 -}; - -let huntGrootCondition = false; - -if (Belt_List.length(/* [] */0) > 0) { - let x = Belt_List.filter(oppHeroes, h => Belt_List.headExn(/* [] */0) <= 1000); - huntGrootCondition = Belt_List.length(x) === 0; -} - -let huntGrootCondition2 = true; - -if (Belt_List.length(/* [] */0) < 0) { - let x$1 = Belt_List.filter(oppHeroes, h => Belt_List.headExn(/* [] */0) <= 1000); - huntGrootCondition2 = Belt_List.length(x$1) === 0; -} - -eq("File \"gpr_2608_test.res\", line 23, characters 5-12", huntGrootCondition, false); - -eq("File \"gpr_2608_test.res\", line 24, characters 5-12", huntGrootCondition2, true); - -Mt.from_pair_suites("Gpr_2608_test", suites.contents); - -let nearestGroots = /* [] */0; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.nearestGroots = nearestGroots; -exports.oppHeroes = oppHeroes; -exports.huntGrootCondition = huntGrootCondition; -exports.huntGrootCondition2 = huntGrootCondition2; -/* huntGrootCondition Not a pure module */ diff --git a/tests/tests/src/gpr_2608_test.mjs b/tests/tests/src/gpr_2608_test.mjs new file mode 100644 index 0000000000..c21ae62eaf --- /dev/null +++ b/tests/tests/src/gpr_2608_test.mjs @@ -0,0 +1,54 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let oppHeroes = { + hd: 0, + tl: /* [] */0 +}; + +let huntGrootCondition = false; + +if (Belt_List.length(/* [] */0) > 0) { + let x = Belt_List.filter(oppHeroes, h => Belt_List.headExn(/* [] */0) <= 1000); + huntGrootCondition = Belt_List.length(x) === 0; +} + +let huntGrootCondition2 = true; + +if (Belt_List.length(/* [] */0) < 0) { + let x$1 = Belt_List.filter(oppHeroes, h => Belt_List.headExn(/* [] */0) <= 1000); + huntGrootCondition2 = Belt_List.length(x$1) === 0; +} + +eq("File \"gpr_2608_test.res\", line 23, characters 5-12", huntGrootCondition, false); + +eq("File \"gpr_2608_test.res\", line 24, characters 5-12", huntGrootCondition2, true); + +Mt.from_pair_suites("Gpr_2608_test", suites.contents); + +let nearestGroots = /* [] */0; + +export { + suites, + test_id, + eq, + nearestGroots, + oppHeroes, + huntGrootCondition, + huntGrootCondition2, +} +/* huntGrootCondition Not a pure module */ diff --git a/tests/tests/src/gpr_2614_test.js b/tests/tests/src/gpr_2614_test.js deleted file mode 100644 index 73298c140b..0000000000 --- a/tests/tests/src/gpr_2614_test.js +++ /dev/null @@ -1,74 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let v = { - "Content-Type": 3, - l: 2, - open: 2 -}; - -let b = v.l; - -let c = v.open; - -function ff() { - v["Content-Type"] = 3; - v.l = 2; -} - -let partial_arg = "x"; - -function h0(param) { - let tmp = { - hi: 2 - }; - if (partial_arg !== undefined) { - tmp["lo-x"] = Primitive_option.valFromOption(partial_arg); - } - return tmp; -} - -let h1 = { - "lo-x": "x", - hi: 2 -}; - -let h2 = { - hi: 2 -}; - -function hh(x) { - x["lo-x"] = "3"; - return Primitive_option.fromUndefined(x["lo-x"]); -} - -function hh2(x) { - let match = x["lo-x"]; - if (match !== undefined) { - return 1; - } else { - return 0; - } -} - -let u = { - "xx-yy": 3 -}; - -let x = u["xx-yy"]; - -let v$1 = x !== undefined ? x : 0; - -exports.b = b; -exports.c = c; -exports.ff = ff; -exports.h0 = h0; -exports.h1 = h1; -exports.h2 = h2; -exports.hh = hh; -exports.hh2 = hh2; -exports.u = u; -exports.v = v$1; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_2614_test.mjs b/tests/tests/src/gpr_2614_test.mjs new file mode 100644 index 0000000000..29ee32cd3d --- /dev/null +++ b/tests/tests/src/gpr_2614_test.mjs @@ -0,0 +1,75 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let v = { + "Content-Type": 3, + l: 2, + open: 2 +}; + +let b = v.l; + +let c = v.open; + +function ff() { + v["Content-Type"] = 3; + v.l = 2; +} + +let partial_arg = "x"; + +function h0(param) { + let tmp = { + hi: 2 + }; + if (partial_arg !== undefined) { + tmp["lo-x"] = Primitive_option.valFromOption(partial_arg); + } + return tmp; +} + +let h1 = { + "lo-x": "x", + hi: 2 +}; + +let h2 = { + hi: 2 +}; + +function hh(x) { + x["lo-x"] = "3"; + return Primitive_option.fromUndefined(x["lo-x"]); +} + +function hh2(x) { + let match = x["lo-x"]; + if (match !== undefined) { + return 1; + } else { + return 0; + } +} + +let u = { + "xx-yy": 3 +}; + +let x = u["xx-yy"]; + +let v$1 = x !== undefined ? x : 0; + +export { + b, + c, + ff, + h0, + h1, + h2, + hh, + hh2, + u, + v$1 as v, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_2633_test.js b/tests/tests/src/gpr_2633_test.js deleted file mode 100644 index 43ff22b9d0..0000000000 --- a/tests/tests/src/gpr_2633_test.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function on1(foo, event) { - foo.on(event.NAME, event.VAL); -} - -function on2(foo, h, event) { - foo.on(h(event).NAME, h(event).VAL); -} - -exports.on1 = on1; -exports.on2 = on2; -/* No side effect */ diff --git a/tests/tests/src/gpr_2633_test.mjs b/tests/tests/src/gpr_2633_test.mjs new file mode 100644 index 0000000000..8d22cca865 --- /dev/null +++ b/tests/tests/src/gpr_2633_test.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function on1(foo, event) { + foo.on(event.NAME, event.VAL); +} + +function on2(foo, h, event) { + foo.on(h(event).NAME, h(event).VAL); +} + +export { + on1, + on2, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2642_test.js b/tests/tests/src/gpr_2642_test.js deleted file mode 100644 index 1d5d3b9b66..0000000000 --- a/tests/tests/src/gpr_2642_test.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function isfree(id, _x) { - while (true) { - let x = _x; - switch (x.TAG) { - case "Pident" : - return id === x._0; - case "Pdot" : - _x = x._0; - continue; - case "Papply" : - if (isfree(id, x._0)) { - return true; - } - _x = x._1; - continue; - } - }; -} - -exports.isfree = isfree; -/* No side effect */ diff --git a/tests/tests/src/gpr_2642_test.mjs b/tests/tests/src/gpr_2642_test.mjs new file mode 100644 index 0000000000..3edb40c387 --- /dev/null +++ b/tests/tests/src/gpr_2642_test.mjs @@ -0,0 +1,26 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function isfree(id, _x) { + while (true) { + let x = _x; + switch (x.TAG) { + case "Pident" : + return id === x._0; + case "Pdot" : + _x = x._0; + continue; + case "Papply" : + if (isfree(id, x._0)) { + return true; + } + _x = x._1; + continue; + } + }; +} + +export { + isfree, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2682_test.js b/tests/tests/src/gpr_2682_test.js deleted file mode 100644 index 1c07be7aca..0000000000 --- a/tests/tests/src/gpr_2682_test.js +++ /dev/null @@ -1,69 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let sum = ((a,b) => a + b); - -let v = sum(1, 2); - -function f(a) { - return a + 3 | 0; -} - -let b = f(1); - -let c = f(2); - -let forIn = ((o,foo)=> { - for (var i in o){ - foo(o) - } - }); - -function log(x) { - console.log(x); -} - -let N = { - log2: log -}; - -forIn({ - x: 3 -}, x => { - console.log(x); -}); - -forIn({ - x: 3, - y: 3 -}, x => { - console.log(x); -}); - -let f3 = (()=>true); - -let bbbb = f3(); - -if (!bbbb) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_2682_test.res", - 52, - 0 - ], - Error: new Error() - }; -} - -exports.sum = sum; -exports.v = v; -exports.f = f; -exports.b = b; -exports.c = c; -exports.forIn = forIn; -exports.N = N; -exports.f3 = f3; -exports.bbbb = bbbb; -/* v Not a pure module */ diff --git a/tests/tests/src/gpr_2682_test.mjs b/tests/tests/src/gpr_2682_test.mjs new file mode 100644 index 0000000000..bcdb050231 --- /dev/null +++ b/tests/tests/src/gpr_2682_test.mjs @@ -0,0 +1,70 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let sum = ((a,b) => a + b); + +let v = sum(1, 2); + +function f(a) { + return a + 3 | 0; +} + +let b = f(1); + +let c = f(2); + +let forIn = ((o,foo)=> { + for (var i in o){ + foo(o) + } + }); + +function log(x) { + console.log(x); +} + +let N = { + log2: log +}; + +forIn({ + x: 3 +}, x => { + console.log(x); +}); + +forIn({ + x: 3, + y: 3 +}, x => { + console.log(x); +}); + +let f3 = (()=>true); + +let bbbb = f3(); + +if (!bbbb) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_2682_test.res", + 52, + 0 + ], + Error: new Error() + }; +} + +export { + sum, + v, + f, + b, + c, + forIn, + N, + f3, + bbbb, +} +/* v Not a pure module */ diff --git a/tests/tests/src/gpr_2700_test.js b/tests/tests/src/gpr_2700_test.js deleted file mode 100644 index d30a948391..0000000000 --- a/tests/tests/src/gpr_2700_test.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - if (x === 3) { - return true; - } else { - return x === 4; - } -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_2700_test.mjs b/tests/tests/src/gpr_2700_test.mjs new file mode 100644 index 0000000000..9eeae57bfa --- /dev/null +++ b/tests/tests/src/gpr_2700_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + if (x === 3) { + return true; + } else { + return x === 4; + } +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_2731_test.js b/tests/tests/src/gpr_2731_test.js deleted file mode 100644 index dc4a63ff60..0000000000 --- a/tests/tests/src/gpr_2731_test.js +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - return x + 1 | 0; -} - -let a = f(1); - -let b = f(2); - -function g() { - return 1; -} - -let c = g(); - -let d = g(); - -exports.f = f; -exports.a = a; -exports.b = b; -exports.g = g; -exports.c = c; -exports.d = d; -/* a Not a pure module */ diff --git a/tests/tests/src/gpr_2731_test.mjs b/tests/tests/src/gpr_2731_test.mjs new file mode 100644 index 0000000000..3bf300bc49 --- /dev/null +++ b/tests/tests/src/gpr_2731_test.mjs @@ -0,0 +1,28 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + return x + 1 | 0; +} + +let a = f(1); + +let b = f(2); + +function g() { + return 1; +} + +let c = g(); + +let d = g(); + +export { + f, + a, + b, + g, + c, + d, +} +/* a Not a pure module */ diff --git a/tests/tests/src/gpr_2789_test.js b/tests/tests/src/gpr_2789_test.js deleted file mode 100644 index ee5bceb7ef..0000000000 --- a/tests/tests/src/gpr_2789_test.js +++ /dev/null @@ -1,23 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -Mt.from_pair_suites("Gpr_2789_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_2789_test.mjs b/tests/tests/src/gpr_2789_test.mjs new file mode 100644 index 0000000000..ab55b96595 --- /dev/null +++ b/tests/tests/src/gpr_2789_test.mjs @@ -0,0 +1,24 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +Mt.from_pair_suites("Gpr_2789_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_2931_test.js b/tests/tests/src/gpr_2931_test.js deleted file mode 100644 index a5746e30eb..0000000000 --- a/tests/tests/src/gpr_2931_test.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.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 fake_c2(a_type, b_type) { - switch (a_type) { - case "number" : - if (b_type === "number") { - return 33; - } - break; - case "string" : - return 1; - case "undefined" : - return -1; - } - if (b_type === "undefined") { - return 1; - } else if (a_type === "number") { - return 3; - } else { - return 0; - } -} - -eq("File \"gpr_2931_test.res\", line 15, characters 3-10", 3, fake_c2("number", "xx")); - -Mt.from_pair_suites("Gpr_2931_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.fake_c2 = fake_c2; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_2931_test.mjs b/tests/tests/src/gpr_2931_test.mjs new file mode 100644 index 0000000000..b6ef19d386 --- /dev/null +++ b/tests/tests/src/gpr_2931_test.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +function fake_c2(a_type, b_type) { + switch (a_type) { + case "number" : + if (b_type === "number") { + return 33; + } + break; + case "string" : + return 1; + case "undefined" : + return -1; + } + if (b_type === "undefined") { + return 1; + } else if (a_type === "number") { + return 3; + } else { + return 0; + } +} + +eq("File \"gpr_2931_test.res\", line 15, characters 3-10", 3, fake_c2("number", "xx")); + +Mt.from_pair_suites("Gpr_2931_test", suites.contents); + +export { + suites, + test_id, + eq, + fake_c2, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3142_test.js b/tests/tests/src/gpr_3142_test.js deleted file mode 100644 index fc15d1979d..0000000000 --- a/tests/tests/src/gpr_3142_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let _map = {"a":"x","u":"hi","b":"你","c":"我"}; - -let _revMap = {"x":"a","hi":"u","你":"b","我":"c"}; - -function tToJs(param) { - return _map[param]; -} - -function tFromJs(param) { - return _revMap[param]; -} - -eq("File \"gpr_3142_test.res\", line 17, characters 3-10", tToJs("a"), "x"); - -eq("File \"gpr_3142_test.res\", line 18, characters 3-10", tToJs("u"), "hi"); - -eq("File \"gpr_3142_test.res\", line 19, characters 3-10", tToJs("b"), "你"); - -eq("File \"gpr_3142_test.res\", line 20, characters 3-10", tToJs("c"), "我"); - -eq("File \"gpr_3142_test.res\", line 22, characters 3-10", tFromJs("x"), "a"); - -eq("File \"gpr_3142_test.res\", line 23, characters 3-10", tFromJs("hi"), "u"); - -eq("File \"gpr_3142_test.res\", line 24, characters 3-10", tFromJs("你"), "b"); - -eq("File \"gpr_3142_test.res\", line 25, characters 3-10", tFromJs("我"), "c"); - -eq("File \"gpr_3142_test.res\", line 26, characters 3-10", tFromJs("xx"), undefined); - -Mt.from_pair_suites("Gpr_3142_test", suites.contents); - -let v = tToJs; - -let u = tFromJs; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.tToJs = tToJs; -exports.tFromJs = tFromJs; -exports.v = v; -exports.u = u; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3142_test.mjs b/tests/tests/src/gpr_3142_test.mjs new file mode 100644 index 0000000000..60628522d2 --- /dev/null +++ b/tests/tests/src/gpr_3142_test.mjs @@ -0,0 +1,62 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let _map = {"a":"x","u":"hi","b":"你","c":"我"}; + +let _revMap = {"x":"a","hi":"u","你":"b","我":"c"}; + +function tToJs(param) { + return _map[param]; +} + +function tFromJs(param) { + return _revMap[param]; +} + +eq("File \"gpr_3142_test.res\", line 17, characters 3-10", tToJs("a"), "x"); + +eq("File \"gpr_3142_test.res\", line 18, characters 3-10", tToJs("u"), "hi"); + +eq("File \"gpr_3142_test.res\", line 19, characters 3-10", tToJs("b"), "你"); + +eq("File \"gpr_3142_test.res\", line 20, characters 3-10", tToJs("c"), "我"); + +eq("File \"gpr_3142_test.res\", line 22, characters 3-10", tFromJs("x"), "a"); + +eq("File \"gpr_3142_test.res\", line 23, characters 3-10", tFromJs("hi"), "u"); + +eq("File \"gpr_3142_test.res\", line 24, characters 3-10", tFromJs("你"), "b"); + +eq("File \"gpr_3142_test.res\", line 25, characters 3-10", tFromJs("我"), "c"); + +eq("File \"gpr_3142_test.res\", line 26, characters 3-10", tFromJs("xx"), undefined); + +Mt.from_pair_suites("Gpr_3142_test", suites.contents); + +let v = tToJs; + +let u = tFromJs; + +export { + suites, + test_id, + eq, + tToJs, + tFromJs, + v, + u, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3154_test.js b/tests/tests/src/gpr_3154_test.js deleted file mode 100644 index da6e5f6f87..0000000000 --- a/tests/tests/src/gpr_3154_test.js +++ /dev/null @@ -1,51 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_dict = require("rescript/lib/js/Js_dict.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.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); -} - -let d = {}; - -d["foo"] = undefined; - -let match = Js_dict.get(d, "foo"); - -if (match !== undefined && Primitive_option.valFromOption(match) === undefined) { - b("File \"gpr_3154_test.res\", line 12, characters 20-27", true); -} else { - b("File \"gpr_3154_test.res\", line 13, characters 11-18", false); -} - -let d0 = {}; - -d0["foo"] = undefined; - -eq("File \"gpr_3154_test.res\", line 20, characters 5-12", Js_dict.get(d0, "foo"), Primitive_option.some(undefined)); - -Mt.from_pair_suites("Gpr_3154_test", suites.contents); - -let J; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.J = J; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3154_test.mjs b/tests/tests/src/gpr_3154_test.mjs new file mode 100644 index 0000000000..718fff37ff --- /dev/null +++ b/tests/tests/src/gpr_3154_test.mjs @@ -0,0 +1,52 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_dict from "rescript/lib/es6/Js_dict.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.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); +} + +let d = {}; + +d["foo"] = undefined; + +let match = Js_dict.get(d, "foo"); + +if (match !== undefined && Primitive_option.valFromOption(match) === undefined) { + b("File \"gpr_3154_test.res\", line 12, characters 20-27", true); +} else { + b("File \"gpr_3154_test.res\", line 13, characters 11-18", false); +} + +let d0 = {}; + +d0["foo"] = undefined; + +eq("File \"gpr_3154_test.res\", line 20, characters 5-12", Js_dict.get(d0, "foo"), Primitive_option.some(undefined)); + +Mt.from_pair_suites("Gpr_3154_test", suites.contents); + +let J; + +export { + suites, + test_id, + eq, + b, + J, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3209_test.js b/tests/tests/src/gpr_3209_test.js deleted file mode 100644 index 8351c2e193..0000000000 --- a/tests/tests/src/gpr_3209_test.js +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f9(x) { - if (typeof x !== "object") { - switch (x) { - case "T60" : - case "T61" : - case "T62" : - return 1; - default: - return 3; - } - } else { - switch (x.TAG) { - case "T64" : - case "T65" : - return 2; - default: - return 3; - } - } -} - -exports.f9 = f9; -/* No side effect */ diff --git a/tests/tests/src/gpr_3209_test.mjs b/tests/tests/src/gpr_3209_test.mjs new file mode 100644 index 0000000000..ebca49945c --- /dev/null +++ b/tests/tests/src/gpr_3209_test.mjs @@ -0,0 +1,28 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f9(x) { + if (typeof x !== "object") { + switch (x) { + case "T60" : + case "T61" : + case "T62" : + return 1; + default: + return 3; + } + } else { + switch (x.TAG) { + case "T64" : + case "T65" : + return 2; + default: + return 3; + } + } +} + +export { + f9, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3492_test.js b/tests/tests/src/gpr_3492_test.js deleted file mode 100644 index 2778593e60..0000000000 --- a/tests/tests/src/gpr_3492_test.js +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.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 foo(a){return a()} -; - -function fn() { - console.log("hi"); - return 1; -} - -eq("File \"gpr_3492_test.res\", line 13, characters 12-19", foo(fn), 1); - -Mt.from_pair_suites("gpr_3492_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.fn = fn; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3492_test.mjs b/tests/tests/src/gpr_3492_test.mjs new file mode 100644 index 0000000000..5a6f7c65c1 --- /dev/null +++ b/tests/tests/src/gpr_3492_test.mjs @@ -0,0 +1,35 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +function foo(a){return a()} +; + +function fn() { + console.log("hi"); + return 1; +} + +eq("File \"gpr_3492_test.res\", line 13, characters 12-19", foo(fn), 1); + +Mt.from_pair_suites("gpr_3492_test.res", suites.contents); + +export { + suites, + test_id, + eq, + fn, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3519_jsx_test.js b/tests/tests/src/gpr_3519_jsx_test.js deleted file mode 100644 index 50cf7d45a2..0000000000 --- a/tests/tests/src/gpr_3519_jsx_test.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let React = { - $$null: undefined -}; - -function make(param, param$1) { - -} - -let Foo = { - make: make -}; - -exports.React = React; -exports.Foo = Foo; -/* No side effect */ diff --git a/tests/tests/src/gpr_3519_jsx_test.mjs b/tests/tests/src/gpr_3519_jsx_test.mjs new file mode 100644 index 0000000000..d640430095 --- /dev/null +++ b/tests/tests/src/gpr_3519_jsx_test.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let React = { + $$null: undefined +}; + +function make(param, param$1) { + +} + +let Foo = { + make: make +}; + +export { + React, + Foo, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3519_test.js b/tests/tests/src/gpr_3519_test.mjs similarity index 100% rename from tests/tests/src/gpr_3519_test.js rename to tests/tests/src/gpr_3519_test.mjs diff --git a/tests/tests/src/gpr_3536_test.js b/tests/tests/src/gpr_3536_test.js deleted file mode 100644 index 4f40fea997..0000000000 --- a/tests/tests/src/gpr_3536_test.js +++ /dev/null @@ -1,44 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let X = {}; - -function xx(obj, a0, a1, a2, a3, a4, a5) { - return (a4(a2(a0(obj, a1), a3), a5) - 1 | 0) - 3 | 0; -} - -eq("File \"gpr_3536_test.res\", line 18, characters 12-19", 5, 5); - -eq("File \"gpr_3536_test.res\", line 20, characters 12-19", xx(3, (prim0, prim1) => prim0 - prim1 | 0, 2, (prim0, prim1) => prim0 + prim1 | 0, 4, (prim0, prim1) => Math.imul(prim0, prim1), 3), 11); - -Mt.from_pair_suites("Gpr_3536_test", suites.contents); - -let v = 5; - -let u = { - TAG: "Some", - _0: 3 -}; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.X = X; -exports.u = u; -exports.xx = xx; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3536_test.mjs b/tests/tests/src/gpr_3536_test.mjs new file mode 100644 index 0000000000..052dc887ae --- /dev/null +++ b/tests/tests/src/gpr_3536_test.mjs @@ -0,0 +1,45 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let X = {}; + +function xx(obj, a0, a1, a2, a3, a4, a5) { + return (a4(a2(a0(obj, a1), a3), a5) - 1 | 0) - 3 | 0; +} + +eq("File \"gpr_3536_test.res\", line 18, characters 12-19", 5, 5); + +eq("File \"gpr_3536_test.res\", line 20, characters 12-19", xx(3, (prim0, prim1) => prim0 - prim1 | 0, 2, (prim0, prim1) => prim0 + prim1 | 0, 4, (prim0, prim1) => Math.imul(prim0, prim1), 3), 11); + +Mt.from_pair_suites("Gpr_3536_test", suites.contents); + +let v = 5; + +let u = { + TAG: "Some", + _0: 3 +}; + +export { + suites, + test_id, + eq, + v, + X, + u, + xx, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3546_test.js b/tests/tests/src/gpr_3546_test.js deleted file mode 100644 index eded96c5c3..0000000000 --- a/tests/tests/src/gpr_3546_test.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function t_error3(param_0) { - return { - TAG: "T_error3", - _0: param_0 - }; -} - -let t_error = "T_error"; - -let t_error2 = "T_error2"; - -exports.t_error = t_error; -exports.t_error2 = t_error2; -exports.t_error3 = t_error3; -/* No side effect */ diff --git a/tests/tests/src/gpr_3546_test.mjs b/tests/tests/src/gpr_3546_test.mjs new file mode 100644 index 0000000000..3a98e1a84e --- /dev/null +++ b/tests/tests/src/gpr_3546_test.mjs @@ -0,0 +1,20 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function t_error3(param_0) { + return { + TAG: "T_error3", + _0: param_0 + }; +} + +let t_error = "T_error"; + +let t_error2 = "T_error2"; + +export { + t_error, + t_error2, + t_error3, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3548_test.js b/tests/tests/src/gpr_3548_test.js deleted file mode 100644 index d8d45b39b1..0000000000 --- a/tests/tests/src/gpr_3548_test.js +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let _map = {"Horizontal":"horizontal","Vertical":"vertical"}; - -let _revMap = {"horizontal":"Horizontal","vertical":"Vertical"}; - -function orientationToJs(param) { - return _map[param]; -} - -function orientationFromJs(param) { - return _revMap[param]; -} - -console.log(orientationToJs("Horizontal")); - -exports.orientationToJs = orientationToJs; -exports.orientationFromJs = orientationFromJs; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3548_test.mjs b/tests/tests/src/gpr_3548_test.mjs new file mode 100644 index 0000000000..b7f5f8f81a --- /dev/null +++ b/tests/tests/src/gpr_3548_test.mjs @@ -0,0 +1,22 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let _map = {"Horizontal":"horizontal","Vertical":"vertical"}; + +let _revMap = {"horizontal":"Horizontal","vertical":"Vertical"}; + +function orientationToJs(param) { + return _map[param]; +} + +function orientationFromJs(param) { + return _revMap[param]; +} + +console.log(orientationToJs("Horizontal")); + +export { + orientationToJs, + orientationFromJs, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3549_test.js b/tests/tests/src/gpr_3549_test.js deleted file mode 100644 index 709541175c..0000000000 --- a/tests/tests/src/gpr_3549_test.js +++ /dev/null @@ -1,60 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let others = [ - 0, - 0, - 1, - 1, - 2e3 -]; - -eq("File \"gpr_3549_test.res\", line 13, characters 5-12", 7.0, 7); - -eq("File \"gpr_3549_test.res\", line 14, characters 5-12", 2e3, 2000); - -eq("File \"gpr_3549_test.res\", line 15, characters 5-12", 0.2, 0.2); - -eq("File \"gpr_3549_test.res\", line 16, characters 5-12", 32, 32); - -eq("File \"gpr_3549_test.res\", line 17, characters 5-12", others, [ - 0.0, - 0.0, - 1.0, - 1.0, - 2e3 -]); - -Mt.from_pair_suites("Gpr_3549_test", suites.contents); - -let u = 32; - -let x = 7.0; - -let y = 2e3; - -let z = 0.2; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.u = u; -exports.x = x; -exports.y = y; -exports.z = z; -exports.others = others; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3549_test.mjs b/tests/tests/src/gpr_3549_test.mjs new file mode 100644 index 0000000000..c77aa3ac5c --- /dev/null +++ b/tests/tests/src/gpr_3549_test.mjs @@ -0,0 +1,61 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let others = [ + 0, + 0, + 1, + 1, + 2e3 +]; + +eq("File \"gpr_3549_test.res\", line 13, characters 5-12", 7.0, 7); + +eq("File \"gpr_3549_test.res\", line 14, characters 5-12", 2e3, 2000); + +eq("File \"gpr_3549_test.res\", line 15, characters 5-12", 0.2, 0.2); + +eq("File \"gpr_3549_test.res\", line 16, characters 5-12", 32, 32); + +eq("File \"gpr_3549_test.res\", line 17, characters 5-12", others, [ + 0.0, + 0.0, + 1.0, + 1.0, + 2e3 +]); + +Mt.from_pair_suites("Gpr_3549_test", suites.contents); + +let u = 32; + +let x = 7.0; + +let y = 2e3; + +let z = 0.2; + +export { + suites, + test_id, + eq, + u, + x, + y, + z, + others, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3566_drive_test.js b/tests/tests/src/gpr_3566_drive_test.js deleted file mode 100644 index 03e11b1192..0000000000 --- a/tests/tests/src/gpr_3566_drive_test.js +++ /dev/null @@ -1,38 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Gpr_3566_test = require("./gpr_3566_test.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let H = Gpr_3566_test.Test({}); - -eq("File \"gpr_3566_drive_test.res\", line 7, characters 12-19", H.b, true); - -let Caml_option = {}; - -function f(x) { - return Primitive_option.some(x); -} - -Mt.from_pair_suites("gpr_3566_drive_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.H = H; -exports.Caml_option = Caml_option; -exports.f = f; -/* H Not a pure module */ diff --git a/tests/tests/src/gpr_3566_drive_test.mjs b/tests/tests/src/gpr_3566_drive_test.mjs new file mode 100644 index 0000000000..a19b4080d7 --- /dev/null +++ b/tests/tests/src/gpr_3566_drive_test.mjs @@ -0,0 +1,39 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Gpr_3566_test from "./gpr_3566_test.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let H = Gpr_3566_test.Test({}); + +eq("File \"gpr_3566_drive_test.res\", line 7, characters 12-19", H.b, true); + +let Caml_option = {}; + +function f(x) { + return Primitive_option.some(x); +} + +Mt.from_pair_suites("gpr_3566_drive_test.res", suites.contents); + +export { + suites, + test_id, + eq, + H, + Caml_option, + f, +} +/* H Not a pure module */ diff --git a/tests/tests/src/gpr_3566_test.js b/tests/tests/src/gpr_3566_test.js deleted file mode 100644 index 2059d1e0ed..0000000000 --- a/tests/tests/src/gpr_3566_test.js +++ /dev/null @@ -1,142 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -function eq_A(x, y) { - if (x.TAG === "A" && y.TAG === "A") { - return x._0 === y._0; - } else { - return false; - } -} - -function Test($star) { - console.log("no inline"); - let u = { - TAG: "A", - _0: 3 - }; - let Block = {}; - let b = eq_A({ - TAG: "A", - _0: 3 - }, u); - return { - u: u, - Block: Block, - y: 32, - b: b - }; -} - -function Test2($star) { - console.log("no inline"); - let Block = {}; - let b = eq_A({ - TAG: "A", - _0: 3 - }, { - TAG: "A", - _0: 3 - }); - return { - Block: Block, - y: 32, - b: b - }; -} - -function f(i, y) { - let x = { - TAG: "A", - _0: i - }; - return eq_A(x, y); -} - -function Test3($star) { - let f = Primitive_object.equal; - let Caml_obj = {}; - return { - f: f, - Caml_obj: Caml_obj - }; -} - -function Test4($star) { - let Caml_obj = {}; - let f = Primitive_object.equal; - return { - Caml_obj: Caml_obj, - f: f - }; -} - -function Test5($star) { - let f = x => Primitive_option.some(x); - let Caml_option = {}; - return { - f: f, - Caml_option: Caml_option - }; -} - -function Test6($star) { - let Caml_option = {}; - let f = x => Primitive_option.some(x); - return { - Caml_option: Caml_option, - f: f - }; -} - -function Test7($star) { - let Caml_option = {}; - return { - Caml_option: Caml_option - }; -} - -function Test8($star) { - let Curry = {}; - let f = x => x(1); - return { - Curry: Curry, - f: f - }; -} - -function Test9($star) { - let f = x => x(1); - let Curry = {}; - return { - f: f, - Curry: Curry - }; -} - -function Test10($star) { - let Curry = {}; - return { - Curry: Curry - }; -} - -let x = 3; - -exports.eq_A = eq_A; -exports.Test = Test; -exports.Test2 = Test2; -exports.x = x; -exports.f = f; -exports.Test3 = Test3; -exports.Test4 = Test4; -exports.Test5 = Test5; -exports.Test6 = Test6; -exports.Test7 = Test7; -exports.Test8 = Test8; -exports.Test9 = Test9; -exports.Test10 = Test10; -/* No side effect */ diff --git a/tests/tests/src/gpr_3566_test.mjs b/tests/tests/src/gpr_3566_test.mjs new file mode 100644 index 0000000000..dd716ecbdd --- /dev/null +++ b/tests/tests/src/gpr_3566_test.mjs @@ -0,0 +1,143 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +function eq_A(x, y) { + if (x.TAG === "A" && y.TAG === "A") { + return x._0 === y._0; + } else { + return false; + } +} + +function Test($star) { + console.log("no inline"); + let u = { + TAG: "A", + _0: 3 + }; + let Block = {}; + let b = eq_A({ + TAG: "A", + _0: 3 + }, u); + return { + u: u, + Block: Block, + y: 32, + b: b + }; +} + +function Test2($star) { + console.log("no inline"); + let Block = {}; + let b = eq_A({ + TAG: "A", + _0: 3 + }, { + TAG: "A", + _0: 3 + }); + return { + Block: Block, + y: 32, + b: b + }; +} + +function f(i, y) { + let x = { + TAG: "A", + _0: i + }; + return eq_A(x, y); +} + +function Test3($star) { + let f = Primitive_object.equal; + let Caml_obj = {}; + return { + f: f, + Caml_obj: Caml_obj + }; +} + +function Test4($star) { + let Caml_obj = {}; + let f = Primitive_object.equal; + return { + Caml_obj: Caml_obj, + f: f + }; +} + +function Test5($star) { + let f = x => Primitive_option.some(x); + let Caml_option = {}; + return { + f: f, + Caml_option: Caml_option + }; +} + +function Test6($star) { + let Caml_option = {}; + let f = x => Primitive_option.some(x); + return { + Caml_option: Caml_option, + f: f + }; +} + +function Test7($star) { + let Caml_option = {}; + return { + Caml_option: Caml_option + }; +} + +function Test8($star) { + let Curry = {}; + let f = x => x(1); + return { + Curry: Curry, + f: f + }; +} + +function Test9($star) { + let f = x => x(1); + let Curry = {}; + return { + f: f, + Curry: Curry + }; +} + +function Test10($star) { + let Curry = {}; + return { + Curry: Curry + }; +} + +let x = 3; + +export { + eq_A, + Test, + Test2, + x, + f, + Test3, + Test4, + Test5, + Test6, + Test7, + Test8, + Test9, + Test10, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3595_test.js b/tests/tests/src/gpr_3595_test.js deleted file mode 100644 index 9606c9b577..0000000000 --- a/tests/tests/src/gpr_3595_test.js +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let x = 1; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.x = x; -/* Mt Not a pure module */ diff --git a/tests/tests/src/gpr_3595_test.mjs b/tests/tests/src/gpr_3595_test.mjs new file mode 100644 index 0000000000..e039ff0cdc --- /dev/null +++ b/tests/tests/src/gpr_3595_test.mjs @@ -0,0 +1,25 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let x = 1; + +export { + suites, + test_id, + eq, + x, +} +/* Mt Not a pure module */ diff --git a/tests/tests/src/gpr_3609_test.js b/tests/tests/src/gpr_3609_test.js deleted file mode 100644 index b500d4101c..0000000000 --- a/tests/tests/src/gpr_3609_test.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function func(state) { - if (typeof state !== "object") { - return 0; - } else { - return 0 + state._0 | 0; - } -} - -exports.func = func; -/* No side effect */ diff --git a/tests/tests/src/gpr_3609_test.mjs b/tests/tests/src/gpr_3609_test.mjs new file mode 100644 index 0000000000..3aea07bc90 --- /dev/null +++ b/tests/tests/src/gpr_3609_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function func(state) { + if (typeof state !== "object") { + return 0; + } else { + return 0 + state._0 | 0; + } +} + +export { + func, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3697_test.js b/tests/tests/src/gpr_3697_test.js deleted file mode 100644 index fb51e9d217..0000000000 --- a/tests/tests/src/gpr_3697_test.js +++ /dev/null @@ -1,31 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Lazy = require("rescript/lib/js/Lazy.js"); - -function fix() { - return { - TAG: "Fix", - _0: Lazy.from_fun(fix) - }; -} - -function unfixLeak(_f) { - while (true) { - let f = _f; - _f = Lazy.force(f._0); - continue; - }; -} - -function unfix(p) { - while (true) { - let h = p.contents; - p.contents = Lazy.force(h._0); - }; -} - -exports.fix = fix; -exports.unfixLeak = unfixLeak; -exports.unfix = unfix; -/* No side effect */ diff --git a/tests/tests/src/gpr_3697_test.mjs b/tests/tests/src/gpr_3697_test.mjs new file mode 100644 index 0000000000..c17da8ed66 --- /dev/null +++ b/tests/tests/src/gpr_3697_test.mjs @@ -0,0 +1,32 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Lazy from "rescript/lib/es6/Lazy.js"; + +function fix() { + return { + TAG: "Fix", + _0: Lazy.from_fun(fix) + }; +} + +function unfixLeak(_f) { + while (true) { + let f = _f; + _f = Lazy.force(f._0); + continue; + }; +} + +function unfix(p) { + while (true) { + let h = p.contents; + p.contents = Lazy.force(h._0); + }; +} + +export { + fix, + unfixLeak, + unfix, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_373_test.js b/tests/tests/src/gpr_373_test.js deleted file mode 100644 index 500f2af235..0000000000 --- a/tests/tests/src/gpr_373_test.js +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let overflow_dec_i32_number = 272872590; - -let overflow_dec_i32_number_2 = 0; - -let not_overflow_dec_i32_number_3 = -1; - -let overflow_hex_i32_number = -1; - -exports.overflow_dec_i32_number = overflow_dec_i32_number; -exports.overflow_dec_i32_number_2 = overflow_dec_i32_number_2; -exports.not_overflow_dec_i32_number_3 = not_overflow_dec_i32_number_3; -exports.overflow_hex_i32_number = overflow_hex_i32_number; -/* No side effect */ diff --git a/tests/tests/src/gpr_373_test.mjs b/tests/tests/src/gpr_373_test.mjs new file mode 100644 index 0000000000..9244c1983e --- /dev/null +++ b/tests/tests/src/gpr_373_test.mjs @@ -0,0 +1,18 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let overflow_dec_i32_number = 272872590; + +let overflow_dec_i32_number_2 = 0; + +let not_overflow_dec_i32_number_3 = -1; + +let overflow_hex_i32_number = -1; + +export { + overflow_dec_i32_number, + overflow_dec_i32_number_2, + not_overflow_dec_i32_number_3, + overflow_hex_i32_number, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3770_test.js b/tests/tests/src/gpr_3770_test.js deleted file mode 100644 index 57b77c7a3d..0000000000 --- a/tests/tests/src/gpr_3770_test.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function show(x) { - let a = x._0; - if (a === 0 && x._1 === 0 && x._2 === 0) { - return "zeroes"; - } - return a.toString() + x._1.toString(); -} - -exports.show = show; -/* No side effect */ diff --git a/tests/tests/src/gpr_3770_test.mjs b/tests/tests/src/gpr_3770_test.mjs new file mode 100644 index 0000000000..b483394ac4 --- /dev/null +++ b/tests/tests/src/gpr_3770_test.mjs @@ -0,0 +1,15 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function show(x) { + let a = x._0; + if (a === 0 && x._1 === 0 && x._2 === 0) { + return "zeroes"; + } + return a.toString() + x._1.toString(); +} + +export { + show, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3852_alias.js b/tests/tests/src/gpr_3852_alias.js deleted file mode 100644 index 37c7ce97db..0000000000 --- a/tests/tests/src/gpr_3852_alias.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let A; - -exports.A = A; -/* No side effect */ diff --git a/tests/tests/src/gpr_3852_alias.mjs b/tests/tests/src/gpr_3852_alias.mjs new file mode 100644 index 0000000000..f19fa334d7 --- /dev/null +++ b/tests/tests/src/gpr_3852_alias.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let A; + +export { + A, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3852_alias_reify.js b/tests/tests/src/gpr_3852_alias_reify.js deleted file mode 100644 index cd1305a2c7..0000000000 --- a/tests/tests/src/gpr_3852_alias_reify.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Gpr_3852_effect = require("./gpr_3852_effect.js"); - -let A = Gpr_3852_effect; - -exports.A = A; -/* Gpr_3852_effect Not a pure module */ diff --git a/tests/tests/src/gpr_3852_alias_reify.mjs b/tests/tests/src/gpr_3852_alias_reify.mjs new file mode 100644 index 0000000000..8a4c7ecb10 --- /dev/null +++ b/tests/tests/src/gpr_3852_alias_reify.mjs @@ -0,0 +1,10 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Gpr_3852_effect from "./gpr_3852_effect.mjs"; + +let A = Gpr_3852_effect; + +export { + A, +} +/* Gpr_3852_effect Not a pure module */ diff --git a/tests/tests/src/gpr_3852_effect.js b/tests/tests/src/gpr_3852_effect.js deleted file mode 100644 index 5ff5e0c92e..0000000000 --- a/tests/tests/src/gpr_3852_effect.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log("hello"); - -let v = 0; - -exports.v = v; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3852_effect.mjs b/tests/tests/src/gpr_3852_effect.mjs new file mode 100644 index 0000000000..a21f2cec83 --- /dev/null +++ b/tests/tests/src/gpr_3852_effect.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log("hello"); + +let v = 0; + +export { + v, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3865.js b/tests/tests/src/gpr_3865.js deleted file mode 100644 index 332dd4de57..0000000000 --- a/tests/tests/src/gpr_3865.js +++ /dev/null @@ -1,17 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Gpr_3865_bar = require("./gpr_3865_bar.js"); -let Gpr_3865_foo = require("./gpr_3865_foo.js"); - -let B = Gpr_3865_bar.Make(Gpr_3865_foo); - -console.log(Gpr_3865_foo.$$return); - -console.log(B.$$return); - -let F; - -exports.F = F; -exports.B = B; -/* B Not a pure module */ diff --git a/tests/tests/src/gpr_3865.mjs b/tests/tests/src/gpr_3865.mjs new file mode 100644 index 0000000000..3c3bb62dad --- /dev/null +++ b/tests/tests/src/gpr_3865.mjs @@ -0,0 +1,18 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Gpr_3865_bar from "./gpr_3865_bar.mjs"; +import * as Gpr_3865_foo from "./gpr_3865_foo.mjs"; + +let B = Gpr_3865_bar.Make(Gpr_3865_foo); + +console.log(Gpr_3865_foo.$$return); + +console.log(B.$$return); + +let F; + +export { + F, + B, +} +/* B Not a pure module */ diff --git a/tests/tests/src/gpr_3865_bar.js b/tests/tests/src/gpr_3865_bar.js deleted file mode 100644 index c36cc825e9..0000000000 --- a/tests/tests/src/gpr_3865_bar.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function Make(M) { - return M; -} - -exports.Make = Make; -/* No side effect */ diff --git a/tests/tests/src/gpr_3865_bar.mjs b/tests/tests/src/gpr_3865_bar.mjs new file mode 100644 index 0000000000..68a2c4d8ef --- /dev/null +++ b/tests/tests/src/gpr_3865_bar.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function Make(M) { + return M; +} + +export { + Make, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3865_foo.js b/tests/tests/src/gpr_3865_foo.js deleted file mode 100644 index 4871e7aa37..0000000000 --- a/tests/tests/src/gpr_3865_foo.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let $$return = 5; - -exports.$$return = $$return; -/* No side effect */ diff --git a/tests/tests/src/gpr_3865_foo.mjs b/tests/tests/src/gpr_3865_foo.mjs new file mode 100644 index 0000000000..760820a7d5 --- /dev/null +++ b/tests/tests/src/gpr_3865_foo.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let $$return = 5; + +export { + $$return, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3875_test.js b/tests/tests/src/gpr_3875_test.js deleted file mode 100644 index 6dcd01cc61..0000000000 --- a/tests/tests/src/gpr_3875_test.js +++ /dev/null @@ -1,73 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let result = { - contents: "" -}; - -function log(x) { - result.contents = x; -} - -let Xx = { - log: log -}; - -function compilerBug(a, b, c, f) { - let exit = 0; - if (a !== "x") { - exit = 2; - } - if (exit === 2) { - if (b === undefined) { - if (c) { - result.contents = "No x, c is true"; - } else { - result.contents = "No x, c is false"; - } - return; - } - if (b !== "x") { - if (c) { - result.contents = "No x, c is true"; - } else { - result.contents = "No x, c is false"; - } - return; - } - - } - if (f()) { - result.contents = "Some x, f returns true"; - } else { - result.contents = "Some x, f returns false"; - } -} - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -compilerBug("x", undefined, true, () => true); - -eq("File \"gpr_3875_test.res\", line 35, characters 5-12", result.contents, "Some x, f returns true"); - -Mt.from_pair_suites("gpr_3875_test.res", suites.contents); - -exports.result = result; -exports.Xx = Xx; -exports.compilerBug = compilerBug; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3875_test.mjs b/tests/tests/src/gpr_3875_test.mjs new file mode 100644 index 0000000000..f0f0f434aa --- /dev/null +++ b/tests/tests/src/gpr_3875_test.mjs @@ -0,0 +1,74 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let result = { + contents: "" +}; + +function log(x) { + result.contents = x; +} + +let Xx = { + log: log +}; + +function compilerBug(a, b, c, f) { + let exit = 0; + if (a !== "x") { + exit = 2; + } + if (exit === 2) { + if (b === undefined) { + if (c) { + result.contents = "No x, c is true"; + } else { + result.contents = "No x, c is false"; + } + return; + } + if (b !== "x") { + if (c) { + result.contents = "No x, c is true"; + } else { + result.contents = "No x, c is false"; + } + return; + } + + } + if (f()) { + result.contents = "Some x, f returns true"; + } else { + result.contents = "Some x, f returns false"; + } +} + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +compilerBug("x", undefined, true, () => true); + +eq("File \"gpr_3875_test.res\", line 35, characters 5-12", result.contents, "Some x, f returns true"); + +Mt.from_pair_suites("gpr_3875_test.res", suites.contents); + +export { + result, + Xx, + compilerBug, + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3877_test.js b/tests/tests/src/gpr_3877_test.js deleted file mode 100644 index 27c66d7aef..0000000000 --- a/tests/tests/src/gpr_3877_test.js +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function test(code) { - if (code > 599 || code < 500) { - if (code === 201 || code === 200) { - return "good response"; - } else { - return "the catch all"; - } - } else if (code > 597 || code < 512) { - return "bad response"; - } else { - return "the catch all"; - } -} - -let a = "good response"; - -let b = "bad response"; - -if (a !== "good response") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3877_test.res", - 26, - 0 - ], - Error: new Error() - }; -} - -if (b !== "bad response") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3877_test.res", - 27, - 0 - ], - Error: new Error() - }; -} - -exports.test = test; -exports.a = a; -exports.b = b; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3877_test.mjs b/tests/tests/src/gpr_3877_test.mjs new file mode 100644 index 0000000000..66f0c8d4ff --- /dev/null +++ b/tests/tests/src/gpr_3877_test.mjs @@ -0,0 +1,51 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function test(code) { + if (code > 599 || code < 500) { + if (code === 201 || code === 200) { + return "good response"; + } else { + return "the catch all"; + } + } else if (code > 597 || code < 512) { + return "bad response"; + } else { + return "the catch all"; + } +} + +let a = "good response"; + +let b = "bad response"; + +if (a !== "good response") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 26, + 0 + ], + Error: new Error() + }; +} + +if (b !== "bad response") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3877_test.res", + 27, + 0 + ], + Error: new Error() + }; +} + +export { + test, + a, + b, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_3895_test.js b/tests/tests/src/gpr_3895_test.js deleted file mode 100644 index 6e01e4091e..0000000000 --- a/tests/tests/src/gpr_3895_test.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(re) { - re.exec("banana"); - return 3; -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_3895_test.mjs b/tests/tests/src/gpr_3895_test.mjs new file mode 100644 index 0000000000..002e342b1c --- /dev/null +++ b/tests/tests/src/gpr_3895_test.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(re) { + re.exec("banana"); + return 3; +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3897_test.js b/tests/tests/src/gpr_3897_test.js deleted file mode 100644 index d5f7e2fcca..0000000000 --- a/tests/tests/src/gpr_3897_test.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function Make(U) { - return U; -} - -exports.Make = Make; -/* No side effect */ diff --git a/tests/tests/src/gpr_3897_test.mjs b/tests/tests/src/gpr_3897_test.mjs new file mode 100644 index 0000000000..b64b18e493 --- /dev/null +++ b/tests/tests/src/gpr_3897_test.mjs @@ -0,0 +1,11 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function Make(U) { + return U; +} + +export { + Make, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_3931_test.js b/tests/tests/src/gpr_3931_test.js deleted file mode 100644 index 9abd2ec825..0000000000 --- a/tests/tests/src/gpr_3931_test.js +++ /dev/null @@ -1,66 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_module = require("rescript/lib/js/Primitive_module.js"); - -let PA = Primitive_module.init([ - "gpr_3931_test.res", - 3, - 4 -], { - TAG: "Module", - _0: [[ - "Function", - "print" - ]] -}); - -let P = Primitive_module.init([ - "gpr_3931_test.res", - 12, - 4 -], { - TAG: "Module", - _0: [[ - "Function", - "print" - ]] -}); - -function print(a) { - Belt_Array.forEach(a, P.print); -} - -Primitive_module.update({ - TAG: "Module", - _0: [[ - "Function", - "print" - ]] -}, PA, { - print: print -}); - -function print$1(i) { - console.log("%d", i); -} - -Primitive_module.update({ - TAG: "Module", - _0: [[ - "Function", - "print" - ]] -}, P, { - print: print$1 -}); - -PA.print([ - 1, - 2 -]); - -exports.PA = PA; -exports.P = P; -/* PA Not a pure module */ diff --git a/tests/tests/src/gpr_3931_test.mjs b/tests/tests/src/gpr_3931_test.mjs new file mode 100644 index 0000000000..551d06a19a --- /dev/null +++ b/tests/tests/src/gpr_3931_test.mjs @@ -0,0 +1,67 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_module from "rescript/lib/es6/Primitive_module.js"; + +let PA = Primitive_module.init([ + "gpr_3931_test.res", + 3, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "print" + ]] +}); + +let P = Primitive_module.init([ + "gpr_3931_test.res", + 12, + 4 +], { + TAG: "Module", + _0: [[ + "Function", + "print" + ]] +}); + +function print(a) { + Belt_Array.forEach(a, P.print); +} + +Primitive_module.update({ + TAG: "Module", + _0: [[ + "Function", + "print" + ]] +}, PA, { + print: print +}); + +function print$1(i) { + console.log("%d", i); +} + +Primitive_module.update({ + TAG: "Module", + _0: [[ + "Function", + "print" + ]] +}, P, { + print: print$1 +}); + +PA.print([ + 1, + 2 +]); + +export { + PA, + P, +} +/* PA Not a pure module */ diff --git a/tests/tests/src/gpr_3980_test.js b/tests/tests/src/gpr_3980_test.js deleted file mode 100644 index 9e092fc64f..0000000000 --- a/tests/tests/src/gpr_3980_test.js +++ /dev/null @@ -1,48 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Js_math = require("rescript/lib/js/Js_math.js"); - -let match = 1; - -if (match !== undefined) { - if (match !== 1) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 15, - 7 - ], - Error: new Error() - }; - } - let match$1 = 1; - if (match$1 !== 1) { - if (match$1 !== 2) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 13, - 9 - ], - Error: new Error() - }; - } - Js_math.floor(1); - } - -} else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_3980_test.res", - 15, - 7 - ], - Error: new Error() - }; -} - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_3980_test.mjs b/tests/tests/src/gpr_3980_test.mjs new file mode 100644 index 0000000000..6dacc59289 --- /dev/null +++ b/tests/tests/src/gpr_3980_test.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Js_math from "rescript/lib/es6/Js_math.js"; + +let match = 1; + +if (match !== undefined) { + if (match !== 1) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ], + Error: new Error() + }; + } + let match$1 = 1; + if (match$1 !== 1) { + if (match$1 !== 2) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 13, + 9 + ], + Error: new Error() + }; + } + Js_math.floor(1); + } + +} else { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_3980_test.res", + 15, + 7 + ], + Error: new Error() + }; +} + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4025_test.js b/tests/tests/src/gpr_4025_test.js deleted file mode 100644 index 009ab3fd39..0000000000 --- a/tests/tests/src/gpr_4025_test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -({})["hi"] = "hello"; - -console.log("hi"); - -function f(x) { - ({ - x: (console.log("hi"), x) - }).x = x + 1 | 0; -} - -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4025_test.mjs b/tests/tests/src/gpr_4025_test.mjs new file mode 100644 index 0000000000..5da59c6157 --- /dev/null +++ b/tests/tests/src/gpr_4025_test.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +({})["hi"] = "hello"; + +console.log("hi"); + +function f(x) { + ({ + x: (console.log("hi"), x) + }).x = x + 1 | 0; +} + +export { + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4069_test.js b/tests/tests/src/gpr_4069_test.js deleted file mode 100644 index 2bfd0e23e8..0000000000 --- a/tests/tests/src/gpr_4069_test.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(value) { - if (value == null) { - return; - } else { - return value; - } -} - -function fxx(v) { - let match = v(); - switch (match) { - case 1 : - return /* 'a' */97; - case 2 : - return /* 'b' */98; - case 3 : - return /* 'c' */99; - default: - return /* 'd' */100; - } -} - -function fxxx2(v) { - if (v()) { - return 2; - } else { - return 1; - } -} - -function fxxx3(v) { - if (v()) { - return 2; - } else { - return 1; - } -} - -exports.f = f; -exports.fxx = fxx; -exports.fxxx2 = fxxx2; -exports.fxxx3 = fxxx3; -/* No side effect */ diff --git a/tests/tests/src/gpr_4069_test.mjs b/tests/tests/src/gpr_4069_test.mjs new file mode 100644 index 0000000000..5f3ccfae9c --- /dev/null +++ b/tests/tests/src/gpr_4069_test.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(value) { + if (value == null) { + return; + } else { + return value; + } +} + +function fxx(v) { + let match = v(); + switch (match) { + case 1 : + return /* 'a' */97; + case 2 : + return /* 'b' */98; + case 3 : + return /* 'c' */99; + default: + return /* 'd' */100; + } +} + +function fxxx2(v) { + if (v()) { + return 2; + } else { + return 1; + } +} + +function fxxx3(v) { + if (v()) { + return 2; + } else { + return 1; + } +} + +export { + f, + fxx, + fxxx2, + fxxx3, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_4265_test.js b/tests/tests/src/gpr_4265_test.js deleted file mode 100644 index faba26bf99..0000000000 --- a/tests/tests/src/gpr_4265_test.js +++ /dev/null @@ -1,52 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_MutableMapInt = require("rescript/lib/js/Belt_MutableMapInt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let mockMap = Belt_MutableMapInt.make(); - -function add(id) { - Belt_MutableMapInt.set(mockMap, id, id); - return id; -} - -function remove(id) { - Belt_MutableMapInt.remove(mockMap, id); -} - -add(1726); - -let n = add(6667); - -add(486); - -Belt_MutableMapInt.remove(mockMap, 1726); - -let n1 = Belt_MutableMapInt.getExn(mockMap, 6667); - -eq("File \"gpr_4265_test.res\", line 18, characters 3-10", n, n1); - -Mt.from_pair_suites("gpr_4265_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.mockMap = mockMap; -exports.add = add; -exports.remove = remove; -exports.n = n; -exports.n1 = n1; -/* mockMap Not a pure module */ diff --git a/tests/tests/src/gpr_4265_test.mjs b/tests/tests/src/gpr_4265_test.mjs new file mode 100644 index 0000000000..2383420185 --- /dev/null +++ b/tests/tests/src/gpr_4265_test.mjs @@ -0,0 +1,53 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_MutableMapInt from "rescript/lib/es6/Belt_MutableMapInt.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let mockMap = Belt_MutableMapInt.make(); + +function add(id) { + Belt_MutableMapInt.set(mockMap, id, id); + return id; +} + +function remove(id) { + Belt_MutableMapInt.remove(mockMap, id); +} + +add(1726); + +let n = add(6667); + +add(486); + +Belt_MutableMapInt.remove(mockMap, 1726); + +let n1 = Belt_MutableMapInt.getExn(mockMap, 6667); + +eq("File \"gpr_4265_test.res\", line 18, characters 3-10", n, n1); + +Mt.from_pair_suites("gpr_4265_test.res", suites.contents); + +export { + suites, + test_id, + eq, + mockMap, + add, + remove, + n, + n1, +} +/* mockMap Not a pure module */ diff --git a/tests/tests/src/gpr_4274_test.js b/tests/tests/src/gpr_4274_test.js deleted file mode 100644 index f42ebb2d5c..0000000000 --- a/tests/tests/src/gpr_4274_test.js +++ /dev/null @@ -1,38 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); - -let N = {}; - -function f(X, xs) { - X.forEach(xs, { - i: x => { - console.log(x.x); - } - }); -} - -Belt_List.forEach({ - hd: { - x: 3 - }, - tl: /* [] */0 -}, x => { - console.log(x.x); -}); - -let Foo = {}; - -let bar = [{ - foo: "bar" - }]; - -Belt_Array.map(bar, b => b.foo); - -exports.N = N; -exports.f = f; -exports.Foo = Foo; -exports.bar = bar; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4274_test.mjs b/tests/tests/src/gpr_4274_test.mjs new file mode 100644 index 0000000000..9f7a387279 --- /dev/null +++ b/tests/tests/src/gpr_4274_test.mjs @@ -0,0 +1,39 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; + +let N = {}; + +function f(X, xs) { + X.forEach(xs, { + i: x => { + console.log(x.x); + } + }); +} + +Belt_List.forEach({ + hd: { + x: 3 + }, + tl: /* [] */0 +}, x => { + console.log(x.x); +}); + +let Foo = {}; + +let bar = [{ + foo: "bar" + }]; + +Belt_Array.map(bar, b => b.foo); + +export { + N, + f, + Foo, + bar, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4280_test.js b/tests/tests/src/gpr_4280_test.js deleted file mode 100644 index ace40e3643..0000000000 --- a/tests/tests/src/gpr_4280_test.js +++ /dev/null @@ -1,112 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let u = { - contents: 0 -}; - -function div(children, param) { - for (let i = 0; i <= 1; ++i) { - u.contents = 300; - console.log("nonline"); - } -} - -function string(s) { - for (let i = 0; i <= 1; ++i) { - u.contents = 200; - console.log("no"); - } -} - -function fn(authState, route) { - let onboardingRoute; - if (typeof authState === "object") { - let exit = 0; - if (typeof route === "object" && route.NAME === "Onboarding") { - onboardingRoute = route.VAL; - } else { - exit = 2; - } - if (exit === 2) { - console.log(authState.VAL); - div({ - hd: string("VerifyEmail"), - tl: /* [] */0 - }, undefined); - return 2; - } - - } else { - let exit$1 = 0; - if (typeof route === "object") { - if (route.NAME === "Onboarding") { - onboardingRoute = route.VAL; - } else { - exit$1 = 2; - } - } else { - if (route === "SignUp" || route === "SignIn" || route === "Invite" || route === "PasswordReset") { - div({ - hd: string("LoggedOut"), - tl: /* [] */0 - }, undefined); - return 1; - } - exit$1 = 2; - } - if (exit$1 === 2) { - div({ - hd: string("Redirect"), - tl: /* [] */0 - }, undefined); - return 3; - } - - } - console.log(onboardingRoute); - div({ - hd: string("Onboarding"), - tl: /* [] */0 - }, undefined); - return 0; -} - -eq("File \"gpr_4280_test.res\", line 42, characters 3-10", fn("Unauthenticated", "Invite"), 1); - -eq("File \"gpr_4280_test.res\", line 43, characters 3-10", fn("Unauthenticated", { - NAME: "Onboarding", - VAL: 0 -}), 0); - -eq("File \"gpr_4280_test.res\", line 44, characters 3-10", fn({ - NAME: "Unverified", - VAL: 0 -}, "Invite"), 2); - -eq("File \"gpr_4280_test.res\", line 45, characters 3-10", fn("Unauthenticated", "xx"), 3); - -Mt.from_pair_suites("gpr_4280_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.u = u; -exports.div = div; -exports.string = string; -exports.fn = fn; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4280_test.mjs b/tests/tests/src/gpr_4280_test.mjs new file mode 100644 index 0000000000..1ee814af0c --- /dev/null +++ b/tests/tests/src/gpr_4280_test.mjs @@ -0,0 +1,113 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let u = { + contents: 0 +}; + +function div(children, param) { + for (let i = 0; i <= 1; ++i) { + u.contents = 300; + console.log("nonline"); + } +} + +function string(s) { + for (let i = 0; i <= 1; ++i) { + u.contents = 200; + console.log("no"); + } +} + +function fn(authState, route) { + let onboardingRoute; + if (typeof authState === "object") { + let exit = 0; + if (typeof route === "object" && route.NAME === "Onboarding") { + onboardingRoute = route.VAL; + } else { + exit = 2; + } + if (exit === 2) { + console.log(authState.VAL); + div({ + hd: string("VerifyEmail"), + tl: /* [] */0 + }, undefined); + return 2; + } + + } else { + let exit$1 = 0; + if (typeof route === "object") { + if (route.NAME === "Onboarding") { + onboardingRoute = route.VAL; + } else { + exit$1 = 2; + } + } else { + if (route === "SignUp" || route === "SignIn" || route === "Invite" || route === "PasswordReset") { + div({ + hd: string("LoggedOut"), + tl: /* [] */0 + }, undefined); + return 1; + } + exit$1 = 2; + } + if (exit$1 === 2) { + div({ + hd: string("Redirect"), + tl: /* [] */0 + }, undefined); + return 3; + } + + } + console.log(onboardingRoute); + div({ + hd: string("Onboarding"), + tl: /* [] */0 + }, undefined); + return 0; +} + +eq("File \"gpr_4280_test.res\", line 42, characters 3-10", fn("Unauthenticated", "Invite"), 1); + +eq("File \"gpr_4280_test.res\", line 43, characters 3-10", fn("Unauthenticated", { + NAME: "Onboarding", + VAL: 0 +}), 0); + +eq("File \"gpr_4280_test.res\", line 44, characters 3-10", fn({ + NAME: "Unverified", + VAL: 0 +}, "Invite"), 2); + +eq("File \"gpr_4280_test.res\", line 45, characters 3-10", fn("Unauthenticated", "xx"), 3); + +Mt.from_pair_suites("gpr_4280_test.res", suites.contents); + +export { + suites, + test_id, + eq, + u, + div, + string, + fn, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4407_test.js b/tests/tests/src/gpr_4407_test.js deleted file mode 100644 index f2acc97937..0000000000 --- a/tests/tests/src/gpr_4407_test.js +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Debug_mode_value = require("./debug_mode_value.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let non_debug_u = { - TAG: "A", - _0: 1, - _1: 2 -}; - -eq("File \"gpr_4407_test.res\", line 7, characters 3-10", Debug_mode_value.u, non_debug_u); - -Mt.from_pair_suites("File \"gpr_4407_test.res\", line 8, characters 20-27", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.non_debug_u = non_debug_u; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4407_test.mjs b/tests/tests/src/gpr_4407_test.mjs new file mode 100644 index 0000000000..9769092d6c --- /dev/null +++ b/tests/tests/src/gpr_4407_test.mjs @@ -0,0 +1,34 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Debug_mode_value from "./debug_mode_value.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let non_debug_u = { + TAG: "A", + _0: 1, + _1: 2 +}; + +eq("File \"gpr_4407_test.res\", line 7, characters 3-10", Debug_mode_value.u, non_debug_u); + +Mt.from_pair_suites("File \"gpr_4407_test.res\", line 8, characters 20-27", suites.contents); + +export { + suites, + test_id, + eq, + non_debug_u, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_441.js b/tests/tests/src/gpr_441.mjs similarity index 100% rename from tests/tests/src/gpr_441.js rename to tests/tests/src/gpr_441.mjs diff --git a/tests/tests/src/gpr_4442_test.js b/tests/tests/src/gpr_4442_test.js deleted file mode 100644 index 3aed6757a0..0000000000 --- a/tests/tests/src/gpr_4442_test.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let u = (function fib(n){ - if(n===0||n==1){ - return 1 - } - return fib(n-1) + fib(n-2) -}); - -eq("File \"gpr_4442_test.res\", line 12, characters 3-10", u(2), 2); - -eq("File \"gpr_4442_test.res\", line 13, characters 3-10", u(3), 3); - -Mt.from_pair_suites("gpr_4442_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.u = u; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4442_test.mjs b/tests/tests/src/gpr_4442_test.mjs new file mode 100644 index 0000000000..a8e879ee62 --- /dev/null +++ b/tests/tests/src/gpr_4442_test.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let u = (function fib(n){ + if(n===0||n==1){ + return 1 + } + return fib(n-1) + fib(n-2) +}); + +eq("File \"gpr_4442_test.res\", line 12, characters 3-10", u(2), 2); + +eq("File \"gpr_4442_test.res\", line 13, characters 3-10", u(3), 3); + +Mt.from_pair_suites("gpr_4442_test.res", suites.contents); + +export { + suites, + test_id, + eq, + u, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4491_test.js b/tests/tests/src/gpr_4491_test.js deleted file mode 100644 index c36e8b60fd..0000000000 --- a/tests/tests/src/gpr_4491_test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(xs) { - if (xs !== undefined) { - console.log("side effect"); - - } else { - - } - console.log("nothing to see here", xs); -} - -exports.f = f; -/* No side effect */ diff --git a/tests/tests/src/gpr_4491_test.mjs b/tests/tests/src/gpr_4491_test.mjs new file mode 100644 index 0000000000..44a26abb85 --- /dev/null +++ b/tests/tests/src/gpr_4491_test.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(xs) { + if (xs !== undefined) { + console.log("side effect"); + + } else { + + } + console.log("nothing to see here", xs); +} + +export { + f, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_4494_test.js b/tests/tests/src/gpr_4494_test.mjs similarity index 100% rename from tests/tests/src/gpr_4494_test.js rename to tests/tests/src/gpr_4494_test.mjs diff --git a/tests/tests/src/gpr_4519_test.js b/tests/tests/src/gpr_4519_test.js deleted file mode 100644 index 108f0cc1ed..0000000000 --- a/tests/tests/src/gpr_4519_test.js +++ /dev/null @@ -1,38 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.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 nextFor(x) { - if (x !== undefined) { - if (x === "Required") { - return "Optional"; - } else { - return; - } - } else { - return "Required"; - } -} - -eq("File \"gpr_4519_test.res\", line 16, characters 3-10", nextFor("Required"), "Optional"); - -Mt.from_pair_suites("Gpr_4519_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.nextFor = nextFor; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4519_test.mjs b/tests/tests/src/gpr_4519_test.mjs new file mode 100644 index 0000000000..0ae150ce6b --- /dev/null +++ b/tests/tests/src/gpr_4519_test.mjs @@ -0,0 +1,39 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +function nextFor(x) { + if (x !== undefined) { + if (x === "Required") { + return "Optional"; + } else { + return; + } + } else { + return "Required"; + } +} + +eq("File \"gpr_4519_test.res\", line 16, characters 3-10", nextFor("Required"), "Optional"); + +Mt.from_pair_suites("Gpr_4519_test", suites.contents); + +export { + suites, + test_id, + eq, + nextFor, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_459_test.js b/tests/tests/src/gpr_459_test.js deleted file mode 100644 index 26b66b39e2..0000000000 --- a/tests/tests/src/gpr_459_test.js +++ /dev/null @@ -1,55 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -let uu = { - "_'x": 3 -}; - -let uu2 = { - _then: 1, - catch: 2, - "_'x": 3 -}; - -let hh = uu["_'x"]; - -eq("File \"gpr_459_test.res\", line 26, characters 12-19", hh, 3); - -eq("File \"gpr_459_test.res\", line 28, characters 12-19", [ - 1, - 2, - 3 -], [ - uu2._then, - uu2.catch, - uu2["_'x"] -]); - -Mt.from_pair_suites("Gpr_459_test", suites.contents); - -/* hh Not a pure module */ diff --git a/tests/tests/src/gpr_459_test.mjs b/tests/tests/src/gpr_459_test.mjs new file mode 100644 index 0000000000..561368ea42 --- /dev/null +++ b/tests/tests/src/gpr_459_test.mjs @@ -0,0 +1,54 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +let uu = { + "_'x": 3 +}; + +let uu2 = { + _then: 1, + catch: 2, + "_'x": 3 +}; + +let hh = uu["_'x"]; + +eq("File \"gpr_459_test.res\", line 26, characters 12-19", hh, 3); + +eq("File \"gpr_459_test.res\", line 28, characters 12-19", [ + 1, + 2, + 3 +], [ + uu2._then, + uu2.catch, + uu2["_'x"] +]); + +Mt.from_pair_suites("Gpr_459_test", suites.contents); + +/* hh Not a pure module */ diff --git a/tests/tests/src/gpr_4632.js b/tests/tests/src/gpr_4632.js deleted file mode 100644 index fa3f84ae3c..0000000000 --- a/tests/tests/src/gpr_4632.js +++ /dev/null @@ -1,36 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let T0_myList = { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } -}; - -let T0_tail = { - hd: 2, - tl: /* [] */0 -}; - -let T0 = { - myList: T0_myList, - head: 1, - tail: T0_tail -}; - -throw { - RE_EXN_ID: "Match_failure", - _1: [ - "gpr_4632.res", - 12, - 6 - ], - Error: new Error() -}; - -exports.T0 = T0; -exports.T1 = T1; -/* T1 Not a pure module */ diff --git a/tests/tests/src/gpr_4632.mjs b/tests/tests/src/gpr_4632.mjs new file mode 100644 index 0000000000..66dfe24aac --- /dev/null +++ b/tests/tests/src/gpr_4632.mjs @@ -0,0 +1,37 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let T0_myList = { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } +}; + +let T0_tail = { + hd: 2, + tl: /* [] */0 +}; + +let T0 = { + myList: T0_myList, + head: 1, + tail: T0_tail +}; + +throw { + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_4632.res", + 12, + 6 + ], + Error: new Error() +}; + +export { + T0, + T1, +} +/* T1 Not a pure module */ diff --git a/tests/tests/src/gpr_4639_test.js b/tests/tests/src/gpr_4639_test.js deleted file mode 100644 index 881fe37bf2..0000000000 --- a/tests/tests/src/gpr_4639_test.js +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function x(url) { - if (!url) { - return "start"; - } - switch (url.hd) { - case "login" : - if (url.tl) { - return "start"; - } else { - return "login"; - } - case "start" : - return "start"; - default: - return "start"; - } -} - -exports.x = x; -/* No side effect */ diff --git a/tests/tests/src/gpr_4639_test.mjs b/tests/tests/src/gpr_4639_test.mjs new file mode 100644 index 0000000000..6e281fb365 --- /dev/null +++ b/tests/tests/src/gpr_4639_test.mjs @@ -0,0 +1,25 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function x(url) { + if (!url) { + return "start"; + } + switch (url.hd) { + case "login" : + if (url.tl) { + return "start"; + } else { + return "login"; + } + case "start" : + return "start"; + default: + return "start"; + } +} + +export { + x, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_4900_test.js b/tests/tests/src/gpr_4900_test.js deleted file mode 100644 index 35fd666726..0000000000 --- a/tests/tests/src/gpr_4900_test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function showToJs(x) { - if (typeof x !== "object" && x === "No") { - return false; - } else { - return true; - } -} - -Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 13, characters 29-36", true, true); - -Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 14, characters 29-36", false, false); - -Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 15, characters 29-36", true, true); - -Mt.from_pair_suites("File \"gpr_4900_test.res\", line 17, characters 17-24", suites.contents); - -let from_pair_suites = Mt.from_pair_suites; - -let eq_suites = Mt.eq_suites; - -exports.from_pair_suites = from_pair_suites; -exports.eq_suites = eq_suites; -exports.suites = suites; -exports.test_id = test_id; -exports.showToJs = showToJs; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4900_test.mjs b/tests/tests/src/gpr_4900_test.mjs new file mode 100644 index 0000000000..5d3ef07f54 --- /dev/null +++ b/tests/tests/src/gpr_4900_test.mjs @@ -0,0 +1,40 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function showToJs(x) { + if (typeof x !== "object" && x === "No") { + return false; + } else { + return true; + } +} + +Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 13, characters 29-36", true, true); + +Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 14, characters 29-36", false, false); + +Mt.eq_suites(test_id, suites, "File \"gpr_4900_test.res\", line 15, characters 29-36", true, true); + +Mt.from_pair_suites("File \"gpr_4900_test.res\", line 17, characters 17-24", suites.contents); + +let from_pair_suites = Mt.from_pair_suites; + +let eq_suites = Mt.eq_suites; + +export { + from_pair_suites, + eq_suites, + suites, + test_id, + showToJs, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4924_test.js b/tests/tests/src/gpr_4924_test.js deleted file mode 100644 index ddb8218754..0000000000 --- a/tests/tests/src/gpr_4924_test.js +++ /dev/null @@ -1,93 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function u(b) { - if (typeof b !== "object" && b === "A") { - return 0; - } else { - return 1; - } -} - -function u1(b) { - if (typeof b !== "object" && b === "A") { - return true; - } else { - return false; - } -} - -function u2(b) { - if (typeof b !== "object" && b === "A") { - return false; - } else { - return true; - } -} - -Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 27, characters 29-36", false, false); - -Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 28, characters 29-36", true, true); - -Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 29, characters 29-36", true, true); - -function u3(b) { - if (typeof b !== "object" && b === "A") { - return 3; - } else { - return 4; - } -} - -function u4(b) { - if (typeof b !== "object" && b === "A") { - return 3; - } else { - return 4; - } -} - -function u5(b) { - if (typeof b !== "object" && b === "A") { - return false; - } else { - return true; - } -} - -function u6(b) { - if (typeof b !== "object" && b === "A") { - return true; - } else { - return false; - } -} - -Mt.from_pair_suites("File \"gpr_4924_test.res\", line 54, characters 17-24", suites.contents); - -let from_pair_suites = Mt.from_pair_suites; - -let eq_suites = Mt.eq_suites; - -exports.from_pair_suites = from_pair_suites; -exports.eq_suites = eq_suites; -exports.suites = suites; -exports.test_id = test_id; -exports.u = u; -exports.u1 = u1; -exports.u2 = u2; -exports.u3 = u3; -exports.u4 = u4; -exports.u5 = u5; -exports.u6 = u6; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4924_test.mjs b/tests/tests/src/gpr_4924_test.mjs new file mode 100644 index 0000000000..26cbb2f36e --- /dev/null +++ b/tests/tests/src/gpr_4924_test.mjs @@ -0,0 +1,94 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function u(b) { + if (typeof b !== "object" && b === "A") { + return 0; + } else { + return 1; + } +} + +function u1(b) { + if (typeof b !== "object" && b === "A") { + return true; + } else { + return false; + } +} + +function u2(b) { + if (typeof b !== "object" && b === "A") { + return false; + } else { + return true; + } +} + +Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 27, characters 29-36", false, false); + +Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 28, characters 29-36", true, true); + +Mt.eq_suites(test_id, suites, "File \"gpr_4924_test.res\", line 29, characters 29-36", true, true); + +function u3(b) { + if (typeof b !== "object" && b === "A") { + return 3; + } else { + return 4; + } +} + +function u4(b) { + if (typeof b !== "object" && b === "A") { + return 3; + } else { + return 4; + } +} + +function u5(b) { + if (typeof b !== "object" && b === "A") { + return false; + } else { + return true; + } +} + +function u6(b) { + if (typeof b !== "object" && b === "A") { + return true; + } else { + return false; + } +} + +Mt.from_pair_suites("File \"gpr_4924_test.res\", line 54, characters 17-24", suites.contents); + +let from_pair_suites = Mt.from_pair_suites; + +let eq_suites = Mt.eq_suites; + +export { + from_pair_suites, + eq_suites, + suites, + test_id, + u, + u1, + u2, + u3, + u4, + u5, + u6, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_4931.js b/tests/tests/src/gpr_4931.js deleted file mode 100644 index 3a4a16ec2b..0000000000 --- a/tests/tests/src/gpr_4931.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -if (import.meta.hot){ - console.log('es6') -} -; - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_4931.mjs b/tests/tests/src/gpr_4931.mjs new file mode 100644 index 0000000000..eaf96fb94e --- /dev/null +++ b/tests/tests/src/gpr_4931.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +if (import.meta.hot){ + console.log('es6') +} +; + +/* Not a pure module */ diff --git a/tests/tests_esmodule/src/gpr_4931_allow.mjs b/tests/tests/src/gpr_4931_allow.mjs similarity index 100% rename from tests/tests_esmodule/src/gpr_4931_allow.mjs rename to tests/tests/src/gpr_4931_allow.mjs diff --git a/tests/tests_esmodule/src/gpr_4931_allow.res b/tests/tests/src/gpr_4931_allow.res similarity index 100% rename from tests/tests_esmodule/src/gpr_4931_allow.res rename to tests/tests/src/gpr_4931_allow.res diff --git a/tests/tests/src/gpr_5071_test.js b/tests/tests/src/gpr_5071_test.js deleted file mode 100644 index b0236606ef..0000000000 --- a/tests/tests/src/gpr_5071_test.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function make(s) { - if (s !== undefined) { - return s; - } else { - return null; - } -} - -let H = { - make: make -}; - -exports.H = H; -/* No side effect */ diff --git a/tests/tests/src/gpr_5071_test.mjs b/tests/tests/src/gpr_5071_test.mjs new file mode 100644 index 0000000000..5e390c146c --- /dev/null +++ b/tests/tests/src/gpr_5071_test.mjs @@ -0,0 +1,19 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function make(s) { + if (s !== undefined) { + return s; + } else { + return null; + } +} + +let H = { + make: make +}; + +export { + H, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_5169_test.js b/tests/tests/src/gpr_5169_test.js deleted file mode 100644 index 68e20efdaf..0000000000 --- a/tests/tests/src/gpr_5169_test.js +++ /dev/null @@ -1,56 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let NotOption = {}; - -let TotallyNotOption = {}; - -let NotOption2 = {}; - -let a; - -let b = 1; - -let c; - -let d = 1; - -let e; - -let f = 1; - -let g; - -let h = 1; - -let i = "None"; - -let j = { - TAG: "Some", - _0: 1 -}; - -let k = "None"; - -let l = { - TAG: "Some", - _0: 1 -}; - -exports.NotOption = NotOption; -exports.a = a; -exports.b = b; -exports.c = c; -exports.d = d; -exports.TotallyNotOption = TotallyNotOption; -exports.e = e; -exports.f = f; -exports.g = g; -exports.h = h; -exports.NotOption2 = NotOption2; -exports.i = i; -exports.j = j; -exports.k = k; -exports.l = l; -/* No side effect */ diff --git a/tests/tests/src/gpr_5169_test.mjs b/tests/tests/src/gpr_5169_test.mjs new file mode 100644 index 0000000000..a6a1e3c8ac --- /dev/null +++ b/tests/tests/src/gpr_5169_test.mjs @@ -0,0 +1,57 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let NotOption = {}; + +let TotallyNotOption = {}; + +let NotOption2 = {}; + +let a; + +let b = 1; + +let c; + +let d = 1; + +let e; + +let f = 1; + +let g; + +let h = 1; + +let i = "None"; + +let j = { + TAG: "Some", + _0: 1 +}; + +let k = "None"; + +let l = { + TAG: "Some", + _0: 1 +}; + +export { + NotOption, + a, + b, + c, + d, + TotallyNotOption, + e, + f, + g, + h, + NotOption2, + i, + j, + k, + l, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_5218_test.js b/tests/tests/src/gpr_5218_test.js deleted file mode 100644 index 98cb8e6eb6..0000000000 --- a/tests/tests/src/gpr_5218_test.js +++ /dev/null @@ -1,52 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let test_id = { - contents: 0 -}; - -let suites = { - contents: /* [] */0 -}; - -function test(x) { - if (x.NAME === 2) { - return { - NAME: 2, - VAL: x.VAL - }; - } else { - return { - NAME: 1, - VAL: x.VAL - }; - } -} - -Mt.eq_suites(test_id, suites, "File \"gpr_5218_test.res\", line 11, characters 29-36", test({ - NAME: 1, - VAL: 3 -}), { - NAME: 1, - VAL: 3 -}); - -Mt.eq_suites(test_id, suites, "File \"gpr_5218_test.res\", line 13, characters 29-36", test({ - NAME: 2, - VAL: 3 -}), { - NAME: 2, - VAL: 3 -}); - -Mt.from_pair_suites("gpr_5218_test.res", suites.contents); - -let eq_suites = Mt.eq_suites; - -exports.eq_suites = eq_suites; -exports.test_id = test_id; -exports.suites = suites; -exports.test = test; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_5218_test.mjs b/tests/tests/src/gpr_5218_test.mjs new file mode 100644 index 0000000000..a8ab04cbc6 --- /dev/null +++ b/tests/tests/src/gpr_5218_test.mjs @@ -0,0 +1,53 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let test_id = { + contents: 0 +}; + +let suites = { + contents: /* [] */0 +}; + +function test(x) { + if (x.NAME === 2) { + return { + NAME: 2, + VAL: x.VAL + }; + } else { + return { + NAME: 1, + VAL: x.VAL + }; + } +} + +Mt.eq_suites(test_id, suites, "File \"gpr_5218_test.res\", line 11, characters 29-36", test({ + NAME: 1, + VAL: 3 +}), { + NAME: 1, + VAL: 3 +}); + +Mt.eq_suites(test_id, suites, "File \"gpr_5218_test.res\", line 13, characters 29-36", test({ + NAME: 2, + VAL: 3 +}), { + NAME: 2, + VAL: 3 +}); + +Mt.from_pair_suites("gpr_5218_test.res", suites.contents); + +let eq_suites = Mt.eq_suites; + +export { + eq_suites, + test_id, + suites, + test, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_5280_optimize_test.js b/tests/tests/src/gpr_5280_optimize_test.js deleted file mode 100644 index 47f58f76b4..0000000000 --- a/tests/tests/src/gpr_5280_optimize_test.js +++ /dev/null @@ -1,16 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let a = { - TAG: "Color", - _0: "#ffff" -}; - -let c; - -c = typeof a !== "object" ? "orange" : "white"; - -exports.a = a; -exports.c = c; -/* c Not a pure module */ diff --git a/tests/tests/src/gpr_5280_optimize_test.mjs b/tests/tests/src/gpr_5280_optimize_test.mjs new file mode 100644 index 0000000000..d9b2adb7ef --- /dev/null +++ b/tests/tests/src/gpr_5280_optimize_test.mjs @@ -0,0 +1,17 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let a = { + TAG: "Color", + _0: "#ffff" +}; + +let c; + +c = typeof a !== "object" ? "orange" : "white"; + +export { + a, + c, +} +/* c Not a pure module */ diff --git a/tests/tests/src/gpr_5557.js b/tests/tests/src/gpr_5557.js deleted file mode 100644 index 54715699d9..0000000000 --- a/tests/tests/src/gpr_5557.js +++ /dev/null @@ -1,24 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function isA(c) { - if (c === 97) { - return true; - } - throw { - RE_EXN_ID: "Match_failure", - _1: [ - "gpr_5557.res", - 5, - 2 - ], - Error: new Error() - }; -} - -let h = /* 'a' */97; - -exports.isA = isA; -exports.h = h; -/* No side effect */ diff --git a/tests/tests/src/gpr_5557.mjs b/tests/tests/src/gpr_5557.mjs new file mode 100644 index 0000000000..9f2a08e9b2 --- /dev/null +++ b/tests/tests/src/gpr_5557.mjs @@ -0,0 +1,25 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function isA(c) { + if (c === 97) { + return true; + } + throw { + RE_EXN_ID: "Match_failure", + _1: [ + "gpr_5557.res", + 5, + 2 + ], + Error: new Error() + }; +} + +let h = /* 'a' */97; + +export { + isA, + h, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_5753.js b/tests/tests/src/gpr_5753.js deleted file mode 100644 index 1c02f17ab4..0000000000 --- a/tests/tests/src/gpr_5753.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log(/* '文' */25991); - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_5753.mjs b/tests/tests/src/gpr_5753.mjs new file mode 100644 index 0000000000..fb7f666a90 --- /dev/null +++ b/tests/tests/src/gpr_5753.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log(/* '文' */25991); + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_658.js b/tests/tests/src/gpr_658.mjs similarity index 100% rename from tests/tests/src/gpr_658.js rename to tests/tests/src/gpr_658.mjs diff --git a/tests/tests/src/gpr_7012_test.js b/tests/tests/src/gpr_7012_test.js deleted file mode 100644 index e3e17b7d56..0000000000 --- a/tests/tests/src/gpr_7012_test.js +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f1() { - return () => ({ - a: 1, - b: 2 - }); -} - -function f2() { - return { - a: 1, - b: 2 - }; -} - -exports.f1 = f1; -exports.f2 = f2; -/* No side effect */ diff --git a/tests/tests/src/gpr_7012_test.mjs b/tests/tests/src/gpr_7012_test.mjs new file mode 100644 index 0000000000..b907f7ca40 --- /dev/null +++ b/tests/tests/src/gpr_7012_test.mjs @@ -0,0 +1,22 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f1() { + return () => ({ + a: 1, + b: 2 + }); +} + +function f2() { + return { + a: 1, + b: 2 + }; +} + +export { + f1, + f2, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_858_test.js b/tests/tests/src/gpr_858_test.js deleted file mode 100644 index 6d77cc2118..0000000000 --- a/tests/tests/src/gpr_858_test.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let direct = { - contents: /* [] */0 -}; - -let indirect = { - contents: /* [] */0 -}; - -exports.direct = direct; -exports.indirect = indirect; -/* No side effect */ diff --git a/tests/tests/src/gpr_858_test.mjs b/tests/tests/src/gpr_858_test.mjs new file mode 100644 index 0000000000..fb109c0ddb --- /dev/null +++ b/tests/tests/src/gpr_858_test.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let direct = { + contents: /* [] */0 +}; + +let indirect = { + contents: /* [] */0 +}; + +export { + direct, + indirect, +} +/* No side effect */ diff --git a/tests/tests/src/gpr_858_unit2_test.js b/tests/tests/src/gpr_858_unit2_test.js deleted file mode 100644 index 4ca3b4244e..0000000000 --- a/tests/tests/src/gpr_858_unit2_test.js +++ /dev/null @@ -1,37 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let delayed = { - contents: () => {} -}; - -for (let i = 1; i <= 2; ++i) { - let f = (n, x) => { - if (x !== 0) { - let prev = delayed.contents; - delayed.contents = () => { - prev(); - f(((n + 1 | 0) + i | 0) - i | 0, x - 1 | 0); - }; - return; - } - if (i === n) { - return; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_858_unit2_test.res", - 6, - 13 - ], - Error: new Error() - }; - }; - f(0, i); -} - -delayed.contents(); - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_858_unit2_test.mjs b/tests/tests/src/gpr_858_unit2_test.mjs new file mode 100644 index 0000000000..dddf174039 --- /dev/null +++ b/tests/tests/src/gpr_858_unit2_test.mjs @@ -0,0 +1,36 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let delayed = { + contents: () => {} +}; + +for (let i = 1; i <= 2; ++i) { + let f = (n, x) => { + if (x !== 0) { + let prev = delayed.contents; + delayed.contents = () => { + prev(); + f(((n + 1 | 0) + i | 0) - i | 0, x - 1 | 0); + }; + return; + } + if (i === n) { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_858_unit2_test.res", + 6, + 13 + ], + Error: new Error() + }; + }; + f(0, i); +} + +delayed.contents(); + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_904_test.js b/tests/tests/src/gpr_904_test.js deleted file mode 100644 index fab6f9fcb6..0000000000 --- a/tests/tests/src/gpr_904_test.js +++ /dev/null @@ -1,68 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function check_healty(check) { - if (!check.a && !check.b) { - return !check.c; - } else { - return false; - } -} - -function basic_not(x) { - return !x; -} - -function f(check) { - if (check.x) { - return check.y; - } else { - return false; - } -} - -eq("File \"gpr_904_test.res\", line 19, characters 12-19", f({ - x: true, - y: false -}), false); - -eq("File \"gpr_904_test.res\", line 21, characters 12-19", check_healty({ - a: false, - b: false, - c: true -}), false); - -Mt.from_pair_suites("Gpr_904_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.check_healty = check_healty; -exports.basic_not = basic_not; -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/gpr_904_test.mjs b/tests/tests/src/gpr_904_test.mjs new file mode 100644 index 0000000000..56e3de6096 --- /dev/null +++ b/tests/tests/src/gpr_904_test.mjs @@ -0,0 +1,69 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function check_healty(check) { + if (!check.a && !check.b) { + return !check.c; + } else { + return false; + } +} + +function basic_not(x) { + return !x; +} + +function f(check) { + if (check.x) { + return check.y; + } else { + return false; + } +} + +eq("File \"gpr_904_test.res\", line 19, characters 12-19", f({ + x: true, + y: false +}), false); + +eq("File \"gpr_904_test.res\", line 21, characters 12-19", check_healty({ + a: false, + b: false, + c: true +}), false); + +Mt.from_pair_suites("Gpr_904_test", suites.contents); + +export { + suites, + test_id, + eq, + check_healty, + basic_not, + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/gpr_974_test.js b/tests/tests/src/gpr_974_test.js deleted file mode 100644 index 50246afe80..0000000000 --- a/tests/tests/src/gpr_974_test.js +++ /dev/null @@ -1,43 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -if (!Primitive_object.equal(Primitive_option.fromNullable(""), "")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 2, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Primitive_option.fromUndefined(""), "")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 3, - 2 - ], - Error: new Error() - }; -} - -if (!Primitive_object.equal(Primitive_option.fromNull(""), "")) { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "gpr_974_test.res", - 4, - 2 - ], - Error: new Error() - }; -} - -/* Not a pure module */ diff --git a/tests/tests/src/gpr_974_test.mjs b/tests/tests/src/gpr_974_test.mjs new file mode 100644 index 0000000000..b3db25c414 --- /dev/null +++ b/tests/tests/src/gpr_974_test.mjs @@ -0,0 +1,42 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +if (!Primitive_object.equal(Primitive_option.fromNullable(""), "")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 2, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Primitive_option.fromUndefined(""), "")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 3, + 2 + ], + Error: new Error() + }; +} + +if (!Primitive_object.equal(Primitive_option.fromNull(""), "")) { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "gpr_974_test.res", + 4, + 2 + ], + Error: new Error() + }; +} + +/* Not a pure module */ diff --git a/tests/tests/src/gpr_977_test.js b/tests/tests/src/gpr_977_test.js deleted file mode 100644 index dfbbb13700..0000000000 --- a/tests/tests/src/gpr_977_test.js +++ /dev/null @@ -1,50 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f(x) { - for (let i = 0; i <= 100; ++i) { - console.log("."); - } - return -x | 0; -} - -let u = f(-2147483648); - -eq("File \"gpr_977_test.res\", line 23, characters 5-12", -2147483648, u); - -Mt.from_pair_suites("Gpr_977_test", suites.contents); - -let min_32_int = -2147483648; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.min_32_int = min_32_int; -exports.u = u; -/* u Not a pure module */ diff --git a/tests/tests/src/gpr_977_test.mjs b/tests/tests/src/gpr_977_test.mjs new file mode 100644 index 0000000000..dcc92c8134 --- /dev/null +++ b/tests/tests/src/gpr_977_test.mjs @@ -0,0 +1,51 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f(x) { + for (let i = 0; i <= 100; ++i) { + console.log("."); + } + return -x | 0; +} + +let u = f(-2147483648); + +eq("File \"gpr_977_test.res\", line 23, characters 5-12", -2147483648, u); + +Mt.from_pair_suites("Gpr_977_test", suites.contents); + +let min_32_int = -2147483648; + +export { + suites, + test_id, + eq, + f, + min_32_int, + u, +} +/* u Not a pure module */ diff --git a/tests/tests/src/gpr_return_type_unused_attribute.js b/tests/tests/src/gpr_return_type_unused_attribute.js deleted file mode 100644 index 389cfde1b9..0000000000 --- a/tests/tests/src/gpr_return_type_unused_attribute.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let v = mk(2); - -exports.v = v; -/* v Not a pure module */ diff --git a/tests/tests/src/gpr_return_type_unused_attribute.mjs b/tests/tests/src/gpr_return_type_unused_attribute.mjs new file mode 100644 index 0000000000..b4933befa4 --- /dev/null +++ b/tests/tests/src/gpr_return_type_unused_attribute.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let v = mk(2); + +export { + v, +} +/* v Not a pure module */ diff --git a/tests/tests/src/gray_code_test.js b/tests/tests/src/gray_code_test.js deleted file mode 100644 index a07c7bb844..0000000000 --- a/tests/tests/src/gray_code_test.js +++ /dev/null @@ -1,37 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function gray_encode(b) { - return b ^ (b >>> 1); -} - -function gray_decode(n) { - let _p = n; - let _n = (n >>> 1); - while (true) { - let n$1 = _n; - let p = _p; - if (n$1 === 0) { - return p; - } - _n = (n$1 >>> 1); - _p = p ^ n$1; - continue; - }; -} - -function next_power(v) { - let v$1 = v - 1 | 0; - let v$2 = (v$1 >>> 1) | v$1; - let v$3 = (v$2 >>> 2) | v$2; - let v$4 = (v$3 >>> 4) | v$3; - let v$5 = (v$4 >>> 8) | v$4; - let v$6 = (v$5 >>> 16) | v$5; - return v$6 + 1 | 0; -} - -exports.gray_encode = gray_encode; -exports.gray_decode = gray_decode; -exports.next_power = next_power; -/* No side effect */ diff --git a/tests/tests/src/gray_code_test.mjs b/tests/tests/src/gray_code_test.mjs new file mode 100644 index 0000000000..209409e41f --- /dev/null +++ b/tests/tests/src/gray_code_test.mjs @@ -0,0 +1,38 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function gray_encode(b) { + return b ^ (b >>> 1); +} + +function gray_decode(n) { + let _p = n; + let _n = (n >>> 1); + while (true) { + let n$1 = _n; + let p = _p; + if (n$1 === 0) { + return p; + } + _n = (n$1 >>> 1); + _p = p ^ n$1; + continue; + }; +} + +function next_power(v) { + let v$1 = v - 1 | 0; + let v$2 = (v$1 >>> 1) | v$1; + let v$3 = (v$2 >>> 2) | v$2; + let v$4 = (v$3 >>> 4) | v$3; + let v$5 = (v$4 >>> 8) | v$4; + let v$6 = (v$5 >>> 16) | v$5; + return v$6 + 1 | 0; +} + +export { + gray_encode, + gray_decode, + next_power, +} +/* No side effect */ diff --git a/tests/tests/src/guide_for_ext.js b/tests/tests/src/guide_for_ext.js deleted file mode 100644 index 54cb1abb17..0000000000 --- a/tests/tests/src/guide_for_ext.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function mk() { - return { - text: 32, - label: "hel" - }; -} - -exports.mk = mk; -/* No side effect */ diff --git a/tests/tests/src/guide_for_ext.mjs b/tests/tests/src/guide_for_ext.mjs new file mode 100644 index 0000000000..9ed99e2913 --- /dev/null +++ b/tests/tests/src/guide_for_ext.mjs @@ -0,0 +1,14 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function mk() { + return { + text: 32, + label: "hel" + }; +} + +export { + mk, +} +/* No side effect */ diff --git a/tests/tests/src/hash_collision_test.js b/tests/tests/src/hash_collision_test.js deleted file mode 100644 index 4636497da7..0000000000 --- a/tests/tests/src/hash_collision_test.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.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 f0(x) { - if (x === "azdwbie") { - return 1; - } else { - return 0; - } -} - -function f1(x) { - if (x.NAME === "azdwbie") { - return x.VAL + 2 | 0; - } else { - return x.VAL + 1 | 0; - } -} - -let hi = [ - "Eric_Cooper", - "azdwbie" -]; - -eq("File \"hash_collision_test.res\", line 20, characters 3-10", 0, 0); - -eq("File \"hash_collision_test.res\", line 21, characters 3-10", 1, 1); - -eq("File \"hash_collision_test.res\", line 23, characters 3-10", f1({ - NAME: "Eric_Cooper", - VAL: -1 -}), 0); - -eq("File \"hash_collision_test.res\", line 25, characters 3-10", f1({ - NAME: "azdwbie", - VAL: -2 -}), 0); - -Mt.from_pair_suites("hash_collision_test.res", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f0 = f0; -exports.f1 = f1; -exports.hi = hi; -/* Not a pure module */ diff --git a/tests/tests/src/hash_collision_test.mjs b/tests/tests/src/hash_collision_test.mjs new file mode 100644 index 0000000000..2927bab38b --- /dev/null +++ b/tests/tests/src/hash_collision_test.mjs @@ -0,0 +1,62 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +function f0(x) { + if (x === "azdwbie") { + return 1; + } else { + return 0; + } +} + +function f1(x) { + if (x.NAME === "azdwbie") { + return x.VAL + 2 | 0; + } else { + return x.VAL + 1 | 0; + } +} + +let hi = [ + "Eric_Cooper", + "azdwbie" +]; + +eq("File \"hash_collision_test.res\", line 20, characters 3-10", 0, 0); + +eq("File \"hash_collision_test.res\", line 21, characters 3-10", 1, 1); + +eq("File \"hash_collision_test.res\", line 23, characters 3-10", f1({ + NAME: "Eric_Cooper", + VAL: -1 +}), 0); + +eq("File \"hash_collision_test.res\", line 25, characters 3-10", f1({ + NAME: "azdwbie", + VAL: -2 +}), 0); + +Mt.from_pair_suites("hash_collision_test.res", suites.contents); + +export { + suites, + test_id, + eq, + f0, + f1, + hi, +} +/* Not a pure module */ diff --git a/tests/tests/src/hash_sugar_desugar.js b/tests/tests/src/hash_sugar_desugar.js deleted file mode 100644 index 32667634e3..0000000000 --- a/tests/tests/src/hash_sugar_desugar.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function h1(u) { - return u.p; -} - -function h3(u) { - let f = u.hi; - return f(1, 2); -} - -function g5(u) { - u.hi = 3; -} - -function h5(u) { - u.hi = 3; -} - -function h6(u) { - return u.p; -} - -function h7(u) { - return u.m(1, 2); -} - -function h8(u) { - let f = u.hi; - return f(1, 2); -} - -function chain_g(h) { - return h.x.y.z; -} - -exports.h1 = h1; -exports.h3 = h3; -exports.g5 = g5; -exports.h5 = h5; -exports.h6 = h6; -exports.h7 = h7; -exports.h8 = h8; -exports.chain_g = chain_g; -/* No side effect */ diff --git a/tests/tests/src/hash_sugar_desugar.mjs b/tests/tests/src/hash_sugar_desugar.mjs new file mode 100644 index 0000000000..0dc563de05 --- /dev/null +++ b/tests/tests/src/hash_sugar_desugar.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function h1(u) { + return u.p; +} + +function h3(u) { + let f = u.hi; + return f(1, 2); +} + +function g5(u) { + u.hi = 3; +} + +function h5(u) { + u.hi = 3; +} + +function h6(u) { + return u.p; +} + +function h7(u) { + return u.m(1, 2); +} + +function h8(u) { + let f = u.hi; + return f(1, 2); +} + +function chain_g(h) { + return h.x.y.z; +} + +export { + h1, + h3, + g5, + h5, + h6, + h7, + h8, + chain_g, +} +/* No side effect */ diff --git a/tests/tests/src/hash_test.js b/tests/tests/src/hash_test.js deleted file mode 100644 index d0573d3860..0000000000 --- a/tests/tests/src/hash_test.js +++ /dev/null @@ -1,86 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Mt_global = require("./mt_global.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Ocaml_Hashtbl = require("./ocaml_compat/Ocaml_Hashtbl.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(f, x, y) { - Mt_global.collect_eq(test_id, suites, f, x, y); -} - -let test_strings = Belt_Array.init(32, i => String.fromCodePoint(i).repeat(i)); - -let test_strings_hash_results = [ - 0, - 904391063, - 889600889, - 929588010, - 596566298, - 365199070, - 448044845, - 311625091, - 681445541, - 634941451, - 82108334, - 17482990, - 491949228, - 696194769, - 711728152, - 594966620, - 820561748, - 958901713, - 102794744, - 378848504, - 349314368, - 114167579, - 71240932, - 110067399, - 280623927, - 323523937, - 310683234, - 178511779, - 585018975, - 544388424, - 1043872806, - 831138595 -]; - -function normalize(x) { - return x & 1073741823; -} - -function caml_hash(x) { - return Ocaml_Hashtbl.hash(x) & 1073741823; -} - -eq("File \"hash_test.res\", line 48, characters 12-19", Belt_Array.map(test_strings, caml_hash), test_strings_hash_results); - -eq("File \"hash_test.res\", line 50, characters 12-19", Ocaml_Hashtbl.hash(0) & 1073741823, 129913994); - -eq("File \"hash_test.res\", line 52, characters 12-19", Ocaml_Hashtbl.hash("x") & 1073741823, 780510073); - -eq("File \"hash_test.res\", line 54, characters 12-19", Ocaml_Hashtbl.hash("xy") & 1073741823, 194127723); - -Mt.from_pair_suites("Hash_test", suites.contents); - -let Hashtbl; - -exports.Hashtbl = Hashtbl; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.test_strings = test_strings; -exports.test_strings_hash_results = test_strings_hash_results; -exports.normalize = normalize; -exports.caml_hash = caml_hash; -/* test_strings Not a pure module */ diff --git a/tests/tests/src/hash_test.mjs b/tests/tests/src/hash_test.mjs new file mode 100644 index 0000000000..444e03b020 --- /dev/null +++ b/tests/tests/src/hash_test.mjs @@ -0,0 +1,87 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Mt_global from "./mt_global.mjs"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Ocaml_Hashtbl from "./ocaml_compat/Ocaml_Hashtbl.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(f, x, y) { + Mt_global.collect_eq(test_id, suites, f, x, y); +} + +let test_strings = Belt_Array.init(32, i => String.fromCodePoint(i).repeat(i)); + +let test_strings_hash_results = [ + 0, + 904391063, + 889600889, + 929588010, + 596566298, + 365199070, + 448044845, + 311625091, + 681445541, + 634941451, + 82108334, + 17482990, + 491949228, + 696194769, + 711728152, + 594966620, + 820561748, + 958901713, + 102794744, + 378848504, + 349314368, + 114167579, + 71240932, + 110067399, + 280623927, + 323523937, + 310683234, + 178511779, + 585018975, + 544388424, + 1043872806, + 831138595 +]; + +function normalize(x) { + return x & 1073741823; +} + +function caml_hash(x) { + return Ocaml_Hashtbl.hash(x) & 1073741823; +} + +eq("File \"hash_test.res\", line 48, characters 12-19", Belt_Array.map(test_strings, caml_hash), test_strings_hash_results); + +eq("File \"hash_test.res\", line 50, characters 12-19", Ocaml_Hashtbl.hash(0) & 1073741823, 129913994); + +eq("File \"hash_test.res\", line 52, characters 12-19", Ocaml_Hashtbl.hash("x") & 1073741823, 780510073); + +eq("File \"hash_test.res\", line 54, characters 12-19", Ocaml_Hashtbl.hash("xy") & 1073741823, 194127723); + +Mt.from_pair_suites("Hash_test", suites.contents); + +let Hashtbl; + +export { + Hashtbl, + suites, + test_id, + eq, + test_strings, + test_strings_hash_results, + normalize, + caml_hash, +} +/* test_strings Not a pure module */ diff --git a/tests/tests/src/hello.foo.js b/tests/tests/src/hello.foo.js deleted file mode 100644 index a9caeea8a9..0000000000 --- a/tests/tests/src/hello.foo.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log("Hello"); - -/* Not a pure module */ diff --git a/tests/tests/src/hello.foo.mjs b/tests/tests/src/hello.foo.mjs new file mode 100644 index 0000000000..51c799ff51 --- /dev/null +++ b/tests/tests/src/hello.foo.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log("Hello"); + +/* Not a pure module */ diff --git a/tests/tests/src/hello_res.js b/tests/tests/src/hello_res.js deleted file mode 100644 index 616a1593cb..0000000000 --- a/tests/tests/src/hello_res.js +++ /dev/null @@ -1,46 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_List = require("rescript/lib/js/Belt_List.js"); - -let b = Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -}); - -let a = b - 1 | 0; - -console.log("hello, res"); - -Belt_List.add(/* [] */0, Belt_List.length({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } -})); - -console.log(3); - -console.log([ - 3, - 1 -]); - -let to = 3; - -let downto = 1; - -exports.a = a; -exports.to = to; -exports.downto = downto; -/* b Not a pure module */ diff --git a/tests/tests/src/hello_res.mjs b/tests/tests/src/hello_res.mjs new file mode 100644 index 0000000000..a06084d525 --- /dev/null +++ b/tests/tests/src/hello_res.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; + +let b = Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +}); + +let a = b - 1 | 0; + +console.log("hello, res"); + +Belt_List.add(/* [] */0, Belt_List.length({ + hd: 1, + tl: { + hd: 2, + tl: { + hd: 3, + tl: /* [] */0 + } + } +})); + +console.log(3); + +console.log([ + 3, + 1 +]); + +let to = 3; + +let downto = 1; + +export { + a, + to, + downto, +} +/* b Not a pure module */ diff --git a/tests/tests/src/ignore_test.js b/tests/tests/src/ignore_test.js deleted file mode 100644 index 26b2a6a3d9..0000000000 --- a/tests/tests/src/ignore_test.js +++ /dev/null @@ -1,46 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function f(x) { - -} - -function ff(x) { - console.log(x); -} - -eq("File \"ignore_test.res\", line 16, characters 12-19", undefined, undefined); - -Mt.from_pair_suites("Ignore_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.f = f; -exports.ff = ff; -/* Not a pure module */ diff --git a/tests/tests/src/ignore_test.mjs b/tests/tests/src/ignore_test.mjs new file mode 100644 index 0000000000..af644d5d38 --- /dev/null +++ b/tests/tests/src/ignore_test.mjs @@ -0,0 +1,47 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function f(x) { + +} + +function ff(x) { + console.log(x); +} + +eq("File \"ignore_test.res\", line 16, characters 12-19", undefined, undefined); + +Mt.from_pair_suites("Ignore_test", suites.contents); + +export { + suites, + test_id, + eq, + f, + ff, +} +/* Not a pure module */ diff --git a/tests/tests/src/ignore_uncurry_attribute.js b/tests/tests/src/ignore_uncurry_attribute.js deleted file mode 100644 index 6ca125db40..0000000000 --- a/tests/tests/src/ignore_uncurry_attribute.js +++ /dev/null @@ -1,15 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function map1(prim0, prim1) { - return map(prim0, prim1); -} - -function map2(prim0, prim1) { - return map(prim0, prim1); -} - -exports.map1 = map1; -exports.map2 = map2; -/* No side effect */ diff --git a/tests/tests/src/ignore_uncurry_attribute.mjs b/tests/tests/src/ignore_uncurry_attribute.mjs new file mode 100644 index 0000000000..2aeae25082 --- /dev/null +++ b/tests/tests/src/ignore_uncurry_attribute.mjs @@ -0,0 +1,16 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function map1(prim0, prim1) { + return map(prim0, prim1); +} + +function map2(prim0, prim1) { + return map(prim0, prim1); +} + +export { + map1, + map2, +} +/* No side effect */ diff --git a/tests/tests/src/import2.js b/tests/tests/src/import2.js deleted file mode 100644 index 3f5a1f3bb1..0000000000 --- a/tests/tests/src/import2.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let A = require("a").default; - -let a = import("a").then(m => m.default); - -let b = A; - -exports.a = a; -exports.b = b; -/* a Not a pure module */ diff --git a/tests/tests/src/import2.mjs b/tests/tests/src/import2.mjs new file mode 100644 index 0000000000..6979d3dd4d --- /dev/null +++ b/tests/tests/src/import2.mjs @@ -0,0 +1,13 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import A from "a"; + +let a = import("a").then(m => m.default); + +let b = A; + +export { + a, + b, +} +/* a Not a pure module */ diff --git a/tests/tests/src/import_external.js b/tests/tests/src/import_external.js deleted file mode 100644 index 177183ade1..0000000000 --- a/tests/tests/src/import_external.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let f8 = import("a").then(m => m.default); - -let f9 = import("b").then(m => m.default); - -exports.f8 = f8; -exports.f9 = f9; -/* f8 Not a pure module */ diff --git a/tests/tests/src/import_external.mjs b/tests/tests/src/import_external.mjs new file mode 100644 index 0000000000..21c60fd678 --- /dev/null +++ b/tests/tests/src/import_external.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let f8 = import("a").then(m => m.default); + +let f9 = import("b").then(m => m.default); + +export { + f8, + f9, +} +/* f8 Not a pure module */ diff --git a/tests/tests/src/import_side_effect.js b/tests/tests/src/import_side_effect.js deleted file mode 100644 index afbe3337f7..0000000000 --- a/tests/tests/src/import_side_effect.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let a = import("./side_effect2.js").then(m => m.a); - -let M = await import("./side_effect.js"); - -exports.a = a; -exports.M = M; -/* M Not a pure module */ diff --git a/tests/tests/src/import_side_effect.mjs b/tests/tests/src/import_side_effect.mjs new file mode 100644 index 0000000000..64e2bbd213 --- /dev/null +++ b/tests/tests/src/import_side_effect.mjs @@ -0,0 +1,12 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let a = import("./side_effect2.mjs").then(m => m.a); + +let M = await import("./side_effect.mjs"); + +export { + a, + M, +} +/* M Not a pure module */ diff --git a/tests/tests/src/import_side_effect_free.js b/tests/tests/src/import_side_effect_free.js deleted file mode 100644 index 4df30a1a43..0000000000 --- a/tests/tests/src/import_side_effect_free.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let a = await import("./side_effect_free.js").then(m => m.a); - -exports.a = a; -/* a Not a pure module */ diff --git a/tests/tests/src/import_side_effect_free.mjs b/tests/tests/src/import_side_effect_free.mjs new file mode 100644 index 0000000000..ebaa5983e8 --- /dev/null +++ b/tests/tests/src/import_side_effect_free.mjs @@ -0,0 +1,9 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let a = await import("./side_effect_free.mjs").then(m => m.a); + +export { + a, +} +/* a Not a pure module */ diff --git a/tests/tests/src/include_side_effect.js b/tests/tests/src/include_side_effect.js deleted file mode 100644 index 63aed7ac46..0000000000 --- a/tests/tests/src/include_side_effect.js +++ /dev/null @@ -1,7 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Side_effect = require("./side_effect.js"); - - -/* Side_effect Not a pure module */ diff --git a/tests/tests/src/include_side_effect.mjs b/tests/tests/src/include_side_effect.mjs new file mode 100644 index 0000000000..8dba94d007 --- /dev/null +++ b/tests/tests/src/include_side_effect.mjs @@ -0,0 +1,6 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Side_effect from "./side_effect.mjs"; + + +/* Side_effect Not a pure module */ diff --git a/tests/tests/src/include_side_effect_free.js b/tests/tests/src/include_side_effect_free.mjs similarity index 100% rename from tests/tests/src/include_side_effect_free.js rename to tests/tests/src/include_side_effect_free.mjs diff --git a/tests/tests/src/incomplete_toplevel_test.js b/tests/tests/src/incomplete_toplevel_test.js deleted file mode 100644 index 0d65fa6c4d..0000000000 --- a/tests/tests/src/incomplete_toplevel_test.js +++ /dev/null @@ -1,26 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f() { - console.log("no inline"); - return [ - 1, - 2, - 3 - ]; -} - -let match = f(); - -let a = match[0]; - -let b = match[1]; - -let c = match[2]; - -exports.f = f; -exports.a = a; -exports.b = b; -exports.c = c; -/* match Not a pure module */ diff --git a/tests/tests/src/incomplete_toplevel_test.mjs b/tests/tests/src/incomplete_toplevel_test.mjs new file mode 100644 index 0000000000..50846e68e4 --- /dev/null +++ b/tests/tests/src/incomplete_toplevel_test.mjs @@ -0,0 +1,27 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f() { + console.log("no inline"); + return [ + 1, + 2, + 3 + ]; +} + +let match = f(); + +let a = match[0]; + +let b = match[1]; + +let c = match[2]; + +export { + f, + a, + b, + c, +} +/* match Not a pure module */ diff --git a/tests/tests/src/infer_type_test.js b/tests/tests/src/infer_type_test.js deleted file mode 100644 index 45b8ea9433..0000000000 --- a/tests/tests/src/infer_type_test.js +++ /dev/null @@ -1,30 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let hh = { - hi: 30, - lo: 20 -}; - -let v = { - hi: 32, - lo: 3 -}; - -let vv = { - hi: 3, - lo: 3, - width: 3 -}; - -let u = v.hi; - -let uu = v.width; - -exports.hh = hh; -exports.v = v; -exports.vv = vv; -exports.u = u; -exports.uu = uu; -/* Not a pure module */ diff --git a/tests/tests/src/infer_type_test.mjs b/tests/tests/src/infer_type_test.mjs new file mode 100644 index 0000000000..e69d1d8079 --- /dev/null +++ b/tests/tests/src/infer_type_test.mjs @@ -0,0 +1,31 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let hh = { + hi: 30, + lo: 20 +}; + +let v = { + hi: 32, + lo: 3 +}; + +let vv = { + hi: 3, + lo: 3, + width: 3 +}; + +let u = v.hi; + +let uu = v.width; + +export { + hh, + v, + vv, + u, + uu, +} +/* Not a pure module */ diff --git a/tests/tests/src/inline_condition_with_pattern_matching.js b/tests/tests/src/inline_condition_with_pattern_matching.js deleted file mode 100644 index 71d45b5669..0000000000 --- a/tests/tests/src/inline_condition_with_pattern_matching.js +++ /dev/null @@ -1,61 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let person1 = { - TAG: "Teacher", - age: 12345 -}; - -let message; - -if (person1.TAG === "Teacher") { - message = "b"; -} else { - let tmp = 12345; - message = typeof tmp !== "object" || tmp.TAG === "Vacations" ? "a" : "b"; -} - -let Test1 = { - person1: person1, - message: message -}; - -let person2 = { - TAG: "Teacher", - name: "Jane", - age: 12345 -}; - -let message$1; - -if (person2.TAG === "Teacher") { - message$1 = "Hello Jane."; -} else { - let name = "Jane"; - let match = person2.reportCard; - if (match.passing) { - message$1 = "Congrats " + name + ", nice GPA of " + match.gpa.toString() + " you got there!"; - } else { - let exit = 0; - let tmp$1 = 12345; - if (typeof tmp$1 !== "object") { - message$1 = tmp$1 === "Sick" ? "How are you feeling?" : "Good luck next semester " + name + "!"; - } else { - exit = 1; - } - if (exit === 1) { - message$1 = person2.reportCard.gpa !== 0.0 ? "Good luck next semester " + name + "!" : "Come back in " + (12345)._0.toString() + " days!"; - } - - } -} - -let Test2 = { - person2: person2, - message: message$1 -}; - -exports.Test1 = Test1; -exports.Test2 = Test2; -/* message Not a pure module */ diff --git a/tests/tests/src/inline_condition_with_pattern_matching.mjs b/tests/tests/src/inline_condition_with_pattern_matching.mjs new file mode 100644 index 0000000000..d2fd37d192 --- /dev/null +++ b/tests/tests/src/inline_condition_with_pattern_matching.mjs @@ -0,0 +1,62 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let person1 = { + TAG: "Teacher", + age: 12345 +}; + +let message; + +if (person1.TAG === "Teacher") { + message = "b"; +} else { + let tmp = 12345; + message = typeof tmp !== "object" || tmp.TAG === "Vacations" ? "a" : "b"; +} + +let Test1 = { + person1: person1, + message: message +}; + +let person2 = { + TAG: "Teacher", + name: "Jane", + age: 12345 +}; + +let message$1; + +if (person2.TAG === "Teacher") { + message$1 = "Hello Jane."; +} else { + let name = "Jane"; + let match = person2.reportCard; + if (match.passing) { + message$1 = "Congrats " + name + ", nice GPA of " + match.gpa.toString() + " you got there!"; + } else { + let exit = 0; + let tmp$1 = 12345; + if (typeof tmp$1 !== "object") { + message$1 = tmp$1 === "Sick" ? "How are you feeling?" : "Good luck next semester " + name + "!"; + } else { + exit = 1; + } + if (exit === 1) { + message$1 = person2.reportCard.gpa !== 0.0 ? "Good luck next semester " + name + "!" : "Come back in " + (12345)._0.toString() + " days!"; + } + + } +} + +let Test2 = { + person2: person2, + message: message$1 +}; + +export { + Test1, + Test2, +} +/* message Not a pure module */ diff --git a/tests/tests/src/inline_const.js b/tests/tests/src/inline_const.js deleted file mode 100644 index d5cd71d47f..0000000000 --- a/tests/tests/src/inline_const.js +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -let N = {}; - -let hh = "hellohello"; - -console.log([ - 3e-6, - 3e-6 -]); - -let x = true; - -function N1(funarg) { - return {}; -} - -let h = "hello"; - -exports.x = x; -exports.N = N; -exports.N1 = N1; -exports.h = h; -exports.hh = hh; -/* Not a pure module */ diff --git a/tests/tests/src/inline_const.mjs b/tests/tests/src/inline_const.mjs new file mode 100644 index 0000000000..af9a3b3253 --- /dev/null +++ b/tests/tests/src/inline_const.mjs @@ -0,0 +1,28 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +let N = {}; + +let hh = "hellohello"; + +console.log([ + 3e-6, + 3e-6 +]); + +let x = true; + +function N1(funarg) { + return {}; +} + +let h = "hello"; + +export { + x, + N, + N1, + h, + hh, +} +/* Not a pure module */ diff --git a/tests/tests/src/inline_const_test.js b/tests/tests/src/inline_const_test.js deleted file mode 100644 index a04ff5fd8d..0000000000 --- a/tests/tests/src/inline_const_test.js +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Inline_const = require("./inline_const.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let H = Inline_const.N1({}); - -let f = "hello"; - -let f1 = "a"; - -let f2 = "中文"; - -let f3 = "中文"; - -let f4 = "中文"; - -eq("File \"inline_const_test.res\", line 13, characters 5-12", f, "hello"); - -eq("File \"inline_const_test.res\", line 14, characters 5-12", f1, "a"); - -eq("File \"inline_const_test.res\", line 15, characters 5-12", f2, "中文"); - -eq("File \"inline_const_test.res\", line 16, characters 5-12", f3, "中文"); - -eq("File \"inline_const_test.res\", line 17, characters 5-12", f4, "中文"); - -eq("File \"inline_const_test.res\", line 18, characters 5-12", true, true); - -eq("File \"inline_const_test.res\", line 19, characters 5-12", 1, 1); - -eq("File \"inline_const_test.res\", line 20, characters 5-12", 3e-6, 0.000003); - -Mt.from_pair_suites("File \"inline_const_test.res\", line 23, characters 29-36", suites.contents); - -let f5 = true; - -let f6 = 1; - -let f7 = 3e-6; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.H = H; -exports.f = f; -exports.f1 = f1; -exports.f2 = f2; -exports.f3 = f3; -exports.f4 = f4; -exports.f5 = f5; -exports.f6 = f6; -exports.f7 = f7; -/* H Not a pure module */ diff --git a/tests/tests/src/inline_const_test.mjs b/tests/tests/src/inline_const_test.mjs new file mode 100644 index 0000000000..e5b3e28417 --- /dev/null +++ b/tests/tests/src/inline_const_test.mjs @@ -0,0 +1,68 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Inline_const from "./inline_const.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let H = Inline_const.N1({}); + +let f = "hello"; + +let f1 = "a"; + +let f2 = "中文"; + +let f3 = "中文"; + +let f4 = "中文"; + +eq("File \"inline_const_test.res\", line 13, characters 5-12", f, "hello"); + +eq("File \"inline_const_test.res\", line 14, characters 5-12", f1, "a"); + +eq("File \"inline_const_test.res\", line 15, characters 5-12", f2, "中文"); + +eq("File \"inline_const_test.res\", line 16, characters 5-12", f3, "中文"); + +eq("File \"inline_const_test.res\", line 17, characters 5-12", f4, "中文"); + +eq("File \"inline_const_test.res\", line 18, characters 5-12", true, true); + +eq("File \"inline_const_test.res\", line 19, characters 5-12", 1, 1); + +eq("File \"inline_const_test.res\", line 20, characters 5-12", 3e-6, 0.000003); + +Mt.from_pair_suites("File \"inline_const_test.res\", line 23, characters 29-36", suites.contents); + +let f5 = true; + +let f6 = 1; + +let f7 = 3e-6; + +export { + suites, + test_id, + eq, + H, + f, + f1, + f2, + f3, + f4, + f5, + f6, + f7, +} +/* H Not a pure module */ diff --git a/tests/tests/src/inline_edge_cases.js b/tests/tests/src/inline_edge_cases.js deleted file mode 100644 index 8631edf009..0000000000 --- a/tests/tests/src/inline_edge_cases.js +++ /dev/null @@ -1,51 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function test3(_n) { - while (true) { - let n = _n; - if (n === 0) { - return (n + 5 | 0) + 4 | 0; - } - _n = n - 1 | 0; - continue; - }; -} - -function test2(_n) { - while (true) { - let n = _n; - if (n === 0) { - return test3(n) + 3 | 0; - } - _n = n - 1 | 0; - continue; - }; -} - -function test0(_n) { - while (true) { - let n = _n; - if (n === 0) { - let _n$1 = n; - while (true) { - let n$1 = _n$1; - if (n$1 === 0) { - return test2(n$1) + 2 | 0; - } - _n$1 = n$1 - 1 | 0; - continue; - }; - } - _n = n - 1 | 0; - continue; - }; -} - -let v = test0(10); - -test0(10) + 2 | 0; - -exports.v = v; -/* v Not a pure module */ diff --git a/tests/tests/src/inline_edge_cases.mjs b/tests/tests/src/inline_edge_cases.mjs new file mode 100644 index 0000000000..90fa047806 --- /dev/null +++ b/tests/tests/src/inline_edge_cases.mjs @@ -0,0 +1,52 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function test3(_n) { + while (true) { + let n = _n; + if (n === 0) { + return (n + 5 | 0) + 4 | 0; + } + _n = n - 1 | 0; + continue; + }; +} + +function test2(_n) { + while (true) { + let n = _n; + if (n === 0) { + return test3(n) + 3 | 0; + } + _n = n - 1 | 0; + continue; + }; +} + +function test0(_n) { + while (true) { + let n = _n; + if (n === 0) { + let _n$1 = n; + while (true) { + let n$1 = _n$1; + if (n$1 === 0) { + return test2(n$1) + 2 | 0; + } + _n$1 = n$1 - 1 | 0; + continue; + }; + } + _n = n - 1 | 0; + continue; + }; +} + +let v = test0(10); + +test0(10) + 2 | 0; + +export { + v, +} +/* v Not a pure module */ diff --git a/tests/tests/src/inline_map2_test.js b/tests/tests/src/inline_map2_test.js deleted file mode 100644 index 3865139140..0000000000 --- a/tests/tests/src/inline_map2_test.js +++ /dev/null @@ -1,1966 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); -let Primitive_string = require("rescript/lib/js/Primitive_string.js"); - -function Make(Ord) { - let height = x => { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } - }; - let create = (l, x, d, r) => { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - }; - let singleton = (x, d) => ({ - TAG: "Node", - _0: "Empty", - _1: x, - _2: d, - _3: "Empty", - _4: 1 - }); - let bal = (l, x, d, r) => { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } else if (typeof lr !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } else if (typeof rl !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } - }; - let is_empty = x => { - if (typeof x !== "object") { - return true; - } else { - return false; - } - }; - let add = (x, data, x_) => { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Ord.compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: x_._4 - }; - } else if (c < 0) { - return bal(add(x, data, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, r)); - } - }; - let find = (x, _x_) => { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = Ord.compare(x, x_._1); - if (c === 0) { - return x_._2; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; - }; - let mem = (x, _x_) => { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - return false; - } - let c = Ord.compare(x, x_._1); - if (c === 0) { - return true; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; - }; - let min_binding = _x => { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let l = x._0; - if (typeof l !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = l; - continue; - }; - }; - let max_binding = _x => { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let r = x._3; - if (typeof r !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = r; - continue; - }; - }; - let remove_min_binding = x => { - if (typeof x !== "object") { - return Pervasives.invalid_arg("Map.remove_min_elt"); - } - let l = x._0; - if (typeof l !== "object") { - return x._3; - } else { - return bal(remove_min_binding(l), x._1, x._2, x._3); - } - }; - let remove = (x, x_) => { - if (typeof x_ !== "object") { - return "Empty"; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Ord.compare(x, v); - if (c === 0) { - if (typeof l !== "object") { - return r; - } - if (typeof r !== "object") { - return l; - } - let match = min_binding(r); - return bal(l, match[0], match[1], remove_min_binding(r)); - } else if (c < 0) { - return bal(remove(x, l), v, d, r); - } else { - return bal(l, v, d, remove(x, r)); - } - }; - let iter = (f, _x) => { - while (true) { - let x = _x; - if (typeof x !== "object") { - return; - } - iter(f, x._0); - f(x._1, x._2); - _x = x._3; - continue; - }; - }; - let map = (f, x) => { - if (typeof x !== "object") { - return "Empty"; - } - let l$p = map(f, x._0); - let d$p = f(x._2); - let r$p = map(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: x._1, - _2: d$p, - _3: r$p, - _4: x._4 - }; - }; - let mapi = (f, x) => { - if (typeof x !== "object") { - return "Empty"; - } - let v = x._1; - let l$p = mapi(f, x._0); - let d$p = f(v, x._2); - let r$p = mapi(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: v, - _2: d$p, - _3: r$p, - _4: x._4 - }; - }; - let fold = (f, _m, _accu) => { - while (true) { - let accu = _accu; - let m = _m; - if (typeof m !== "object") { - return accu; - } - _accu = f(m._1, m._2, fold(f, m._0, accu)); - _m = m._3; - continue; - }; - }; - let for_all = (p, _x) => { - while (true) { - let x = _x; - if (typeof x !== "object") { - return true; - } - if (!p(x._1, x._2)) { - return false; - } - if (!for_all(p, x._0)) { - return false; - } - _x = x._3; - continue; - }; - }; - let exists = (p, _x) => { - while (true) { - let x = _x; - if (typeof x !== "object") { - return false; - } - if (p(x._1, x._2)) { - return true; - } - if (exists(p, x._0)) { - return true; - } - _x = x._3; - continue; - }; - }; - let add_min_binding = (k, v, x) => { - if (typeof x !== "object") { - return singleton(k, v); - } else { - return bal(add_min_binding(k, v, x._0), x._1, x._2, x._3); - } - }; - let add_max_binding = (k, v, x) => { - if (typeof x !== "object") { - return singleton(k, v); - } else { - return bal(x._0, x._1, x._2, add_max_binding(k, v, x._3)); - } - }; - let join = (l, v, d, r) => { - if (typeof l !== "object") { - return add_min_binding(v, d, r); - } - let lh = l._4; - if (typeof r !== "object") { - return add_max_binding(v, d, l); - } - let rh = r._4; - if (lh > (rh + 2 | 0)) { - return bal(l._0, l._1, l._2, join(l._3, v, d, r)); - } else if (rh > (lh + 2 | 0)) { - return bal(join(l, v, d, r._0), r._1, r._2, r._3); - } else { - return create(l, v, d, r); - } - }; - let concat = (t1, t2) => { - if (typeof t1 !== "object") { - return t2; - } - if (typeof t2 !== "object") { - return t1; - } - let match = min_binding(t2); - return join(t1, match[0], match[1], remove_min_binding(t2)); - }; - let concat_or_join = (t1, v, d, t2) => { - if (d !== undefined) { - return join(t1, v, Primitive_option.valFromOption(d), t2); - } else { - return concat(t1, t2); - } - }; - let split = (x, x_) => { - if (typeof x_ !== "object") { - return [ - "Empty", - undefined, - "Empty" - ]; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Ord.compare(x, v); - if (c === 0) { - return [ - l, - Primitive_option.some(d), - r - ]; - } - if (c < 0) { - let match = split(x, l); - return [ - match[0], - match[1], - join(match[2], v, d, r) - ]; - } - let match$1 = split(x, r); - return [ - join(l, v, d, match$1[0]), - match$1[1], - match$1[2] - ]; - }; - let merge = (f, s1, s2) => { - if (typeof s1 !== "object") { - if (typeof s2 !== "object") { - return "Empty"; - } - - } else { - let v1 = s1._1; - if (s1._4 >= height(s2)) { - let match = split(v1, s2); - return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); - } - - } - if (typeof s2 !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ], - Error: new Error() - }; - } - let v2 = s2._1; - let match$1 = split(v2, s1); - return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge(f, match$1[2], s2._3)); - }; - let filter = (p, x) => { - if (typeof x !== "object") { - return "Empty"; - } - let d = x._2; - let v = x._1; - let l$p = filter(p, x._0); - let pvd = p(v, d); - let r$p = filter(p, x._3); - if (pvd) { - return join(l$p, v, d, r$p); - } else { - return concat(l$p, r$p); - } - }; - let partition = (p, x) => { - if (typeof x !== "object") { - return [ - "Empty", - "Empty" - ]; - } - let d = x._2; - let v = x._1; - let match = partition(p, x._0); - let lf = match[1]; - let lt = match[0]; - let pvd = p(v, d); - let match$1 = partition(p, x._3); - let rf = match$1[1]; - let rt = match$1[0]; - if (pvd) { - return [ - join(lt, v, d, rt), - concat(lf, rf) - ]; - } else { - return [ - concat(lt, rt), - join(lf, v, d, rf) - ]; - } - }; - let cons_enum = (_m, _e) => { - while (true) { - let e = _e; - let m = _m; - if (typeof m !== "object") { - return e; - } - _e = { - TAG: "More", - _0: m._1, - _1: m._2, - _2: m._3, - _3: e - }; - _m = m._0; - continue; - }; - }; - let compare = (cmp, m1, m2) => { - let _e1 = cons_enum(m1, "End"); - let _e2 = cons_enum(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return 0; - } else { - return -1; - } - } - if (typeof e2 !== "object") { - return 1; - } - let c = Ord.compare(e1._0, e2._0); - if (c !== 0) { - return c; - } - let c$1 = cmp(e1._1, e2._1); - if (c$1 !== 0) { - return c$1; - } - _e2 = cons_enum(e2._2, e2._3); - _e1 = cons_enum(e1._2, e1._3); - continue; - }; - }; - let equal = (cmp, m1, m2) => { - let _e1 = cons_enum(m1, "End"); - let _e2 = cons_enum(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return true; - } else { - return false; - } - } - if (typeof e2 !== "object") { - return false; - } - if (Ord.compare(e1._0, e2._0) !== 0) { - return false; - } - if (!cmp(e1._1, e2._1)) { - return false; - } - _e2 = cons_enum(e2._2, e2._3); - _e1 = cons_enum(e1._2, e1._3); - continue; - }; - }; - let cardinal = x => { - if (typeof x !== "object") { - return 0; - } else { - return (cardinal(x._0) + 1 | 0) + cardinal(x._3) | 0; - } - }; - let bindings_aux = (_accu, _x) => { - while (true) { - let x = _x; - let accu = _accu; - if (typeof x !== "object") { - return accu; - } - _x = x._0; - _accu = { - hd: [ - x._1, - x._2 - ], - tl: bindings_aux(accu, x._3) - }; - continue; - }; - }; - let bindings = s => bindings_aux(/* [] */0, s); - return { - height: height, - create: create, - singleton: singleton, - bal: bal, - empty: "Empty", - is_empty: is_empty, - add: add, - find: find, - mem: mem, - min_binding: min_binding, - max_binding: max_binding, - remove_min_binding: remove_min_binding, - remove: remove, - iter: iter, - map: map, - mapi: mapi, - fold: fold, - for_all: for_all, - exists: exists, - add_min_binding: add_min_binding, - add_max_binding: add_max_binding, - join: join, - concat: concat, - concat_or_join: concat_or_join, - split: split, - merge: merge, - filter: filter, - partition: partition, - cons_enum: cons_enum, - compare: compare, - equal: equal, - cardinal: cardinal, - bindings_aux: bindings_aux, - bindings: bindings, - choose: min_binding - }; -} - -function height(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } -} - -function create(l, x, d, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function singleton(x, d) { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: d, - _3: "Empty", - _4: 1 - }; -} - -function bal(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } else if (typeof lr !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } else if (typeof rl !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } -} - -function is_empty(x) { - if (typeof x !== "object") { - return true; - } else { - return false; - } -} - -function add(x, data, x_) { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_int.compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: x_._4 - }; - } else if (c < 0) { - return bal(add(x, data, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, r)); - } -} - -function find(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = Primitive_int.compare(x, x_._1); - if (c === 0) { - return x_._2; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; -} - -function mem(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - return false; - } - let c = Primitive_int.compare(x, x_._1); - if (c === 0) { - return true; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; -} - -function min_binding(_x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let l = x._0; - if (typeof l !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = l; - continue; - }; -} - -function max_binding(_x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let r = x._3; - if (typeof r !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = r; - continue; - }; -} - -function remove_min_binding(x) { - if (typeof x !== "object") { - return Pervasives.invalid_arg("Map.remove_min_elt"); - } - let l = x._0; - if (typeof l !== "object") { - return x._3; - } else { - return bal(remove_min_binding(l), x._1, x._2, x._3); - } -} - -function remove(x, x_) { - if (typeof x_ !== "object") { - return "Empty"; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_int.compare(x, v); - if (c === 0) { - if (typeof l !== "object") { - return r; - } - if (typeof r !== "object") { - return l; - } - let match = min_binding(r); - return bal(l, match[0], match[1], remove_min_binding(r)); - } else if (c < 0) { - return bal(remove(x, l), v, d, r); - } else { - return bal(l, v, d, remove(x, r)); - } -} - -function iter(f, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return; - } - iter(f, x._0); - f(x._1, x._2); - _x = x._3; - continue; - }; -} - -function map(f, x) { - if (typeof x !== "object") { - return "Empty"; - } - let l$p = map(f, x._0); - let d$p = f(x._2); - let r$p = map(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: x._1, - _2: d$p, - _3: r$p, - _4: x._4 - }; -} - -function mapi(f, x) { - if (typeof x !== "object") { - return "Empty"; - } - let v = x._1; - let l$p = mapi(f, x._0); - let d$p = f(v, x._2); - let r$p = mapi(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: v, - _2: d$p, - _3: r$p, - _4: x._4 - }; -} - -function fold(f, _m, _accu) { - while (true) { - let accu = _accu; - let m = _m; - if (typeof m !== "object") { - return accu; - } - _accu = f(m._1, m._2, fold(f, m._0, accu)); - _m = m._3; - continue; - }; -} - -function for_all(p, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return true; - } - if (!p(x._1, x._2)) { - return false; - } - if (!for_all(p, x._0)) { - return false; - } - _x = x._3; - continue; - }; -} - -function exists(p, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return false; - } - if (p(x._1, x._2)) { - return true; - } - if (exists(p, x._0)) { - return true; - } - _x = x._3; - continue; - }; -} - -function add_min_binding(k, v, x) { - if (typeof x !== "object") { - return singleton(k, v); - } else { - return bal(add_min_binding(k, v, x._0), x._1, x._2, x._3); - } -} - -function add_max_binding(k, v, x) { - if (typeof x !== "object") { - return singleton(k, v); - } else { - return bal(x._0, x._1, x._2, add_max_binding(k, v, x._3)); - } -} - -function join(l, v, d, r) { - if (typeof l !== "object") { - return add_min_binding(v, d, r); - } - let lh = l._4; - if (typeof r !== "object") { - return add_max_binding(v, d, l); - } - let rh = r._4; - if (lh > (rh + 2 | 0)) { - return bal(l._0, l._1, l._2, join(l._3, v, d, r)); - } else if (rh > (lh + 2 | 0)) { - return bal(join(l, v, d, r._0), r._1, r._2, r._3); - } else { - return create(l, v, d, r); - } -} - -function concat(t1, t2) { - if (typeof t1 !== "object") { - return t2; - } - if (typeof t2 !== "object") { - return t1; - } - let match = min_binding(t2); - return join(t1, match[0], match[1], remove_min_binding(t2)); -} - -function concat_or_join(t1, v, d, t2) { - if (d !== undefined) { - return join(t1, v, Primitive_option.valFromOption(d), t2); - } else { - return concat(t1, t2); - } -} - -function split(x, x_) { - if (typeof x_ !== "object") { - return [ - "Empty", - undefined, - "Empty" - ]; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_int.compare(x, v); - if (c === 0) { - return [ - l, - Primitive_option.some(d), - r - ]; - } - if (c < 0) { - let match = split(x, l); - return [ - match[0], - match[1], - join(match[2], v, d, r) - ]; - } - let match$1 = split(x, r); - return [ - join(l, v, d, match$1[0]), - match$1[1], - match$1[2] - ]; -} - -function merge(f, s1, s2) { - if (typeof s1 !== "object") { - if (typeof s2 !== "object") { - return "Empty"; - } - - } else { - let v1 = s1._1; - if (s1._4 >= height(s2)) { - let match = split(v1, s2); - return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); - } - - } - if (typeof s2 !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ], - Error: new Error() - }; - } - let v2 = s2._1; - let match$1 = split(v2, s1); - return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge(f, match$1[2], s2._3)); -} - -function filter(p, x) { - if (typeof x !== "object") { - return "Empty"; - } - let d = x._2; - let v = x._1; - let l$p = filter(p, x._0); - let pvd = p(v, d); - let r$p = filter(p, x._3); - if (pvd) { - return join(l$p, v, d, r$p); - } else { - return concat(l$p, r$p); - } -} - -function partition(p, x) { - if (typeof x !== "object") { - return [ - "Empty", - "Empty" - ]; - } - let d = x._2; - let v = x._1; - let match = partition(p, x._0); - let lf = match[1]; - let lt = match[0]; - let pvd = p(v, d); - let match$1 = partition(p, x._3); - let rf = match$1[1]; - let rt = match$1[0]; - if (pvd) { - return [ - join(lt, v, d, rt), - concat(lf, rf) - ]; - } else { - return [ - concat(lt, rt), - join(lf, v, d, rf) - ]; - } -} - -function cons_enum(_m, _e) { - while (true) { - let e = _e; - let m = _m; - if (typeof m !== "object") { - return e; - } - _e = { - TAG: "More", - _0: m._1, - _1: m._2, - _2: m._3, - _3: e - }; - _m = m._0; - continue; - }; -} - -function compare(cmp, m1, m2) { - let _e1 = cons_enum(m1, "End"); - let _e2 = cons_enum(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return 0; - } else { - return -1; - } - } - if (typeof e2 !== "object") { - return 1; - } - let c = Primitive_int.compare(e1._0, e2._0); - if (c !== 0) { - return c; - } - let c$1 = cmp(e1._1, e2._1); - if (c$1 !== 0) { - return c$1; - } - _e2 = cons_enum(e2._2, e2._3); - _e1 = cons_enum(e1._2, e1._3); - continue; - }; -} - -function equal(cmp, m1, m2) { - let _e1 = cons_enum(m1, "End"); - let _e2 = cons_enum(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return true; - } else { - return false; - } - } - if (typeof e2 !== "object") { - return false; - } - if (e1._0 !== e2._0) { - return false; - } - if (!cmp(e1._1, e2._1)) { - return false; - } - _e2 = cons_enum(e2._2, e2._3); - _e1 = cons_enum(e1._2, e1._3); - continue; - }; -} - -function cardinal(x) { - if (typeof x !== "object") { - return 0; - } else { - return (cardinal(x._0) + 1 | 0) + cardinal(x._3) | 0; - } -} - -function bindings_aux(_accu, _x) { - while (true) { - let x = _x; - let accu = _accu; - if (typeof x !== "object") { - return accu; - } - _x = x._0; - _accu = { - hd: [ - x._1, - x._2 - ], - tl: bindings_aux(accu, x._3) - }; - continue; - }; -} - -function bindings(s) { - return bindings_aux(/* [] */0, s); -} - -let IntMap = { - height: height, - create: create, - singleton: singleton, - bal: bal, - empty: "Empty", - is_empty: is_empty, - add: add, - find: find, - mem: mem, - min_binding: min_binding, - max_binding: max_binding, - remove_min_binding: remove_min_binding, - remove: remove, - iter: iter, - map: map, - mapi: mapi, - fold: fold, - for_all: for_all, - exists: exists, - add_min_binding: add_min_binding, - add_max_binding: add_max_binding, - join: join, - concat: concat, - concat_or_join: concat_or_join, - split: split, - merge: merge, - filter: filter, - partition: partition, - cons_enum: cons_enum, - compare: compare, - equal: equal, - cardinal: cardinal, - bindings_aux: bindings_aux, - bindings: bindings, - choose: min_binding -}; - -let m = Belt_List.reduceReverse({ - hd: [ - 10, - /* 'a' */97 - ], - tl: { - hd: [ - 3, - /* 'b' */98 - ], - tl: { - hd: [ - 7, - /* 'c' */99 - ], - tl: { - hd: [ - 20, - /* 'd' */100 - ], - tl: /* [] */0 - } - } - } -}, "Empty", (acc, param) => add(param[0], param[1], acc)); - -function height$1(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } -} - -function create$1(l, x, d, r) { - let hl = height$1(l); - let hr = height$1(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function singleton$1(x, d) { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: d, - _3: "Empty", - _4: 1 - }; -} - -function bal$1(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height$1(ll) >= height$1(lr)) { - return create$1(ll, lv, ld, create$1(lr, x, d, r)); - } else if (typeof lr !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create$1(create$1(ll, lv, ld, lr._0), lr._1, lr._2, create$1(lr._3, x, d, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height$1(rr) >= height$1(rl)) { - return create$1(create$1(l, x, d, rl), rv, rd, rr); - } else if (typeof rl !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create$1(create$1(l, x, d, rl._0), rl._1, rl._2, create$1(rl._3, rv, rd, rr)); - } -} - -function is_empty$1(x) { - if (typeof x !== "object") { - return true; - } else { - return false; - } -} - -function add$1(x, data, x_) { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_string.compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: x_._4 - }; - } else if (c < 0) { - return bal$1(add$1(x, data, l), v, d, r); - } else { - return bal$1(l, v, d, add$1(x, data, r)); - } -} - -function find$1(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = Primitive_string.compare(x, x_._1); - if (c === 0) { - return x_._2; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; -} - -function mem$1(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - return false; - } - let c = Primitive_string.compare(x, x_._1); - if (c === 0) { - return true; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; -} - -function min_binding$1(_x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let l = x._0; - if (typeof l !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = l; - continue; - }; -} - -function max_binding$1(_x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let r = x._3; - if (typeof r !== "object") { - return [ - x._1, - x._2 - ]; - } - _x = r; - continue; - }; -} - -function remove_min_binding$1(x) { - if (typeof x !== "object") { - return Pervasives.invalid_arg("Map.remove_min_elt"); - } - let l = x._0; - if (typeof l !== "object") { - return x._3; - } else { - return bal$1(remove_min_binding$1(l), x._1, x._2, x._3); - } -} - -function remove$1(x, x_) { - if (typeof x_ !== "object") { - return "Empty"; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_string.compare(x, v); - if (c === 0) { - if (typeof l !== "object") { - return r; - } - if (typeof r !== "object") { - return l; - } - let match = min_binding$1(r); - return bal$1(l, match[0], match[1], remove_min_binding$1(r)); - } else if (c < 0) { - return bal$1(remove$1(x, l), v, d, r); - } else { - return bal$1(l, v, d, remove$1(x, r)); - } -} - -function iter$1(f, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return; - } - iter$1(f, x._0); - f(x._1, x._2); - _x = x._3; - continue; - }; -} - -function map$1(f, x) { - if (typeof x !== "object") { - return "Empty"; - } - let l$p = map$1(f, x._0); - let d$p = f(x._2); - let r$p = map$1(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: x._1, - _2: d$p, - _3: r$p, - _4: x._4 - }; -} - -function mapi$1(f, x) { - if (typeof x !== "object") { - return "Empty"; - } - let v = x._1; - let l$p = mapi$1(f, x._0); - let d$p = f(v, x._2); - let r$p = mapi$1(f, x._3); - return { - TAG: "Node", - _0: l$p, - _1: v, - _2: d$p, - _3: r$p, - _4: x._4 - }; -} - -function fold$1(f, _m, _accu) { - while (true) { - let accu = _accu; - let m = _m; - if (typeof m !== "object") { - return accu; - } - _accu = f(m._1, m._2, fold$1(f, m._0, accu)); - _m = m._3; - continue; - }; -} - -function for_all$1(p, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return true; - } - if (!p(x._1, x._2)) { - return false; - } - if (!for_all$1(p, x._0)) { - return false; - } - _x = x._3; - continue; - }; -} - -function exists$1(p, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - return false; - } - if (p(x._1, x._2)) { - return true; - } - if (exists$1(p, x._0)) { - return true; - } - _x = x._3; - continue; - }; -} - -function add_min_binding$1(k, v, x) { - if (typeof x !== "object") { - return singleton$1(k, v); - } else { - return bal$1(add_min_binding$1(k, v, x._0), x._1, x._2, x._3); - } -} - -function add_max_binding$1(k, v, x) { - if (typeof x !== "object") { - return singleton$1(k, v); - } else { - return bal$1(x._0, x._1, x._2, add_max_binding$1(k, v, x._3)); - } -} - -function join$1(l, v, d, r) { - if (typeof l !== "object") { - return add_min_binding$1(v, d, r); - } - let lh = l._4; - if (typeof r !== "object") { - return add_max_binding$1(v, d, l); - } - let rh = r._4; - if (lh > (rh + 2 | 0)) { - return bal$1(l._0, l._1, l._2, join$1(l._3, v, d, r)); - } else if (rh > (lh + 2 | 0)) { - return bal$1(join$1(l, v, d, r._0), r._1, r._2, r._3); - } else { - return create$1(l, v, d, r); - } -} - -function concat$1(t1, t2) { - if (typeof t1 !== "object") { - return t2; - } - if (typeof t2 !== "object") { - return t1; - } - let match = min_binding$1(t2); - return join$1(t1, match[0], match[1], remove_min_binding$1(t2)); -} - -function concat_or_join$1(t1, v, d, t2) { - if (d !== undefined) { - return join$1(t1, v, Primitive_option.valFromOption(d), t2); - } else { - return concat$1(t1, t2); - } -} - -function split$1(x, x_) { - if (typeof x_ !== "object") { - return [ - "Empty", - undefined, - "Empty" - ]; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_string.compare(x, v); - if (c === 0) { - return [ - l, - Primitive_option.some(d), - r - ]; - } - if (c < 0) { - let match = split$1(x, l); - return [ - match[0], - match[1], - join$1(match[2], v, d, r) - ]; - } - let match$1 = split$1(x, r); - return [ - join$1(l, v, d, match$1[0]), - match$1[1], - match$1[2] - ]; -} - -function merge$1(f, s1, s2) { - if (typeof s1 !== "object") { - if (typeof s2 !== "object") { - return "Empty"; - } - - } else { - let v1 = s1._1; - if (s1._4 >= height$1(s2)) { - let match = split$1(v1, s2); - return concat_or_join$1(merge$1(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge$1(f, s1._3, match[2])); - } - - } - if (typeof s2 !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map2_test.res", - 359, - 11 - ], - Error: new Error() - }; - } - let v2 = s2._1; - let match$1 = split$1(v2, s1); - return concat_or_join$1(merge$1(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge$1(f, match$1[2], s2._3)); -} - -function filter$1(p, x) { - if (typeof x !== "object") { - return "Empty"; - } - let d = x._2; - let v = x._1; - let l$p = filter$1(p, x._0); - let pvd = p(v, d); - let r$p = filter$1(p, x._3); - if (pvd) { - return join$1(l$p, v, d, r$p); - } else { - return concat$1(l$p, r$p); - } -} - -function partition$1(p, x) { - if (typeof x !== "object") { - return [ - "Empty", - "Empty" - ]; - } - let d = x._2; - let v = x._1; - let match = partition$1(p, x._0); - let lf = match[1]; - let lt = match[0]; - let pvd = p(v, d); - let match$1 = partition$1(p, x._3); - let rf = match$1[1]; - let rt = match$1[0]; - if (pvd) { - return [ - join$1(lt, v, d, rt), - concat$1(lf, rf) - ]; - } else { - return [ - concat$1(lt, rt), - join$1(lf, v, d, rf) - ]; - } -} - -function cons_enum$1(_m, _e) { - while (true) { - let e = _e; - let m = _m; - if (typeof m !== "object") { - return e; - } - _e = { - TAG: "More", - _0: m._1, - _1: m._2, - _2: m._3, - _3: e - }; - _m = m._0; - continue; - }; -} - -function compare$1(cmp, m1, m2) { - let _e1 = cons_enum$1(m1, "End"); - let _e2 = cons_enum$1(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return 0; - } else { - return -1; - } - } - if (typeof e2 !== "object") { - return 1; - } - let c = Primitive_string.compare(e1._0, e2._0); - if (c !== 0) { - return c; - } - let c$1 = cmp(e1._1, e2._1); - if (c$1 !== 0) { - return c$1; - } - _e2 = cons_enum$1(e2._2, e2._3); - _e1 = cons_enum$1(e1._2, e1._3); - continue; - }; -} - -function equal$1(cmp, m1, m2) { - let _e1 = cons_enum$1(m1, "End"); - let _e2 = cons_enum$1(m2, "End"); - while (true) { - let e2 = _e2; - let e1 = _e1; - if (typeof e1 !== "object") { - if (typeof e2 !== "object") { - return true; - } else { - return false; - } - } - if (typeof e2 !== "object") { - return false; - } - if (e1._0 !== e2._0) { - return false; - } - if (!cmp(e1._1, e2._1)) { - return false; - } - _e2 = cons_enum$1(e2._2, e2._3); - _e1 = cons_enum$1(e1._2, e1._3); - continue; - }; -} - -function cardinal$1(x) { - if (typeof x !== "object") { - return 0; - } else { - return (cardinal$1(x._0) + 1 | 0) + cardinal$1(x._3) | 0; - } -} - -function bindings_aux$1(_accu, _x) { - while (true) { - let x = _x; - let accu = _accu; - if (typeof x !== "object") { - return accu; - } - _x = x._0; - _accu = { - hd: [ - x._1, - x._2 - ], - tl: bindings_aux$1(accu, x._3) - }; - continue; - }; -} - -function bindings$1(s) { - return bindings_aux$1(/* [] */0, s); -} - -let SMap = { - height: height$1, - create: create$1, - singleton: singleton$1, - bal: bal$1, - empty: "Empty", - is_empty: is_empty$1, - add: add$1, - find: find$1, - mem: mem$1, - min_binding: min_binding$1, - max_binding: max_binding$1, - remove_min_binding: remove_min_binding$1, - remove: remove$1, - iter: iter$1, - map: map$1, - mapi: mapi$1, - fold: fold$1, - for_all: for_all$1, - exists: exists$1, - add_min_binding: add_min_binding$1, - add_max_binding: add_max_binding$1, - join: join$1, - concat: concat$1, - concat_or_join: concat_or_join$1, - split: split$1, - merge: merge$1, - filter: filter$1, - partition: partition$1, - cons_enum: cons_enum$1, - compare: compare$1, - equal: equal$1, - cardinal: cardinal$1, - bindings_aux: bindings_aux$1, - bindings: bindings$1, - choose: min_binding$1 -}; - -let s = Belt_List.reduceReverse({ - hd: [ - "10", - /* 'a' */97 - ], - tl: { - hd: [ - "3", - /* 'b' */98 - ], - tl: { - hd: [ - "7", - /* 'c' */99 - ], - tl: { - hd: [ - "20", - /* 'd' */100 - ], - tl: /* [] */0 - } - } - } -}, "Empty", (acc, param) => add$1(param[0], param[1], acc)); - -Mt.from_pair_suites("Inline_map2_test", { - hd: [ - "assertion1", - () => ({ - TAG: "Eq", - _0: find(10, m), - _1: /* 'a' */97 - }) - ], - tl: { - hd: [ - "assertion2", - () => ({ - TAG: "Eq", - _0: find$1("10", s), - _1: /* 'a' */97 - }) - ], - tl: /* [] */0 - } -}); - -let empty = "Empty"; - -exports.Make = Make; -exports.IntMap = IntMap; -exports.empty = empty; -exports.m = m; -exports.SMap = SMap; -exports.s = s; -/* m Not a pure module */ diff --git a/tests/tests/src/inline_map2_test.mjs b/tests/tests/src/inline_map2_test.mjs new file mode 100644 index 0000000000..a31d35a05b --- /dev/null +++ b/tests/tests/src/inline_map2_test.mjs @@ -0,0 +1,1967 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; +import * as Primitive_string from "rescript/lib/es6/Primitive_string.js"; + +function Make(Ord) { + let height = x => { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } + }; + let create = (l, x, d, r) => { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + }; + let singleton = (x, d) => ({ + TAG: "Node", + _0: "Empty", + _1: x, + _2: d, + _3: "Empty", + _4: 1 + }); + let bal = (l, x, d, r) => { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, ld, create(lr, x, d, r)); + } else if (typeof lr !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, x, d, rl), rv, rd, rr); + } else if (typeof rl !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); + } + }; + let is_empty = x => { + if (typeof x !== "object") { + return true; + } else { + return false; + } + }; + let add = (x, data, x_) => { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Ord.compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: x_._4 + }; + } else if (c < 0) { + return bal(add(x, data, l), v, d, r); + } else { + return bal(l, v, d, add(x, data, r)); + } + }; + let find = (x, _x_) => { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let c = Ord.compare(x, x_._1); + if (c === 0) { + return x_._2; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; + }; + let mem = (x, _x_) => { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + return false; + } + let c = Ord.compare(x, x_._1); + if (c === 0) { + return true; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; + }; + let min_binding = _x => { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let l = x._0; + if (typeof l !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = l; + continue; + }; + }; + let max_binding = _x => { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let r = x._3; + if (typeof r !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = r; + continue; + }; + }; + let remove_min_binding = x => { + if (typeof x !== "object") { + return Pervasives.invalid_arg("Map.remove_min_elt"); + } + let l = x._0; + if (typeof l !== "object") { + return x._3; + } else { + return bal(remove_min_binding(l), x._1, x._2, x._3); + } + }; + let remove = (x, x_) => { + if (typeof x_ !== "object") { + return "Empty"; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Ord.compare(x, v); + if (c === 0) { + if (typeof l !== "object") { + return r; + } + if (typeof r !== "object") { + return l; + } + let match = min_binding(r); + return bal(l, match[0], match[1], remove_min_binding(r)); + } else if (c < 0) { + return bal(remove(x, l), v, d, r); + } else { + return bal(l, v, d, remove(x, r)); + } + }; + let iter = (f, _x) => { + while (true) { + let x = _x; + if (typeof x !== "object") { + return; + } + iter(f, x._0); + f(x._1, x._2); + _x = x._3; + continue; + }; + }; + let map = (f, x) => { + if (typeof x !== "object") { + return "Empty"; + } + let l$p = map(f, x._0); + let d$p = f(x._2); + let r$p = map(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: x._1, + _2: d$p, + _3: r$p, + _4: x._4 + }; + }; + let mapi = (f, x) => { + if (typeof x !== "object") { + return "Empty"; + } + let v = x._1; + let l$p = mapi(f, x._0); + let d$p = f(v, x._2); + let r$p = mapi(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: v, + _2: d$p, + _3: r$p, + _4: x._4 + }; + }; + let fold = (f, _m, _accu) => { + while (true) { + let accu = _accu; + let m = _m; + if (typeof m !== "object") { + return accu; + } + _accu = f(m._1, m._2, fold(f, m._0, accu)); + _m = m._3; + continue; + }; + }; + let for_all = (p, _x) => { + while (true) { + let x = _x; + if (typeof x !== "object") { + return true; + } + if (!p(x._1, x._2)) { + return false; + } + if (!for_all(p, x._0)) { + return false; + } + _x = x._3; + continue; + }; + }; + let exists = (p, _x) => { + while (true) { + let x = _x; + if (typeof x !== "object") { + return false; + } + if (p(x._1, x._2)) { + return true; + } + if (exists(p, x._0)) { + return true; + } + _x = x._3; + continue; + }; + }; + let add_min_binding = (k, v, x) => { + if (typeof x !== "object") { + return singleton(k, v); + } else { + return bal(add_min_binding(k, v, x._0), x._1, x._2, x._3); + } + }; + let add_max_binding = (k, v, x) => { + if (typeof x !== "object") { + return singleton(k, v); + } else { + return bal(x._0, x._1, x._2, add_max_binding(k, v, x._3)); + } + }; + let join = (l, v, d, r) => { + if (typeof l !== "object") { + return add_min_binding(v, d, r); + } + let lh = l._4; + if (typeof r !== "object") { + return add_max_binding(v, d, l); + } + let rh = r._4; + if (lh > (rh + 2 | 0)) { + return bal(l._0, l._1, l._2, join(l._3, v, d, r)); + } else if (rh > (lh + 2 | 0)) { + return bal(join(l, v, d, r._0), r._1, r._2, r._3); + } else { + return create(l, v, d, r); + } + }; + let concat = (t1, t2) => { + if (typeof t1 !== "object") { + return t2; + } + if (typeof t2 !== "object") { + return t1; + } + let match = min_binding(t2); + return join(t1, match[0], match[1], remove_min_binding(t2)); + }; + let concat_or_join = (t1, v, d, t2) => { + if (d !== undefined) { + return join(t1, v, Primitive_option.valFromOption(d), t2); + } else { + return concat(t1, t2); + } + }; + let split = (x, x_) => { + if (typeof x_ !== "object") { + return [ + "Empty", + undefined, + "Empty" + ]; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Ord.compare(x, v); + if (c === 0) { + return [ + l, + Primitive_option.some(d), + r + ]; + } + if (c < 0) { + let match = split(x, l); + return [ + match[0], + match[1], + join(match[2], v, d, r) + ]; + } + let match$1 = split(x, r); + return [ + join(l, v, d, match$1[0]), + match$1[1], + match$1[2] + ]; + }; + let merge = (f, s1, s2) => { + if (typeof s1 !== "object") { + if (typeof s2 !== "object") { + return "Empty"; + } + + } else { + let v1 = s1._1; + if (s1._4 >= height(s2)) { + let match = split(v1, s2); + return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); + } + + } + if (typeof s2 !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; + } + let v2 = s2._1; + let match$1 = split(v2, s1); + return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge(f, match$1[2], s2._3)); + }; + let filter = (p, x) => { + if (typeof x !== "object") { + return "Empty"; + } + let d = x._2; + let v = x._1; + let l$p = filter(p, x._0); + let pvd = p(v, d); + let r$p = filter(p, x._3); + if (pvd) { + return join(l$p, v, d, r$p); + } else { + return concat(l$p, r$p); + } + }; + let partition = (p, x) => { + if (typeof x !== "object") { + return [ + "Empty", + "Empty" + ]; + } + let d = x._2; + let v = x._1; + let match = partition(p, x._0); + let lf = match[1]; + let lt = match[0]; + let pvd = p(v, d); + let match$1 = partition(p, x._3); + let rf = match$1[1]; + let rt = match$1[0]; + if (pvd) { + return [ + join(lt, v, d, rt), + concat(lf, rf) + ]; + } else { + return [ + concat(lt, rt), + join(lf, v, d, rf) + ]; + } + }; + let cons_enum = (_m, _e) => { + while (true) { + let e = _e; + let m = _m; + if (typeof m !== "object") { + return e; + } + _e = { + TAG: "More", + _0: m._1, + _1: m._2, + _2: m._3, + _3: e + }; + _m = m._0; + continue; + }; + }; + let compare = (cmp, m1, m2) => { + let _e1 = cons_enum(m1, "End"); + let _e2 = cons_enum(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return 0; + } else { + return -1; + } + } + if (typeof e2 !== "object") { + return 1; + } + let c = Ord.compare(e1._0, e2._0); + if (c !== 0) { + return c; + } + let c$1 = cmp(e1._1, e2._1); + if (c$1 !== 0) { + return c$1; + } + _e2 = cons_enum(e2._2, e2._3); + _e1 = cons_enum(e1._2, e1._3); + continue; + }; + }; + let equal = (cmp, m1, m2) => { + let _e1 = cons_enum(m1, "End"); + let _e2 = cons_enum(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return true; + } else { + return false; + } + } + if (typeof e2 !== "object") { + return false; + } + if (Ord.compare(e1._0, e2._0) !== 0) { + return false; + } + if (!cmp(e1._1, e2._1)) { + return false; + } + _e2 = cons_enum(e2._2, e2._3); + _e1 = cons_enum(e1._2, e1._3); + continue; + }; + }; + let cardinal = x => { + if (typeof x !== "object") { + return 0; + } else { + return (cardinal(x._0) + 1 | 0) + cardinal(x._3) | 0; + } + }; + let bindings_aux = (_accu, _x) => { + while (true) { + let x = _x; + let accu = _accu; + if (typeof x !== "object") { + return accu; + } + _x = x._0; + _accu = { + hd: [ + x._1, + x._2 + ], + tl: bindings_aux(accu, x._3) + }; + continue; + }; + }; + let bindings = s => bindings_aux(/* [] */0, s); + return { + height: height, + create: create, + singleton: singleton, + bal: bal, + empty: "Empty", + is_empty: is_empty, + add: add, + find: find, + mem: mem, + min_binding: min_binding, + max_binding: max_binding, + remove_min_binding: remove_min_binding, + remove: remove, + iter: iter, + map: map, + mapi: mapi, + fold: fold, + for_all: for_all, + exists: exists, + add_min_binding: add_min_binding, + add_max_binding: add_max_binding, + join: join, + concat: concat, + concat_or_join: concat_or_join, + split: split, + merge: merge, + filter: filter, + partition: partition, + cons_enum: cons_enum, + compare: compare, + equal: equal, + cardinal: cardinal, + bindings_aux: bindings_aux, + bindings: bindings, + choose: min_binding + }; +} + +function height(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } +} + +function create(l, x, d, r) { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function singleton(x, d) { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: d, + _3: "Empty", + _4: 1 + }; +} + +function bal(l, x, d, r) { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, ld, create(lr, x, d, r)); + } else if (typeof lr !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, x, d, rl), rv, rd, rr); + } else if (typeof rl !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); + } +} + +function is_empty(x) { + if (typeof x !== "object") { + return true; + } else { + return false; + } +} + +function add(x, data, x_) { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_int.compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: x_._4 + }; + } else if (c < 0) { + return bal(add(x, data, l), v, d, r); + } else { + return bal(l, v, d, add(x, data, r)); + } +} + +function find(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let c = Primitive_int.compare(x, x_._1); + if (c === 0) { + return x_._2; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; +} + +function mem(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + return false; + } + let c = Primitive_int.compare(x, x_._1); + if (c === 0) { + return true; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; +} + +function min_binding(_x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let l = x._0; + if (typeof l !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = l; + continue; + }; +} + +function max_binding(_x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let r = x._3; + if (typeof r !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = r; + continue; + }; +} + +function remove_min_binding(x) { + if (typeof x !== "object") { + return Pervasives.invalid_arg("Map.remove_min_elt"); + } + let l = x._0; + if (typeof l !== "object") { + return x._3; + } else { + return bal(remove_min_binding(l), x._1, x._2, x._3); + } +} + +function remove(x, x_) { + if (typeof x_ !== "object") { + return "Empty"; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_int.compare(x, v); + if (c === 0) { + if (typeof l !== "object") { + return r; + } + if (typeof r !== "object") { + return l; + } + let match = min_binding(r); + return bal(l, match[0], match[1], remove_min_binding(r)); + } else if (c < 0) { + return bal(remove(x, l), v, d, r); + } else { + return bal(l, v, d, remove(x, r)); + } +} + +function iter(f, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return; + } + iter(f, x._0); + f(x._1, x._2); + _x = x._3; + continue; + }; +} + +function map(f, x) { + if (typeof x !== "object") { + return "Empty"; + } + let l$p = map(f, x._0); + let d$p = f(x._2); + let r$p = map(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: x._1, + _2: d$p, + _3: r$p, + _4: x._4 + }; +} + +function mapi(f, x) { + if (typeof x !== "object") { + return "Empty"; + } + let v = x._1; + let l$p = mapi(f, x._0); + let d$p = f(v, x._2); + let r$p = mapi(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: v, + _2: d$p, + _3: r$p, + _4: x._4 + }; +} + +function fold(f, _m, _accu) { + while (true) { + let accu = _accu; + let m = _m; + if (typeof m !== "object") { + return accu; + } + _accu = f(m._1, m._2, fold(f, m._0, accu)); + _m = m._3; + continue; + }; +} + +function for_all(p, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return true; + } + if (!p(x._1, x._2)) { + return false; + } + if (!for_all(p, x._0)) { + return false; + } + _x = x._3; + continue; + }; +} + +function exists(p, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return false; + } + if (p(x._1, x._2)) { + return true; + } + if (exists(p, x._0)) { + return true; + } + _x = x._3; + continue; + }; +} + +function add_min_binding(k, v, x) { + if (typeof x !== "object") { + return singleton(k, v); + } else { + return bal(add_min_binding(k, v, x._0), x._1, x._2, x._3); + } +} + +function add_max_binding(k, v, x) { + if (typeof x !== "object") { + return singleton(k, v); + } else { + return bal(x._0, x._1, x._2, add_max_binding(k, v, x._3)); + } +} + +function join(l, v, d, r) { + if (typeof l !== "object") { + return add_min_binding(v, d, r); + } + let lh = l._4; + if (typeof r !== "object") { + return add_max_binding(v, d, l); + } + let rh = r._4; + if (lh > (rh + 2 | 0)) { + return bal(l._0, l._1, l._2, join(l._3, v, d, r)); + } else if (rh > (lh + 2 | 0)) { + return bal(join(l, v, d, r._0), r._1, r._2, r._3); + } else { + return create(l, v, d, r); + } +} + +function concat(t1, t2) { + if (typeof t1 !== "object") { + return t2; + } + if (typeof t2 !== "object") { + return t1; + } + let match = min_binding(t2); + return join(t1, match[0], match[1], remove_min_binding(t2)); +} + +function concat_or_join(t1, v, d, t2) { + if (d !== undefined) { + return join(t1, v, Primitive_option.valFromOption(d), t2); + } else { + return concat(t1, t2); + } +} + +function split(x, x_) { + if (typeof x_ !== "object") { + return [ + "Empty", + undefined, + "Empty" + ]; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_int.compare(x, v); + if (c === 0) { + return [ + l, + Primitive_option.some(d), + r + ]; + } + if (c < 0) { + let match = split(x, l); + return [ + match[0], + match[1], + join(match[2], v, d, r) + ]; + } + let match$1 = split(x, r); + return [ + join(l, v, d, match$1[0]), + match$1[1], + match$1[2] + ]; +} + +function merge(f, s1, s2) { + if (typeof s1 !== "object") { + if (typeof s2 !== "object") { + return "Empty"; + } + + } else { + let v1 = s1._1; + if (s1._4 >= height(s2)) { + let match = split(v1, s2); + return concat_or_join(merge(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge(f, s1._3, match[2])); + } + + } + if (typeof s2 !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; + } + let v2 = s2._1; + let match$1 = split(v2, s1); + return concat_or_join(merge(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge(f, match$1[2], s2._3)); +} + +function filter(p, x) { + if (typeof x !== "object") { + return "Empty"; + } + let d = x._2; + let v = x._1; + let l$p = filter(p, x._0); + let pvd = p(v, d); + let r$p = filter(p, x._3); + if (pvd) { + return join(l$p, v, d, r$p); + } else { + return concat(l$p, r$p); + } +} + +function partition(p, x) { + if (typeof x !== "object") { + return [ + "Empty", + "Empty" + ]; + } + let d = x._2; + let v = x._1; + let match = partition(p, x._0); + let lf = match[1]; + let lt = match[0]; + let pvd = p(v, d); + let match$1 = partition(p, x._3); + let rf = match$1[1]; + let rt = match$1[0]; + if (pvd) { + return [ + join(lt, v, d, rt), + concat(lf, rf) + ]; + } else { + return [ + concat(lt, rt), + join(lf, v, d, rf) + ]; + } +} + +function cons_enum(_m, _e) { + while (true) { + let e = _e; + let m = _m; + if (typeof m !== "object") { + return e; + } + _e = { + TAG: "More", + _0: m._1, + _1: m._2, + _2: m._3, + _3: e + }; + _m = m._0; + continue; + }; +} + +function compare(cmp, m1, m2) { + let _e1 = cons_enum(m1, "End"); + let _e2 = cons_enum(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return 0; + } else { + return -1; + } + } + if (typeof e2 !== "object") { + return 1; + } + let c = Primitive_int.compare(e1._0, e2._0); + if (c !== 0) { + return c; + } + let c$1 = cmp(e1._1, e2._1); + if (c$1 !== 0) { + return c$1; + } + _e2 = cons_enum(e2._2, e2._3); + _e1 = cons_enum(e1._2, e1._3); + continue; + }; +} + +function equal(cmp, m1, m2) { + let _e1 = cons_enum(m1, "End"); + let _e2 = cons_enum(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return true; + } else { + return false; + } + } + if (typeof e2 !== "object") { + return false; + } + if (e1._0 !== e2._0) { + return false; + } + if (!cmp(e1._1, e2._1)) { + return false; + } + _e2 = cons_enum(e2._2, e2._3); + _e1 = cons_enum(e1._2, e1._3); + continue; + }; +} + +function cardinal(x) { + if (typeof x !== "object") { + return 0; + } else { + return (cardinal(x._0) + 1 | 0) + cardinal(x._3) | 0; + } +} + +function bindings_aux(_accu, _x) { + while (true) { + let x = _x; + let accu = _accu; + if (typeof x !== "object") { + return accu; + } + _x = x._0; + _accu = { + hd: [ + x._1, + x._2 + ], + tl: bindings_aux(accu, x._3) + }; + continue; + }; +} + +function bindings(s) { + return bindings_aux(/* [] */0, s); +} + +let IntMap = { + height: height, + create: create, + singleton: singleton, + bal: bal, + empty: "Empty", + is_empty: is_empty, + add: add, + find: find, + mem: mem, + min_binding: min_binding, + max_binding: max_binding, + remove_min_binding: remove_min_binding, + remove: remove, + iter: iter, + map: map, + mapi: mapi, + fold: fold, + for_all: for_all, + exists: exists, + add_min_binding: add_min_binding, + add_max_binding: add_max_binding, + join: join, + concat: concat, + concat_or_join: concat_or_join, + split: split, + merge: merge, + filter: filter, + partition: partition, + cons_enum: cons_enum, + compare: compare, + equal: equal, + cardinal: cardinal, + bindings_aux: bindings_aux, + bindings: bindings, + choose: min_binding +}; + +let m = Belt_List.reduceReverse({ + hd: [ + 10, + /* 'a' */97 + ], + tl: { + hd: [ + 3, + /* 'b' */98 + ], + tl: { + hd: [ + 7, + /* 'c' */99 + ], + tl: { + hd: [ + 20, + /* 'd' */100 + ], + tl: /* [] */0 + } + } + } +}, "Empty", (acc, param) => add(param[0], param[1], acc)); + +function height$1(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } +} + +function create$1(l, x, d, r) { + let hl = height$1(l); + let hr = height$1(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function singleton$1(x, d) { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: d, + _3: "Empty", + _4: 1 + }; +} + +function bal$1(l, x, d, r) { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height$1(ll) >= height$1(lr)) { + return create$1(ll, lv, ld, create$1(lr, x, d, r)); + } else if (typeof lr !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create$1(create$1(ll, lv, ld, lr._0), lr._1, lr._2, create$1(lr._3, x, d, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height$1(rr) >= height$1(rl)) { + return create$1(create$1(l, x, d, rl), rv, rd, rr); + } else if (typeof rl !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create$1(create$1(l, x, d, rl._0), rl._1, rl._2, create$1(rl._3, rv, rd, rr)); + } +} + +function is_empty$1(x) { + if (typeof x !== "object") { + return true; + } else { + return false; + } +} + +function add$1(x, data, x_) { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_string.compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: x_._4 + }; + } else if (c < 0) { + return bal$1(add$1(x, data, l), v, d, r); + } else { + return bal$1(l, v, d, add$1(x, data, r)); + } +} + +function find$1(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let c = Primitive_string.compare(x, x_._1); + if (c === 0) { + return x_._2; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; +} + +function mem$1(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + return false; + } + let c = Primitive_string.compare(x, x_._1); + if (c === 0) { + return true; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; +} + +function min_binding$1(_x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let l = x._0; + if (typeof l !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = l; + continue; + }; +} + +function max_binding$1(_x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let r = x._3; + if (typeof r !== "object") { + return [ + x._1, + x._2 + ]; + } + _x = r; + continue; + }; +} + +function remove_min_binding$1(x) { + if (typeof x !== "object") { + return Pervasives.invalid_arg("Map.remove_min_elt"); + } + let l = x._0; + if (typeof l !== "object") { + return x._3; + } else { + return bal$1(remove_min_binding$1(l), x._1, x._2, x._3); + } +} + +function remove$1(x, x_) { + if (typeof x_ !== "object") { + return "Empty"; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_string.compare(x, v); + if (c === 0) { + if (typeof l !== "object") { + return r; + } + if (typeof r !== "object") { + return l; + } + let match = min_binding$1(r); + return bal$1(l, match[0], match[1], remove_min_binding$1(r)); + } else if (c < 0) { + return bal$1(remove$1(x, l), v, d, r); + } else { + return bal$1(l, v, d, remove$1(x, r)); + } +} + +function iter$1(f, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return; + } + iter$1(f, x._0); + f(x._1, x._2); + _x = x._3; + continue; + }; +} + +function map$1(f, x) { + if (typeof x !== "object") { + return "Empty"; + } + let l$p = map$1(f, x._0); + let d$p = f(x._2); + let r$p = map$1(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: x._1, + _2: d$p, + _3: r$p, + _4: x._4 + }; +} + +function mapi$1(f, x) { + if (typeof x !== "object") { + return "Empty"; + } + let v = x._1; + let l$p = mapi$1(f, x._0); + let d$p = f(v, x._2); + let r$p = mapi$1(f, x._3); + return { + TAG: "Node", + _0: l$p, + _1: v, + _2: d$p, + _3: r$p, + _4: x._4 + }; +} + +function fold$1(f, _m, _accu) { + while (true) { + let accu = _accu; + let m = _m; + if (typeof m !== "object") { + return accu; + } + _accu = f(m._1, m._2, fold$1(f, m._0, accu)); + _m = m._3; + continue; + }; +} + +function for_all$1(p, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return true; + } + if (!p(x._1, x._2)) { + return false; + } + if (!for_all$1(p, x._0)) { + return false; + } + _x = x._3; + continue; + }; +} + +function exists$1(p, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + return false; + } + if (p(x._1, x._2)) { + return true; + } + if (exists$1(p, x._0)) { + return true; + } + _x = x._3; + continue; + }; +} + +function add_min_binding$1(k, v, x) { + if (typeof x !== "object") { + return singleton$1(k, v); + } else { + return bal$1(add_min_binding$1(k, v, x._0), x._1, x._2, x._3); + } +} + +function add_max_binding$1(k, v, x) { + if (typeof x !== "object") { + return singleton$1(k, v); + } else { + return bal$1(x._0, x._1, x._2, add_max_binding$1(k, v, x._3)); + } +} + +function join$1(l, v, d, r) { + if (typeof l !== "object") { + return add_min_binding$1(v, d, r); + } + let lh = l._4; + if (typeof r !== "object") { + return add_max_binding$1(v, d, l); + } + let rh = r._4; + if (lh > (rh + 2 | 0)) { + return bal$1(l._0, l._1, l._2, join$1(l._3, v, d, r)); + } else if (rh > (lh + 2 | 0)) { + return bal$1(join$1(l, v, d, r._0), r._1, r._2, r._3); + } else { + return create$1(l, v, d, r); + } +} + +function concat$1(t1, t2) { + if (typeof t1 !== "object") { + return t2; + } + if (typeof t2 !== "object") { + return t1; + } + let match = min_binding$1(t2); + return join$1(t1, match[0], match[1], remove_min_binding$1(t2)); +} + +function concat_or_join$1(t1, v, d, t2) { + if (d !== undefined) { + return join$1(t1, v, Primitive_option.valFromOption(d), t2); + } else { + return concat$1(t1, t2); + } +} + +function split$1(x, x_) { + if (typeof x_ !== "object") { + return [ + "Empty", + undefined, + "Empty" + ]; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_string.compare(x, v); + if (c === 0) { + return [ + l, + Primitive_option.some(d), + r + ]; + } + if (c < 0) { + let match = split$1(x, l); + return [ + match[0], + match[1], + join$1(match[2], v, d, r) + ]; + } + let match$1 = split$1(x, r); + return [ + join$1(l, v, d, match$1[0]), + match$1[1], + match$1[2] + ]; +} + +function merge$1(f, s1, s2) { + if (typeof s1 !== "object") { + if (typeof s2 !== "object") { + return "Empty"; + } + + } else { + let v1 = s1._1; + if (s1._4 >= height$1(s2)) { + let match = split$1(v1, s2); + return concat_or_join$1(merge$1(f, s1._0, match[0]), v1, f(v1, Primitive_option.some(s1._2), match[1]), merge$1(f, s1._3, match[2])); + } + + } + if (typeof s2 !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map2_test.res", + 359, + 11 + ], + Error: new Error() + }; + } + let v2 = s2._1; + let match$1 = split$1(v2, s1); + return concat_or_join$1(merge$1(f, match$1[0], s2._0), v2, f(v2, match$1[1], Primitive_option.some(s2._2)), merge$1(f, match$1[2], s2._3)); +} + +function filter$1(p, x) { + if (typeof x !== "object") { + return "Empty"; + } + let d = x._2; + let v = x._1; + let l$p = filter$1(p, x._0); + let pvd = p(v, d); + let r$p = filter$1(p, x._3); + if (pvd) { + return join$1(l$p, v, d, r$p); + } else { + return concat$1(l$p, r$p); + } +} + +function partition$1(p, x) { + if (typeof x !== "object") { + return [ + "Empty", + "Empty" + ]; + } + let d = x._2; + let v = x._1; + let match = partition$1(p, x._0); + let lf = match[1]; + let lt = match[0]; + let pvd = p(v, d); + let match$1 = partition$1(p, x._3); + let rf = match$1[1]; + let rt = match$1[0]; + if (pvd) { + return [ + join$1(lt, v, d, rt), + concat$1(lf, rf) + ]; + } else { + return [ + concat$1(lt, rt), + join$1(lf, v, d, rf) + ]; + } +} + +function cons_enum$1(_m, _e) { + while (true) { + let e = _e; + let m = _m; + if (typeof m !== "object") { + return e; + } + _e = { + TAG: "More", + _0: m._1, + _1: m._2, + _2: m._3, + _3: e + }; + _m = m._0; + continue; + }; +} + +function compare$1(cmp, m1, m2) { + let _e1 = cons_enum$1(m1, "End"); + let _e2 = cons_enum$1(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return 0; + } else { + return -1; + } + } + if (typeof e2 !== "object") { + return 1; + } + let c = Primitive_string.compare(e1._0, e2._0); + if (c !== 0) { + return c; + } + let c$1 = cmp(e1._1, e2._1); + if (c$1 !== 0) { + return c$1; + } + _e2 = cons_enum$1(e2._2, e2._3); + _e1 = cons_enum$1(e1._2, e1._3); + continue; + }; +} + +function equal$1(cmp, m1, m2) { + let _e1 = cons_enum$1(m1, "End"); + let _e2 = cons_enum$1(m2, "End"); + while (true) { + let e2 = _e2; + let e1 = _e1; + if (typeof e1 !== "object") { + if (typeof e2 !== "object") { + return true; + } else { + return false; + } + } + if (typeof e2 !== "object") { + return false; + } + if (e1._0 !== e2._0) { + return false; + } + if (!cmp(e1._1, e2._1)) { + return false; + } + _e2 = cons_enum$1(e2._2, e2._3); + _e1 = cons_enum$1(e1._2, e1._3); + continue; + }; +} + +function cardinal$1(x) { + if (typeof x !== "object") { + return 0; + } else { + return (cardinal$1(x._0) + 1 | 0) + cardinal$1(x._3) | 0; + } +} + +function bindings_aux$1(_accu, _x) { + while (true) { + let x = _x; + let accu = _accu; + if (typeof x !== "object") { + return accu; + } + _x = x._0; + _accu = { + hd: [ + x._1, + x._2 + ], + tl: bindings_aux$1(accu, x._3) + }; + continue; + }; +} + +function bindings$1(s) { + return bindings_aux$1(/* [] */0, s); +} + +let SMap = { + height: height$1, + create: create$1, + singleton: singleton$1, + bal: bal$1, + empty: "Empty", + is_empty: is_empty$1, + add: add$1, + find: find$1, + mem: mem$1, + min_binding: min_binding$1, + max_binding: max_binding$1, + remove_min_binding: remove_min_binding$1, + remove: remove$1, + iter: iter$1, + map: map$1, + mapi: mapi$1, + fold: fold$1, + for_all: for_all$1, + exists: exists$1, + add_min_binding: add_min_binding$1, + add_max_binding: add_max_binding$1, + join: join$1, + concat: concat$1, + concat_or_join: concat_or_join$1, + split: split$1, + merge: merge$1, + filter: filter$1, + partition: partition$1, + cons_enum: cons_enum$1, + compare: compare$1, + equal: equal$1, + cardinal: cardinal$1, + bindings_aux: bindings_aux$1, + bindings: bindings$1, + choose: min_binding$1 +}; + +let s = Belt_List.reduceReverse({ + hd: [ + "10", + /* 'a' */97 + ], + tl: { + hd: [ + "3", + /* 'b' */98 + ], + tl: { + hd: [ + "7", + /* 'c' */99 + ], + tl: { + hd: [ + "20", + /* 'd' */100 + ], + tl: /* [] */0 + } + } + } +}, "Empty", (acc, param) => add$1(param[0], param[1], acc)); + +Mt.from_pair_suites("Inline_map2_test", { + hd: [ + "assertion1", + () => ({ + TAG: "Eq", + _0: find(10, m), + _1: /* 'a' */97 + }) + ], + tl: { + hd: [ + "assertion2", + () => ({ + TAG: "Eq", + _0: find$1("10", s), + _1: /* 'a' */97 + }) + ], + tl: /* [] */0 + } +}); + +let empty = "Empty"; + +export { + Make, + IntMap, + empty, + m, + SMap, + s, +} +/* m Not a pure module */ diff --git a/tests/tests/src/inline_map_demo.js b/tests/tests/src/inline_map_demo.js deleted file mode 100644 index 396fd23487..0000000000 --- a/tests/tests/src/inline_map_demo.js +++ /dev/null @@ -1,196 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -function height(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } -} - -function create(l, x, d, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 41, - 15 - ], - Error: new Error() - }; - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } - if (typeof lr === "object") { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 47, - 19 - ], - Error: new Error() - }; - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 55, - 15 - ], - Error: new Error() - }; - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } - if (typeof rl === "object") { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_map_demo.res", - 61, - 19 - ], - Error: new Error() - }; -} - -function add(x, data, tree) { - if (typeof tree !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = tree._3; - let d = tree._2; - let v = tree._1; - let l = tree._0; - let c = Primitive_int.compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: tree._4 - }; - } else if (c < 0) { - return bal(add(x, data, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, r)); - } -} - -let m = Belt_List.reduceReverse({ - hd: [ - 10, - /* 'a' */97 - ], - tl: { - hd: [ - 3, - /* 'b' */98 - ], - tl: { - hd: [ - 7, - /* 'c' */99 - ], - tl: { - hd: [ - 20, - /* 'd' */100 - ], - tl: /* [] */0 - } - } - } -}, "Empty", (acc, param) => add(param[0], param[1], acc)); - -function find(px, _x) { - while (true) { - let x = _x; - if (typeof x !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = Primitive_int.compare(px, x._1); - if (c === 0) { - return x._2; - } - _x = c < 0 ? x._0 : x._3; - continue; - }; -} - -Mt.from_pair_suites("Inline_map_demo", { - hd: [ - "find", - () => ({ - TAG: "Eq", - _0: find(10, m), - _1: /* 'a' */97 - }) - ], - tl: /* [] */0 -}); - -/* m Not a pure module */ diff --git a/tests/tests/src/inline_map_demo.mjs b/tests/tests/src/inline_map_demo.mjs new file mode 100644 index 0000000000..092e289277 --- /dev/null +++ b/tests/tests/src/inline_map_demo.mjs @@ -0,0 +1,195 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +function height(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } +} + +function create(l, x, d, r) { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function bal(l, x, d, r) { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 41, + 15 + ], + Error: new Error() + }; + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, ld, create(lr, x, d, r)); + } + if (typeof lr === "object") { + return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 47, + 19 + ], + Error: new Error() + }; + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 55, + 15 + ], + Error: new Error() + }; + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, x, d, rl), rv, rd, rr); + } + if (typeof rl === "object") { + return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_map_demo.res", + 61, + 19 + ], + Error: new Error() + }; +} + +function add(x, data, tree) { + if (typeof tree !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = tree._3; + let d = tree._2; + let v = tree._1; + let l = tree._0; + let c = Primitive_int.compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: tree._4 + }; + } else if (c < 0) { + return bal(add(x, data, l), v, d, r); + } else { + return bal(l, v, d, add(x, data, r)); + } +} + +let m = Belt_List.reduceReverse({ + hd: [ + 10, + /* 'a' */97 + ], + tl: { + hd: [ + 3, + /* 'b' */98 + ], + tl: { + hd: [ + 7, + /* 'c' */99 + ], + tl: { + hd: [ + 20, + /* 'd' */100 + ], + tl: /* [] */0 + } + } + } +}, "Empty", (acc, param) => add(param[0], param[1], acc)); + +function find(px, _x) { + while (true) { + let x = _x; + if (typeof x !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let c = Primitive_int.compare(px, x._1); + if (c === 0) { + return x._2; + } + _x = c < 0 ? x._0 : x._3; + continue; + }; +} + +Mt.from_pair_suites("Inline_map_demo", { + hd: [ + "find", + () => ({ + TAG: "Eq", + _0: find(10, m), + _1: /* 'a' */97 + }) + ], + tl: /* [] */0 +}); + +/* m Not a pure module */ diff --git a/tests/tests/src/inline_map_test.js b/tests/tests/src/inline_map_test.js deleted file mode 100644 index d7d1420850..0000000000 --- a/tests/tests/src/inline_map_test.js +++ /dev/null @@ -1,165 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_int = require("rescript/lib/js/Primitive_int.js"); - -function height(x) { - if (typeof x !== "object") { - return 0; - } else { - return x._4; - } -} - -function create(l, x, d, r) { - let hl = height(l); - let hr = height(r); - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, x, d, r) { - let hl; - hl = typeof l !== "object" ? 0 : l._4; - let hr; - hr = typeof r !== "object" ? 0 : r._4; - if (hl > (hr + 2 | 0)) { - if (typeof l !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let lr = l._3; - let ld = l._2; - let lv = l._1; - let ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } else if (typeof lr !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - } - if (hr <= (hl + 2 | 0)) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (typeof r !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } - let rr = r._3; - let rd = r._2; - let rv = r._1; - let rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } else if (typeof rl !== "object") { - return Pervasives.invalid_arg("Map.bal"); - } else { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } -} - -function add(x, data, x_) { - if (typeof x_ !== "object") { - return { - TAG: "Node", - _0: "Empty", - _1: x, - _2: data, - _3: "Empty", - _4: 1 - }; - } - let r = x_._3; - let d = x_._2; - let v = x_._1; - let l = x_._0; - let c = Primitive_int.compare(x, v); - if (c === 0) { - return { - TAG: "Node", - _0: l, - _1: x, - _2: data, - _3: r, - _4: x_._4 - }; - } else if (c < 0) { - return bal(add(x, data, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, r)); - } -} - -function find(x, _x_) { - while (true) { - let x_ = _x_; - if (typeof x_ !== "object") { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; - } - let c = Primitive_int.compare(x, x_._1); - if (c === 0) { - return x_._2; - } - _x_ = c < 0 ? x_._0 : x_._3; - continue; - }; -} - -let m = Belt_List.reduceReverse({ - hd: [ - 10, - /* 'a' */97 - ], - tl: { - hd: [ - 3, - /* 'b' */98 - ], - tl: { - hd: [ - 7, - /* 'c' */99 - ], - tl: { - hd: [ - 20, - /* 'd' */100 - ], - tl: /* [] */0 - } - } - } -}, "Empty", (acc, param) => add(param[0], param[1], acc)); - -Mt.from_pair_suites("Inline_map_test", { - hd: [ - "find", - () => ({ - TAG: "Eq", - _0: find(10, m), - _1: /* 'a' */97 - }) - ], - tl: /* [] */0 -}); - -/* m Not a pure module */ diff --git a/tests/tests/src/inline_map_test.mjs b/tests/tests/src/inline_map_test.mjs new file mode 100644 index 0000000000..e1f33bdd99 --- /dev/null +++ b/tests/tests/src/inline_map_test.mjs @@ -0,0 +1,164 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_int from "rescript/lib/es6/Primitive_int.js"; + +function height(x) { + if (typeof x !== "object") { + return 0; + } else { + return x._4; + } +} + +function create(l, x, d, r) { + let hl = height(l); + let hr = height(r); + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; +} + +function bal(l, x, d, r) { + let hl; + hl = typeof l !== "object" ? 0 : l._4; + let hr; + hr = typeof r !== "object" ? 0 : r._4; + if (hl > (hr + 2 | 0)) { + if (typeof l !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let lr = l._3; + let ld = l._2; + let lv = l._1; + let ll = l._0; + if (height(ll) >= height(lr)) { + return create(ll, lv, ld, create(lr, x, d, r)); + } else if (typeof lr !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); + } + } + if (hr <= (hl + 2 | 0)) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: d, + _3: r, + _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 + }; + } + if (typeof r !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } + let rr = r._3; + let rd = r._2; + let rv = r._1; + let rl = r._0; + if (height(rr) >= height(rl)) { + return create(create(l, x, d, rl), rv, rd, rr); + } else if (typeof rl !== "object") { + return Pervasives.invalid_arg("Map.bal"); + } else { + return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); + } +} + +function add(x, data, x_) { + if (typeof x_ !== "object") { + return { + TAG: "Node", + _0: "Empty", + _1: x, + _2: data, + _3: "Empty", + _4: 1 + }; + } + let r = x_._3; + let d = x_._2; + let v = x_._1; + let l = x_._0; + let c = Primitive_int.compare(x, v); + if (c === 0) { + return { + TAG: "Node", + _0: l, + _1: x, + _2: data, + _3: r, + _4: x_._4 + }; + } else if (c < 0) { + return bal(add(x, data, l), v, d, r); + } else { + return bal(l, v, d, add(x, data, r)); + } +} + +function find(x, _x_) { + while (true) { + let x_ = _x_; + if (typeof x_ !== "object") { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; + } + let c = Primitive_int.compare(x, x_._1); + if (c === 0) { + return x_._2; + } + _x_ = c < 0 ? x_._0 : x_._3; + continue; + }; +} + +let m = Belt_List.reduceReverse({ + hd: [ + 10, + /* 'a' */97 + ], + tl: { + hd: [ + 3, + /* 'b' */98 + ], + tl: { + hd: [ + 7, + /* 'c' */99 + ], + tl: { + hd: [ + 20, + /* 'd' */100 + ], + tl: /* [] */0 + } + } + } +}, "Empty", (acc, param) => add(param[0], param[1], acc)); + +Mt.from_pair_suites("Inline_map_test", { + hd: [ + "find", + () => ({ + TAG: "Eq", + _0: find(10, m), + _1: /* 'a' */97 + }) + ], + tl: /* [] */0 +}); + +/* m Not a pure module */ diff --git a/tests/tests/src/inline_record_test.js b/tests/tests/src/inline_record_test.js deleted file mode 100644 index ec33568fcb..0000000000 --- a/tests/tests/src/inline_record_test.js +++ /dev/null @@ -1,241 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -let v = { - TAG: "A0", - lbl: 3, - more: /* [] */0 -}; - -let v1 = { - TAG: "A1", - more: { - hd: 1, - tl: { - hd: 2, - tl: /* [] */0 - } - } -}; - -function f(x) { - if (x.TAG === "A0") { - return Belt_List.reduceReverse(x.more, x.lbl, (prim0, prim1) => prim0 + prim1 | 0); - } else { - return Belt_List.reduceReverse(x.more, 0, (prim0, prim1) => prim0 + prim1 | 0); - } -} - -eq("File \"inline_record_test.res\", line 19, characters 3-10", f(v), 3); - -eq("File \"inline_record_test.res\", line 20, characters 3-10", f(v1), 3); - -console.log(f(v)); - -console.log(f(v1)); - -let A0 = /* @__PURE__ */Primitive_exceptions.create("Inline_record_test.A0"); - -let v3 = { - RE_EXN_ID: A0, - lbl: 3, - more: /* [] */0 -}; - -let tmp; - -if (A0 === A0) { - tmp = 3; -} else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 47, - 9 - ], - Error: new Error() - }; -} - -eq("File \"inline_record_test.res\", line 44, characters 2-9", tmp, 3); - -function ff(x) { - if (x.TAG === "A0") { - x.x = x.x + 1 | 0; - } else { - x.z = x.z + 2 | 0; - } -} - -let v4 = { - TAG: "A0", - x: 0, - y: 0, - z: 0 -}; - -let v5 = { - TAG: "A1", - z: 0 -}; - -for (let i = 0; i <= 10; ++i) { - ff(v4); - ff(v5); -} - -let tmp$1; - -if (v4.TAG === "A0") { - tmp$1 = v4.x; -} else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 74, - 9 - ], - Error: new Error() - }; -} - -eq("File \"inline_record_test.res\", line 71, characters 2-9", tmp$1, 11); - -let tmp$2; - -if (v5.TAG === "A0") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 83, - 9 - ], - Error: new Error() - }; -} - -tmp$2 = v5.z; - -eq("File \"inline_record_test.res\", line 80, characters 2-9", tmp$2, 22); - -let A4 = /* @__PURE__ */Primitive_exceptions.create("Inline_record_test.A4"); - -let v6 = { - RE_EXN_ID: A4, - x: 0, - y: 0, - z: 0 -}; - -function ff0(x) { - if (x.RE_EXN_ID === A4) { - x.x = x.x + 1 | 0; - x.z = x.z + 1 | 0; - return; - } - -} - -for (let i$1 = 0; i$1 <= 10; ++i$1) { - ff0(v6); -} - -let tmp$3; - -if (v6.RE_EXN_ID === A4) { - tmp$3 = v6.x; -} else { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "inline_record_test.res", - 108, - 9 - ], - Error: new Error() - }; -} - -eq("File \"inline_record_test.res\", line 105, characters 2-9", tmp$3, 11); - -function ff1(x) { - if (typeof x !== "object") { - return "A1"; - } else { - return { - TAG: "A0", - lbl: x.lbl + 1 | 0, - more: x.more - }; - } -} - -Mt.from_pair_suites("Inline_record_test", suites.contents); - -let b = { - TAG: "B" -}; - -if (typeof b !== "object") { - console.log("A!"); -} else { - console.log("B"); -} - -console.log("10!"); - -let v2 = { - TAG: "A0", - lbl: 3, - more: /* [] */0 -}; - -let vvv = { - TAG: "A0", - lbl: 3, - more: /* [] */0 -}; - -let r = { - y: 10 -}; - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.v = v; -exports.v1 = v1; -exports.f = f; -exports.v2 = v2; -exports.A0 = A0; -exports.v3 = v3; -exports.vvv = vvv; -exports.ff = ff; -exports.v4 = v4; -exports.v5 = v5; -exports.A4 = A4; -exports.v6 = v6; -exports.ff0 = ff0; -exports.ff1 = ff1; -exports.b = b; -exports.r = r; -/* Not a pure module */ diff --git a/tests/tests/src/inline_record_test.mjs b/tests/tests/src/inline_record_test.mjs new file mode 100644 index 0000000000..a09d054b4f --- /dev/null +++ b/tests/tests/src/inline_record_test.mjs @@ -0,0 +1,242 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + Mt.eq_suites(test_id, suites, loc, x, y); +} + +let v = { + TAG: "A0", + lbl: 3, + more: /* [] */0 +}; + +let v1 = { + TAG: "A1", + more: { + hd: 1, + tl: { + hd: 2, + tl: /* [] */0 + } + } +}; + +function f(x) { + if (x.TAG === "A0") { + return Belt_List.reduceReverse(x.more, x.lbl, (prim0, prim1) => prim0 + prim1 | 0); + } else { + return Belt_List.reduceReverse(x.more, 0, (prim0, prim1) => prim0 + prim1 | 0); + } +} + +eq("File \"inline_record_test.res\", line 19, characters 3-10", f(v), 3); + +eq("File \"inline_record_test.res\", line 20, characters 3-10", f(v1), 3); + +console.log(f(v)); + +console.log(f(v1)); + +let A0 = /* @__PURE__ */Primitive_exceptions.create("Inline_record_test.A0"); + +let v3 = { + RE_EXN_ID: A0, + lbl: 3, + more: /* [] */0 +}; + +let tmp; + +if (A0 === A0) { + tmp = 3; +} else { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 47, + 9 + ], + Error: new Error() + }; +} + +eq("File \"inline_record_test.res\", line 44, characters 2-9", tmp, 3); + +function ff(x) { + if (x.TAG === "A0") { + x.x = x.x + 1 | 0; + } else { + x.z = x.z + 2 | 0; + } +} + +let v4 = { + TAG: "A0", + x: 0, + y: 0, + z: 0 +}; + +let v5 = { + TAG: "A1", + z: 0 +}; + +for (let i = 0; i <= 10; ++i) { + ff(v4); + ff(v5); +} + +let tmp$1; + +if (v4.TAG === "A0") { + tmp$1 = v4.x; +} else { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 74, + 9 + ], + Error: new Error() + }; +} + +eq("File \"inline_record_test.res\", line 71, characters 2-9", tmp$1, 11); + +let tmp$2; + +if (v5.TAG === "A0") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 83, + 9 + ], + Error: new Error() + }; +} + +tmp$2 = v5.z; + +eq("File \"inline_record_test.res\", line 80, characters 2-9", tmp$2, 22); + +let A4 = /* @__PURE__ */Primitive_exceptions.create("Inline_record_test.A4"); + +let v6 = { + RE_EXN_ID: A4, + x: 0, + y: 0, + z: 0 +}; + +function ff0(x) { + if (x.RE_EXN_ID === A4) { + x.x = x.x + 1 | 0; + x.z = x.z + 1 | 0; + return; + } + +} + +for (let i$1 = 0; i$1 <= 10; ++i$1) { + ff0(v6); +} + +let tmp$3; + +if (v6.RE_EXN_ID === A4) { + tmp$3 = v6.x; +} else { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "inline_record_test.res", + 108, + 9 + ], + Error: new Error() + }; +} + +eq("File \"inline_record_test.res\", line 105, characters 2-9", tmp$3, 11); + +function ff1(x) { + if (typeof x !== "object") { + return "A1"; + } else { + return { + TAG: "A0", + lbl: x.lbl + 1 | 0, + more: x.more + }; + } +} + +Mt.from_pair_suites("Inline_record_test", suites.contents); + +let b = { + TAG: "B" +}; + +if (typeof b !== "object") { + console.log("A!"); +} else { + console.log("B"); +} + +console.log("10!"); + +let v2 = { + TAG: "A0", + lbl: 3, + more: /* [] */0 +}; + +let vvv = { + TAG: "A0", + lbl: 3, + more: /* [] */0 +}; + +let r = { + y: 10 +}; + +export { + suites, + test_id, + eq, + v, + v1, + f, + v2, + A0, + v3, + vvv, + ff, + v4, + v5, + A4, + v6, + ff0, + ff1, + b, + r, +} +/* Not a pure module */ diff --git a/tests/tests/src/inline_regression_test.js b/tests/tests/src/inline_regression_test.js deleted file mode 100644 index ca32d92e24..0000000000 --- a/tests/tests/src/inline_regression_test.js +++ /dev/null @@ -1,63 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function generic_basename(is_dir_sep, current_dir_name, name) { - if (name === "") { - return current_dir_name; - } else { - let _n = name.length - 1 | 0; - while (true) { - let n = _n; - if (n < 0) { - return name.substr(0, 1); - } - if (!is_dir_sep(name, n)) { - let _n$1 = n; - let p = n + 1 | 0; - while (true) { - let n$1 = _n$1; - if (n$1 < 0) { - return name.substr(0, p); - } - if (is_dir_sep(name, n$1)) { - return name.substr(n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0); - } - _n$1 = n$1 - 1 | 0; - continue; - }; - } - _n = n - 1 | 0; - continue; - }; - } -} - -function basename(extra) { - return generic_basename((s, i) => s.codePointAt(i) === /* '/' */47, "", extra); -} - -let suites_0 = [ - "basename", - param => ({ - TAG: "Eq", - _0: basename("b/c/a.b"), - _1: "a.b" - }) -]; - -let suites = { - hd: suites_0, - tl: /* [] */0 -}; - -Mt.from_pair_suites("Inline_regression_test", suites); - -let $$String; - -exports.$$String = $$String; -exports.generic_basename = generic_basename; -exports.basename = basename; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/inline_regression_test.mjs b/tests/tests/src/inline_regression_test.mjs new file mode 100644 index 0000000000..334eccca8b --- /dev/null +++ b/tests/tests/src/inline_regression_test.mjs @@ -0,0 +1,64 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function generic_basename(is_dir_sep, current_dir_name, name) { + if (name === "") { + return current_dir_name; + } else { + let _n = name.length - 1 | 0; + while (true) { + let n = _n; + if (n < 0) { + return name.substr(0, 1); + } + if (!is_dir_sep(name, n)) { + let _n$1 = n; + let p = n + 1 | 0; + while (true) { + let n$1 = _n$1; + if (n$1 < 0) { + return name.substr(0, p); + } + if (is_dir_sep(name, n$1)) { + return name.substr(n$1 + 1 | 0, (p - n$1 | 0) - 1 | 0); + } + _n$1 = n$1 - 1 | 0; + continue; + }; + } + _n = n - 1 | 0; + continue; + }; + } +} + +function basename(extra) { + return generic_basename((s, i) => s.codePointAt(i) === /* '/' */47, "", extra); +} + +let suites_0 = [ + "basename", + param => ({ + TAG: "Eq", + _0: basename("b/c/a.b"), + _1: "a.b" + }) +]; + +let suites = { + hd: suites_0, + tl: /* [] */0 +}; + +Mt.from_pair_suites("Inline_regression_test", suites); + +let $$String; + +export { + $$String, + generic_basename, + basename, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/inline_string_test.js b/tests/tests/src/inline_string_test.js deleted file mode 100644 index c81d1e60ac..0000000000 --- a/tests/tests/src/inline_string_test.js +++ /dev/null @@ -1,28 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -console.log("list"); - -console.log("list"); - -function f(x) { - if (x !== undefined) { - return "Some"; - } else { - return "None"; - } -} - -console.log([ - f(3), - "None", - "Some" -]); - -console.log([ - "A", - "A" -]); - -/* Not a pure module */ diff --git a/tests/tests/src/inline_string_test.mjs b/tests/tests/src/inline_string_test.mjs new file mode 100644 index 0000000000..c36fe82076 --- /dev/null +++ b/tests/tests/src/inline_string_test.mjs @@ -0,0 +1,27 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +console.log("list"); + +console.log("list"); + +function f(x) { + if (x !== undefined) { + return "Some"; + } else { + return "None"; + } +} + +console.log([ + f(3), + "None", + "Some" +]); + +console.log([ + "A", + "A" +]); + +/* Not a pure module */ diff --git a/tests/tests/src/inner_call.js b/tests/tests/src/inner_call.js deleted file mode 100644 index 0c024ff4b5..0000000000 --- a/tests/tests/src/inner_call.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Inner_define = require("./inner_define.js"); - -console.log(Inner_define.N.add(1, 2)); - -function f(x) { - return [ - Inner_define.N0.f1(x), - Inner_define.N0.f2(x, x), - Inner_define.N0.f3(x, x, x), - Inner_define.N1.f2(x, x) - ]; -} - -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/inner_call.mjs b/tests/tests/src/inner_call.mjs new file mode 100644 index 0000000000..97d10f4a59 --- /dev/null +++ b/tests/tests/src/inner_call.mjs @@ -0,0 +1,19 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Inner_define from "./inner_define.mjs"; + +console.log(Inner_define.N.add(1, 2)); + +function f(x) { + return [ + Inner_define.N0.f1(x), + Inner_define.N0.f2(x, x), + Inner_define.N0.f3(x, x, x), + Inner_define.N1.f2(x, x) + ]; +} + +export { + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/inner_define.js b/tests/tests/src/inner_define.js deleted file mode 100644 index adf0620cb6..0000000000 --- a/tests/tests/src/inner_define.js +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function add(x, y) { - return x + y | 0; -} - -let N = { - add: add -}; - -function f1(param) { - -} - -function f2(param, param$1) { - -} - -function f3(param, param$1, param$2) { - -} - -let N0 = { - f1: f1, - f2: f2, - f3: f3 -}; - -function f2$1(param, param$1) { - -} - -function f3$1(param, param$1, param$2) { - -} - -let N1 = { - f2: f2$1, - f3: f3$1 -}; - -exports.N = N; -exports.N0 = N0; -exports.N1 = N1; -/* No side effect */ diff --git a/tests/tests/src/inner_define.mjs b/tests/tests/src/inner_define.mjs new file mode 100644 index 0000000000..91367037f0 --- /dev/null +++ b/tests/tests/src/inner_define.mjs @@ -0,0 +1,48 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function add(x, y) { + return x + y | 0; +} + +let N = { + add: add +}; + +function f1(param) { + +} + +function f2(param, param$1) { + +} + +function f3(param, param$1, param$2) { + +} + +let N0 = { + f1: f1, + f2: f2, + f3: f3 +}; + +function f2$1(param, param$1) { + +} + +function f3$1(param, param$1, param$2) { + +} + +let N1 = { + f2: f2$1, + f3: f3$1 +}; + +export { + N, + N0, + N1, +} +/* No side effect */ diff --git a/tests/tests/src/inner_unused.js b/tests/tests/src/inner_unused.js deleted file mode 100644 index b938658dc5..0000000000 --- a/tests/tests/src/inner_unused.js +++ /dev/null @@ -1,23 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - - -function f(x) { - return x + 3 | 0; -} - -function M(Id) { - let f = x => x; - return { - f: f - }; -} - -function fff(param, param$1) { - return 3; -} - -exports.f = f; -exports.M = M; -exports.fff = fff; -/* No side effect */ diff --git a/tests/tests/src/inner_unused.mjs b/tests/tests/src/inner_unused.mjs new file mode 100644 index 0000000000..ec09ffe4eb --- /dev/null +++ b/tests/tests/src/inner_unused.mjs @@ -0,0 +1,24 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + + +function f(x) { + return x + 3 | 0; +} + +function M(Id) { + let f = x => x; + return { + f: f + }; +} + +function fff(param, param$1) { + return 3; +} + +export { + f, + M, + fff, +} +/* No side effect */ diff --git a/tests/tests/src/installation_test.js b/tests/tests/src/installation_test.js deleted file mode 100644 index 17e63f6ae5..0000000000 --- a/tests/tests/src/installation_test.js +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -Mt.from_pair_suites("Installation_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/installation_test.mjs b/tests/tests/src/installation_test.mjs new file mode 100644 index 0000000000..b6ea863332 --- /dev/null +++ b/tests/tests/src/installation_test.mjs @@ -0,0 +1,35 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +Mt.from_pair_suites("Installation_test", suites.contents); + +export { + suites, + test_id, + eq, +} +/* Not a pure module */ diff --git a/tests/tests/src/int_map.js b/tests/tests/src/int_map.js deleted file mode 100644 index f83e958ae5..0000000000 --- a/tests/tests/src/int_map.js +++ /dev/null @@ -1,20 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Belt_Id = require("rescript/lib/js/Belt_Id.js"); -let Belt_Map = require("rescript/lib/js/Belt_Map.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -let cmp = Primitive_object.compare; - -let IntCmp = Belt_Id.MakeComparable({ - cmp: cmp -}); - -let m = Belt_Map.make(IntCmp); - -let m$1 = Belt_Map.set(m, 0, "test"); - -exports.IntCmp = IntCmp; -exports.m = m$1; -/* IntCmp Not a pure module */ diff --git a/tests/tests/src/int_map.mjs b/tests/tests/src/int_map.mjs new file mode 100644 index 0000000000..3a25527bc5 --- /dev/null +++ b/tests/tests/src/int_map.mjs @@ -0,0 +1,21 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Belt_Id from "rescript/lib/es6/Belt_Id.js"; +import * as Belt_Map from "rescript/lib/es6/Belt_Map.js"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +let cmp = Primitive_object.compare; + +let IntCmp = Belt_Id.MakeComparable({ + cmp: cmp +}); + +let m = Belt_Map.make(IntCmp); + +let m$1 = Belt_Map.set(m, 0, "test"); + +export { + IntCmp, + m$1 as m, +} +/* IntCmp Not a pure module */ diff --git a/tests/tests/src/int_overflow_test.js b/tests/tests/src/int_overflow_test.js deleted file mode 100644 index b484e987bd..0000000000 --- a/tests/tests/src/int_overflow_test.js +++ /dev/null @@ -1,173 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function hash_variant(s) { - let accu = 0; - for (let i = 0, i_finish = s.length; i < i_finish; ++i) { - accu = Math.imul(223, accu) + s.codePointAt(i) & 2147483647; - } - if (accu > 1073741823) { - return accu - -2147483648 | 0; - } else { - return accu; - } -} - -function hash_variant2(s) { - let accu = 0; - for (let i = 0, i_finish = s.length; i < i_finish; ++i) { - accu = Math.imul(223, accu) + s.codePointAt(i) | 0; - } - accu = accu & 2147483647; - if (accu > 1073741823) { - return accu - -2147483648 | 0; - } else { - return accu; - } -} - -function fib(x) { - if (x === 0 || x === 1) { - return 1; - } else { - return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; - } -} - -Mt.from_pair_suites("Int_overflow_test", { - hd: [ - "plus_overflow", - () => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "minus_overflow", - () => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "flow_again", - () => ({ - TAG: "Eq", - _0: 2147483646, - _1: 2147483646 - }) - ], - tl: { - hd: [ - "flow_again", - () => ({ - TAG: "Eq", - _0: -2, - _1: -2 - }) - ], - tl: { - hd: [ - "hash_test", - () => ({ - TAG: "Eq", - _0: hash_variant("xxyyzzuuxxzzyy00112233"), - _1: 544087776 - }) - ], - tl: { - hd: [ - "hash_test2", - () => ({ - TAG: "Eq", - _0: hash_variant("xxyyzxzzyy"), - _1: -449896130 - }) - ], - tl: { - hd: [ - "File \"int_overflow_test.res\", line 74, characters 5-12", - () => ({ - TAG: "Eq", - _0: hash_variant2("xxyyzzuuxxzzyy00112233"), - _1: 544087776 - }) - ], - tl: { - hd: [ - "File \"int_overflow_test.res\", line 75, characters 5-12", - () => ({ - TAG: "Eq", - _0: hash_variant2("xxyyzxzzyy"), - _1: -449896130 - }) - ], - tl: { - hd: [ - "int_literal_flow", - () => ({ - TAG: "Eq", - _0: -1, - _1: -1 - }) - ], - tl: { - hd: [ - "int_literal_flow2", - () => ({ - TAG: "Eq", - _0: -1, - _1: -1 - }) - ], - tl: { - hd: [ - "File \"int_overflow_test.res\", line 78, characters 5-12", - () => ({ - TAG: "Eq", - _0: Number("3") | 0, - _1: 3 - }) - ], - tl: { - hd: [ - "File \"int_overflow_test.res\", line 80, characters 5-12", - () => ({ - TAG: "Eq", - _0: Number("3.2") | 0, - _1: 3 - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } -}); - -let $$String; - -let max_int = 2147483647; - -let min_int = -2147483648; - -exports.$$String = $$String; -exports.max_int = max_int; -exports.min_int = min_int; -exports.hash_variant = hash_variant; -exports.hash_variant2 = hash_variant2; -exports.fib = fib; -/* Not a pure module */ diff --git a/tests/tests/src/int_overflow_test.mjs b/tests/tests/src/int_overflow_test.mjs new file mode 100644 index 0000000000..8f44d3aae1 --- /dev/null +++ b/tests/tests/src/int_overflow_test.mjs @@ -0,0 +1,174 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function hash_variant(s) { + let accu = 0; + for (let i = 0, i_finish = s.length; i < i_finish; ++i) { + accu = Math.imul(223, accu) + s.codePointAt(i) & 2147483647; + } + if (accu > 1073741823) { + return accu - -2147483648 | 0; + } else { + return accu; + } +} + +function hash_variant2(s) { + let accu = 0; + for (let i = 0, i_finish = s.length; i < i_finish; ++i) { + accu = Math.imul(223, accu) + s.codePointAt(i) | 0; + } + accu = accu & 2147483647; + if (accu > 1073741823) { + return accu - -2147483648 | 0; + } else { + return accu; + } +} + +function fib(x) { + if (x === 0 || x === 1) { + return 1; + } else { + return fib(x - 1 | 0) + fib(x - 2 | 0) | 0; + } +} + +Mt.from_pair_suites("Int_overflow_test", { + hd: [ + "plus_overflow", + () => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "minus_overflow", + () => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "flow_again", + () => ({ + TAG: "Eq", + _0: 2147483646, + _1: 2147483646 + }) + ], + tl: { + hd: [ + "flow_again", + () => ({ + TAG: "Eq", + _0: -2, + _1: -2 + }) + ], + tl: { + hd: [ + "hash_test", + () => ({ + TAG: "Eq", + _0: hash_variant("xxyyzzuuxxzzyy00112233"), + _1: 544087776 + }) + ], + tl: { + hd: [ + "hash_test2", + () => ({ + TAG: "Eq", + _0: hash_variant("xxyyzxzzyy"), + _1: -449896130 + }) + ], + tl: { + hd: [ + "File \"int_overflow_test.res\", line 74, characters 5-12", + () => ({ + TAG: "Eq", + _0: hash_variant2("xxyyzzuuxxzzyy00112233"), + _1: 544087776 + }) + ], + tl: { + hd: [ + "File \"int_overflow_test.res\", line 75, characters 5-12", + () => ({ + TAG: "Eq", + _0: hash_variant2("xxyyzxzzyy"), + _1: -449896130 + }) + ], + tl: { + hd: [ + "int_literal_flow", + () => ({ + TAG: "Eq", + _0: -1, + _1: -1 + }) + ], + tl: { + hd: [ + "int_literal_flow2", + () => ({ + TAG: "Eq", + _0: -1, + _1: -1 + }) + ], + tl: { + hd: [ + "File \"int_overflow_test.res\", line 78, characters 5-12", + () => ({ + TAG: "Eq", + _0: Number("3") | 0, + _1: 3 + }) + ], + tl: { + hd: [ + "File \"int_overflow_test.res\", line 80, characters 5-12", + () => ({ + TAG: "Eq", + _0: Number("3.2") | 0, + _1: 3 + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } +}); + +let $$String; + +let max_int = 2147483647; + +let min_int = -2147483648; + +export { + $$String, + max_int, + min_int, + hash_variant, + hash_variant2, + fib, +} +/* Not a pure module */ diff --git a/tests/tests/src/int_poly_var.js b/tests/tests/src/int_poly_var.js deleted file mode 100644 index 2b8b98f150..0000000000 --- a/tests/tests/src/int_poly_var.js +++ /dev/null @@ -1,199 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let test_id = { - contents: 0 -}; - -let suites = { - contents: /* [] */0 -}; - -function nest(x) { - if (x.TAG === "A") { - let match = x._0; - if (match === 0) { - return 0; - } else if (match === 1) { - return 1; - } else { - return 2; - } - } - let match$1 = x._0; - if (x._1 !== 0) { - if (match$1 === 1) { - return 4; - } else if (match$1 === 2) { - return 5; - } else { - return 6; - } - } else { - return 3; - } -} - -function f2(x, b) { - if (x === 1) { - return b; - } else if (x === 2) { - return 0; - } else if (x === "c") { - return 33; - } else { - return 3; - } -} - -function f3(x, b) { - if (typeof x !== "object") { - return 3; - } - let variant = x.NAME; - if (variant === 32) { - return x.VAL[0]; - } else if (variant === 333) { - return x.VAL[1]; - } else { - return x.VAL; - } -} - -function h(x) { - return x === 0; -} - -let g = /* 'b' */98; - -let hihi = f3(3, 0); - -let hh10 = "3" === 3; - -let tuple_0 = nest({ - TAG: "A", - _0: 0 -}); - -let tuple_1 = nest({ - TAG: "A", - _0: 1 -}); - -let tuple_2 = nest({ - TAG: "A", - _0: 2 -}); - -let tuple_3 = nest({ - TAG: "B", - _0: 1, - _1: 0 -}); - -let tuple_4 = nest({ - TAG: "B", - _0: 1, - _1: 1 -}); - -let tuple_5 = nest({ - TAG: "B", - _0: 2, - _1: 1 -}); - -let tuple_6 = nest({ - TAG: "B", - _0: 2, - _1: 2 -}); - -let tuple_7 = nest({ - TAG: "B", - _0: 0, - _1: 0 -}); - -let tuple_8 = nest({ - TAG: "B", - _0: 0, - _1: 1 -}); - -let tuple = [ - tuple_0, - tuple_1, - tuple_2, - tuple_3, - tuple_4, - tuple_5, - tuple_6, - tuple_7, - tuple_8, - true, - hh10 -]; - -Mt.eq_suites(test_id, suites, "File \"int_poly_var.res\", line 79, characters 29-36", hihi, 3); - -Mt.eq_suites(test_id, suites, "File \"int_poly_var.res\", line 80, characters 29-36", tuple, [ - 0, - 1, - 2, - 3, - 4, - 5, - 5, - 3, - 6, - true, - false -]); - -function hh0(x) { - return x; -} - -function hh1(x) { - return x; -} - -function f(x) { - if (x.NAME === 1) { - return x.VAL; - } else { - return x.VAL.toString(); - } -} - -Mt.from_pair_suites("int_poly_var.res", suites.contents); - -let eq_suites = Mt.eq_suites; - -let u = 1; - -let hh9 = true; - -let begin = 3; - -exports.eq_suites = eq_suites; -exports.test_id = test_id; -exports.suites = suites; -exports.u = u; -exports.nest = nest; -exports.f2 = f2; -exports.f3 = f3; -exports.h = h; -exports.g = g; -exports.hihi = hihi; -exports.hh9 = hh9; -exports.hh10 = hh10; -exports.tuple = tuple; -exports.begin = begin; -exports.hh0 = hh0; -exports.hh1 = hh1; -exports.f = f; -/* hihi Not a pure module */ diff --git a/tests/tests/src/int_poly_var.mjs b/tests/tests/src/int_poly_var.mjs new file mode 100644 index 0000000000..0311dd926c --- /dev/null +++ b/tests/tests/src/int_poly_var.mjs @@ -0,0 +1,200 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let test_id = { + contents: 0 +}; + +let suites = { + contents: /* [] */0 +}; + +function nest(x) { + if (x.TAG === "A") { + let match = x._0; + if (match === 0) { + return 0; + } else if (match === 1) { + return 1; + } else { + return 2; + } + } + let match$1 = x._0; + if (x._1 !== 0) { + if (match$1 === 1) { + return 4; + } else if (match$1 === 2) { + return 5; + } else { + return 6; + } + } else { + return 3; + } +} + +function f2(x, b) { + if (x === 1) { + return b; + } else if (x === 2) { + return 0; + } else if (x === "c") { + return 33; + } else { + return 3; + } +} + +function f3(x, b) { + if (typeof x !== "object") { + return 3; + } + let variant = x.NAME; + if (variant === 32) { + return x.VAL[0]; + } else if (variant === 333) { + return x.VAL[1]; + } else { + return x.VAL; + } +} + +function h(x) { + return x === 0; +} + +let g = /* 'b' */98; + +let hihi = f3(3, 0); + +let hh10 = "3" === 3; + +let tuple_0 = nest({ + TAG: "A", + _0: 0 +}); + +let tuple_1 = nest({ + TAG: "A", + _0: 1 +}); + +let tuple_2 = nest({ + TAG: "A", + _0: 2 +}); + +let tuple_3 = nest({ + TAG: "B", + _0: 1, + _1: 0 +}); + +let tuple_4 = nest({ + TAG: "B", + _0: 1, + _1: 1 +}); + +let tuple_5 = nest({ + TAG: "B", + _0: 2, + _1: 1 +}); + +let tuple_6 = nest({ + TAG: "B", + _0: 2, + _1: 2 +}); + +let tuple_7 = nest({ + TAG: "B", + _0: 0, + _1: 0 +}); + +let tuple_8 = nest({ + TAG: "B", + _0: 0, + _1: 1 +}); + +let tuple = [ + tuple_0, + tuple_1, + tuple_2, + tuple_3, + tuple_4, + tuple_5, + tuple_6, + tuple_7, + tuple_8, + true, + hh10 +]; + +Mt.eq_suites(test_id, suites, "File \"int_poly_var.res\", line 79, characters 29-36", hihi, 3); + +Mt.eq_suites(test_id, suites, "File \"int_poly_var.res\", line 80, characters 29-36", tuple, [ + 0, + 1, + 2, + 3, + 4, + 5, + 5, + 3, + 6, + true, + false +]); + +function hh0(x) { + return x; +} + +function hh1(x) { + return x; +} + +function f(x) { + if (x.NAME === 1) { + return x.VAL; + } else { + return x.VAL.toString(); + } +} + +Mt.from_pair_suites("int_poly_var.res", suites.contents); + +let eq_suites = Mt.eq_suites; + +let u = 1; + +let hh9 = true; + +let begin = 3; + +export { + eq_suites, + test_id, + suites, + u, + nest, + f2, + f3, + h, + g, + hihi, + hh9, + hh10, + tuple, + begin, + hh0, + hh1, + f, +} +/* hihi Not a pure module */ diff --git a/tests/tests/src/int_switch_test.js b/tests/tests/src/int_switch_test.js deleted file mode 100644 index 54e513b7bf..0000000000 --- a/tests/tests/src/int_switch_test.js +++ /dev/null @@ -1,83 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.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 f(x) { - let match = x(); - switch (match) { - case 1 : - return /* 'a' */97; - case 2 : - return /* 'b' */98; - case 3 : - return /* 'c' */99; - default: - return /* 'x' */120; - } -} - -function f22(x) { - let match = x(); - switch (match) { - case 1 : - return /* 'a' */97; - case 2 : - return /* 'b' */98; - case 3 : - return /* 'c' */99; - default: - return /* 'x' */120; - } -} - -function f33(x) { - let match = x(); - switch (match) { - case "A" : - return /* 'a' */97; - case "B" : - return /* 'b' */98; - case "C" : - return /* 'c' */99; - case "D" : - return /* 'x' */120; - } -} - -eq("File \"int_switch_test.res\", line 32, characters 3-10", f(() => 1), /* 'a' */97); - -eq("File \"int_switch_test.res\", line 33, characters 3-10", f(() => 2), /* 'b' */98); - -eq("File \"int_switch_test.res\", line 34, characters 3-10", f(() => 3), /* 'c' */99); - -eq("File \"int_switch_test.res\", line 35, characters 3-10", f(() => 0), /* 'x' */120); - -eq("File \"int_switch_test.res\", line 36, characters 3-10", f(() => -1), /* 'x' */120); - -Mt.from_pair_suites("Int_switch_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.b = b; -exports.f = f; -exports.f22 = f22; -exports.f33 = f33; -/* Not a pure module */ diff --git a/tests/tests/src/int_switch_test.mjs b/tests/tests/src/int_switch_test.mjs new file mode 100644 index 0000000000..73a1f8a314 --- /dev/null +++ b/tests/tests/src/int_switch_test.mjs @@ -0,0 +1,84 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +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 f(x) { + let match = x(); + switch (match) { + case 1 : + return /* 'a' */97; + case 2 : + return /* 'b' */98; + case 3 : + return /* 'c' */99; + default: + return /* 'x' */120; + } +} + +function f22(x) { + let match = x(); + switch (match) { + case 1 : + return /* 'a' */97; + case 2 : + return /* 'b' */98; + case 3 : + return /* 'c' */99; + default: + return /* 'x' */120; + } +} + +function f33(x) { + let match = x(); + switch (match) { + case "A" : + return /* 'a' */97; + case "B" : + return /* 'b' */98; + case "C" : + return /* 'c' */99; + case "D" : + return /* 'x' */120; + } +} + +eq("File \"int_switch_test.res\", line 32, characters 3-10", f(() => 1), /* 'a' */97); + +eq("File \"int_switch_test.res\", line 33, characters 3-10", f(() => 2), /* 'b' */98); + +eq("File \"int_switch_test.res\", line 34, characters 3-10", f(() => 3), /* 'c' */99); + +eq("File \"int_switch_test.res\", line 35, characters 3-10", f(() => 0), /* 'x' */120); + +eq("File \"int_switch_test.res\", line 36, characters 3-10", f(() => -1), /* 'x' */120); + +Mt.from_pair_suites("Int_switch_test", suites.contents); + +export { + suites, + test_id, + eq, + b, + f, + f22, + f33, +} +/* Not a pure module */ diff --git a/tests/tests/src/internal_unused_test.js b/tests/tests/src/internal_unused_test.js deleted file mode 100644 index f5779acf9b..0000000000 --- a/tests/tests/src/internal_unused_test.js +++ /dev/null @@ -1,48 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -console.log(3); - -let A = /* @__PURE__ */Primitive_exceptions.create("Internal_unused_test.P1.A"); - -function f() { - throw { - RE_EXN_ID: A, - Error: new Error() - }; -} - -let c = 5; - -let h1 = 2; - -let h2 = h1 + 1 | 0; - -let h4 = 2; - -let h5 = h4 + 1 | 0; - -let b = 5; - -let N = { - b: b -}; - -console.log(h5); - -console.log(h2); - -console.log(c); - -console.log(3); - -function H($star) { - return {}; -} - -exports.f = f; -exports.N = N; -exports.H = H; -/* Not a pure module */ diff --git a/tests/tests/src/internal_unused_test.mjs b/tests/tests/src/internal_unused_test.mjs new file mode 100644 index 0000000000..e671df9174 --- /dev/null +++ b/tests/tests/src/internal_unused_test.mjs @@ -0,0 +1,49 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +console.log(3); + +let A = /* @__PURE__ */Primitive_exceptions.create("Internal_unused_test.P1.A"); + +function f() { + throw { + RE_EXN_ID: A, + Error: new Error() + }; +} + +let c = 5; + +let h1 = 2; + +let h2 = h1 + 1 | 0; + +let h4 = 2; + +let h5 = h4 + 1 | 0; + +let b = 5; + +let N = { + b: b +}; + +console.log(h5); + +console.log(h2); + +console.log(c); + +console.log(3); + +function H($star) { + return {}; +} + +export { + f, + N, + H, +} +/* Not a pure module */ diff --git a/tests/tests/src/joinClasses.js b/tests/tests/src/joinClasses.js deleted file mode 100644 index d8309c66e9..0000000000 --- a/tests/tests/src/joinClasses.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function(){ - var sum = 0 ; - var i = 0; - for(; i < arguments.length ; ++ i){ - sum += arguments[i] - } - return sum -} \ No newline at end of file diff --git a/tests/tests/src/joinClasses.mjs b/tests/tests/src/joinClasses.mjs new file mode 100644 index 0000000000..1429898013 --- /dev/null +++ b/tests/tests/src/joinClasses.mjs @@ -0,0 +1,8 @@ +export default function(){ + var sum = 0 ; + var i = 0; + for(; i < arguments.length ; ++ i){ + sum += arguments[i] + } + return sum +} \ No newline at end of file diff --git a/tests/tests/src/js_array_test.js b/tests/tests/src/js_array_test.js deleted file mode 100644 index 47a28e403d..0000000000 --- a/tests/tests/src/js_array_test.js +++ /dev/null @@ -1,1006 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites_0 = [ - "isArray_array", - param => ({ - TAG: "Eq", - _0: true, - _1: Array.isArray([]) - }) -]; - -let suites_1 = { - hd: [ - "isArray_int", - param => ({ - TAG: "Eq", - _0: false, - _1: Array.isArray(34) - }) - ], - tl: { - hd: [ - "length", - param => ({ - TAG: "Eq", - _0: 3, - _1: [ - 1, - 2, - 3 - ].length - }) - ], - tl: { - hd: [ - "copyWithin", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3, - 1, - 2 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].copyWithin(-2) - }) - ], - tl: { - hd: [ - "copyWithinFrom", - param => ({ - TAG: "Eq", - _0: [ - 4, - 5, - 3, - 4, - 5 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].copyWithin(0, 3) - }) - ], - tl: { - hd: [ - "copyWithinFromRange", - param => ({ - TAG: "Eq", - _0: [ - 4, - 2, - 3, - 4, - 5 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].copyWithin(0, 3, 4) - }) - ], - tl: { - hd: [ - "fillInPlace", - param => ({ - TAG: "Eq", - _0: [ - 4, - 4, - 4 - ], - _1: [ - 1, - 2, - 3 - ].fill(4) - }) - ], - tl: { - hd: [ - "fillFromInPlace", - param => ({ - TAG: "Eq", - _0: [ - 1, - 4, - 4 - ], - _1: [ - 1, - 2, - 3 - ].fill(4, 1) - }) - ], - tl: { - hd: [ - "fillRangeInPlace", - param => ({ - TAG: "Eq", - _0: [ - 1, - 4, - 3 - ], - _1: [ - 1, - 2, - 3 - ].fill(4, 1, 2) - }) - ], - tl: { - hd: [ - "pop", - param => ({ - TAG: "Eq", - _0: 3, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3 - ].pop()) - }) - ], - tl: { - hd: [ - "pop - empty array", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Primitive_option.fromUndefined([].pop()) - }) - ], - tl: { - hd: [ - "push", - param => ({ - TAG: "Eq", - _0: 4, - _1: [ - 1, - 2, - 3 - ].push(4) - }) - ], - tl: { - hd: [ - "pushMany", - param => ({ - TAG: "Eq", - _0: 5, - _1: [ - 1, - 2, - 3 - ].push(4, 5) - }) - ], - tl: { - hd: [ - "reverseInPlace", - param => ({ - TAG: "Eq", - _0: [ - 3, - 2, - 1 - ], - _1: [ - 1, - 2, - 3 - ].reverse() - }) - ], - tl: { - hd: [ - "shift", - param => ({ - TAG: "Eq", - _0: 1, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3 - ].shift()) - }) - ], - tl: { - hd: [ - "shift - empty array", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Primitive_option.fromUndefined([].shift()) - }) - ], - tl: { - hd: [ - "sortInPlace", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3 - ], - _1: [ - 3, - 1, - 2 - ].sort() - }) - ], - tl: { - hd: [ - "sortInPlaceWith", - param => ({ - TAG: "Eq", - _0: [ - 3, - 2, - 1 - ], - _1: [ - 3, - 1, - 2 - ].sort((a, b) => b - a | 0) - }) - ], - tl: { - hd: [ - "spliceInPlace", - param => { - let arr = [ - 1, - 2, - 3, - 4 - ]; - let removed = arr.splice(2, 0, 5); - return { - TAG: "Eq", - _0: [ - [ - 1, - 2, - 5, - 3, - 4 - ], - [] - ], - _1: [ - arr, - removed - ] - }; - } - ], - tl: { - hd: [ - "removeFromInPlace", - param => { - let arr = [ - 1, - 2, - 3, - 4 - ]; - let removed = arr.splice(2); - return { - TAG: "Eq", - _0: [ - [ - 1, - 2 - ], - [ - 3, - 4 - ] - ], - _1: [ - arr, - removed - ] - }; - } - ], - tl: { - hd: [ - "removeCountInPlace", - param => { - let arr = [ - 1, - 2, - 3, - 4 - ]; - let removed = arr.splice(2, 1); - return { - TAG: "Eq", - _0: [ - [ - 1, - 2, - 4 - ], - [3] - ], - _1: [ - arr, - removed - ] - }; - } - ], - tl: { - hd: [ - "unshift", - param => ({ - TAG: "Eq", - _0: 4, - _1: [ - 1, - 2, - 3 - ].unshift(4) - }) - ], - tl: { - hd: [ - "unshiftMany", - param => ({ - TAG: "Eq", - _0: 5, - _1: [ - 1, - 2, - 3 - ].unshift(4, 5) - }) - ], - tl: { - hd: [ - "append", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3, - 4 - ], - _1: [ - 1, - 2, - 3 - ].concat([4]) - }) - ], - tl: { - hd: [ - "concat", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3, - 4, - 5 - ], - _1: [ - 1, - 2, - 3 - ].concat([ - 4, - 5 - ]) - }) - ], - tl: { - hd: [ - "concatMany", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3, - 4, - 5, - 6, - 7 - ], - _1: [ - 1, - 2, - 3 - ].concat([ - 4, - 5 - ], [ - 6, - 7 - ]) - }) - ], - tl: { - hd: [ - "includes", - param => ({ - TAG: "Eq", - _0: true, - _1: [ - 1, - 2, - 3 - ].includes(3) - }) - ], - tl: { - hd: [ - "indexOf", - param => ({ - TAG: "Eq", - _0: 1, - _1: [ - 1, - 2, - 3 - ].indexOf(2) - }) - ], - tl: { - hd: [ - "indexOfFrom", - param => ({ - TAG: "Eq", - _0: 3, - _1: [ - 1, - 2, - 3, - 2 - ].indexOf(2, 2) - }) - ], - tl: { - hd: [ - "join", - param => ({ - TAG: "Eq", - _0: "1,2,3", - _1: [ - 1, - 2, - 3 - ].join() - }) - ], - tl: { - hd: [ - "joinWith", - param => ({ - TAG: "Eq", - _0: "1;2;3", - _1: [ - 1, - 2, - 3 - ].join(";") - }) - ], - tl: { - hd: [ - "lastIndexOf", - param => ({ - TAG: "Eq", - _0: 1, - _1: [ - 1, - 2, - 3 - ].lastIndexOf(2) - }) - ], - tl: { - hd: [ - "lastIndexOfFrom", - param => ({ - TAG: "Eq", - _0: 1, - _1: [ - 1, - 2, - 3, - 2 - ].lastIndexOf(2, 2) - }) - ], - tl: { - hd: [ - "slice", - param => ({ - TAG: "Eq", - _0: [ - 2, - 3 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].slice(1, 3) - }) - ], - tl: { - hd: [ - "copy", - param => ({ - TAG: "Eq", - _0: [ - 1, - 2, - 3, - 4, - 5 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].slice() - }) - ], - tl: { - hd: [ - "sliceFrom", - param => ({ - TAG: "Eq", - _0: [ - 3, - 4, - 5 - ], - _1: [ - 1, - 2, - 3, - 4, - 5 - ].slice(2) - }) - ], - tl: { - hd: [ - "toString", - param => ({ - TAG: "Eq", - _0: "1,2,3", - _1: [ - 1, - 2, - 3 - ].toString() - }) - ], - tl: { - hd: [ - "toLocaleString", - param => ({ - TAG: "Eq", - _0: "1,2,3", - _1: [ - 1, - 2, - 3 - ].toLocaleString() - }) - ], - tl: { - hd: [ - "every", - param => ({ - TAG: "Eq", - _0: true, - _1: [ - 1, - 2, - 3 - ].every(n => n > 0) - }) - ], - tl: { - hd: [ - "everyi", - param => ({ - TAG: "Eq", - _0: false, - _1: [ - 1, - 2, - 3 - ].every((param, i) => i > 0) - }) - ], - tl: { - hd: [ - "filter", - param => ({ - TAG: "Eq", - _0: [ - 2, - 4 - ], - _1: [ - 1, - 2, - 3, - 4 - ].filter(n => n % 2 === 0) - }) - ], - tl: { - hd: [ - "filteri", - param => ({ - TAG: "Eq", - _0: [ - 1, - 3 - ], - _1: [ - 1, - 2, - 3, - 4 - ].filter((param, i) => i % 2 === 0) - }) - ], - tl: { - hd: [ - "find", - param => ({ - TAG: "Eq", - _0: 2, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3, - 4 - ].find(n => n % 2 === 0)) - }) - ], - tl: { - hd: [ - "find - no match", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3, - 4 - ].find(n => n % 2 === 5)) - }) - ], - tl: { - hd: [ - "findi", - param => ({ - TAG: "Eq", - _0: 1, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3, - 4 - ].find((param, i) => i % 2 === 0)) - }) - ], - tl: { - hd: [ - "findi - no match", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Primitive_option.fromUndefined([ - 1, - 2, - 3, - 4 - ].find((param, i) => i % 2 === 5)) - }) - ], - tl: { - hd: [ - "findIndex", - param => ({ - TAG: "Eq", - _0: 1, - _1: [ - 1, - 2, - 3, - 4 - ].findIndex(n => n % 2 === 0) - }) - ], - tl: { - hd: [ - "findIndexi", - param => ({ - TAG: "Eq", - _0: 0, - _1: [ - 1, - 2, - 3, - 4 - ].findIndex((param, i) => i % 2 === 0) - }) - ], - tl: { - hd: [ - "forEach", - param => { - let sum = { - contents: 0 - }; - [ - 1, - 2, - 3 - ].forEach(n => { - sum.contents = sum.contents + n | 0; - }); - return { - TAG: "Eq", - _0: 6, - _1: sum.contents - }; - } - ], - tl: { - hd: [ - "forEachi", - param => { - let sum = { - contents: 0 - }; - [ - 1, - 2, - 3 - ].forEach((param, i) => { - sum.contents = sum.contents + i | 0; - }); - return { - TAG: "Eq", - _0: 3, - _1: sum.contents - }; - } - ], - tl: { - hd: [ - "map", - param => ({ - TAG: "Eq", - _0: [ - 2, - 4, - 6, - 8 - ], - _1: [ - 1, - 2, - 3, - 4 - ].map(n => (n << 1)) - }) - ], - tl: { - hd: [ - "map", - param => ({ - TAG: "Eq", - _0: [ - 0, - 2, - 4, - 6 - ], - _1: [ - 1, - 2, - 3, - 4 - ].map((param, i) => (i << 1)) - }) - ], - tl: { - hd: [ - "reduce", - param => ({ - TAG: "Eq", - _0: -10, - _1: [ - 1, - 2, - 3, - 4 - ].reduce((acc, n) => acc - n | 0, 0) - }) - ], - tl: { - hd: [ - "reducei", - param => ({ - TAG: "Eq", - _0: -6, - _1: [ - 1, - 2, - 3, - 4 - ].reduce((acc, param, i) => acc - i | 0, 0) - }) - ], - tl: { - hd: [ - "reduceRight", - param => ({ - TAG: "Eq", - _0: -10, - _1: [ - 1, - 2, - 3, - 4 - ].reduceRight((acc, n) => acc - n | 0, 0) - }) - ], - tl: { - hd: [ - "reduceRighti", - param => ({ - TAG: "Eq", - _0: -6, - _1: [ - 1, - 2, - 3, - 4 - ].reduceRight((acc, param, i) => acc - i | 0, 0) - }) - ], - tl: { - hd: [ - "some", - param => ({ - TAG: "Eq", - _0: false, - _1: [ - 1, - 2, - 3, - 4 - ].some(n => n <= 0) - }) - ], - tl: { - hd: [ - "somei", - param => ({ - TAG: "Eq", - _0: true, - _1: [ - 1, - 2, - 3, - 4 - ].some((param, i) => i <= 0) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_array_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_array_test.mjs b/tests/tests/src/js_array_test.mjs new file mode 100644 index 0000000000..9b14eaf969 --- /dev/null +++ b/tests/tests/src/js_array_test.mjs @@ -0,0 +1,1007 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let suites_0 = [ + "isArray_array", + param => ({ + TAG: "Eq", + _0: true, + _1: Array.isArray([]) + }) +]; + +let suites_1 = { + hd: [ + "isArray_int", + param => ({ + TAG: "Eq", + _0: false, + _1: Array.isArray(34) + }) + ], + tl: { + hd: [ + "length", + param => ({ + TAG: "Eq", + _0: 3, + _1: [ + 1, + 2, + 3 + ].length + }) + ], + tl: { + hd: [ + "copyWithin", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3, + 1, + 2 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].copyWithin(-2) + }) + ], + tl: { + hd: [ + "copyWithinFrom", + param => ({ + TAG: "Eq", + _0: [ + 4, + 5, + 3, + 4, + 5 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].copyWithin(0, 3) + }) + ], + tl: { + hd: [ + "copyWithinFromRange", + param => ({ + TAG: "Eq", + _0: [ + 4, + 2, + 3, + 4, + 5 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].copyWithin(0, 3, 4) + }) + ], + tl: { + hd: [ + "fillInPlace", + param => ({ + TAG: "Eq", + _0: [ + 4, + 4, + 4 + ], + _1: [ + 1, + 2, + 3 + ].fill(4) + }) + ], + tl: { + hd: [ + "fillFromInPlace", + param => ({ + TAG: "Eq", + _0: [ + 1, + 4, + 4 + ], + _1: [ + 1, + 2, + 3 + ].fill(4, 1) + }) + ], + tl: { + hd: [ + "fillRangeInPlace", + param => ({ + TAG: "Eq", + _0: [ + 1, + 4, + 3 + ], + _1: [ + 1, + 2, + 3 + ].fill(4, 1, 2) + }) + ], + tl: { + hd: [ + "pop", + param => ({ + TAG: "Eq", + _0: 3, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3 + ].pop()) + }) + ], + tl: { + hd: [ + "pop - empty array", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Primitive_option.fromUndefined([].pop()) + }) + ], + tl: { + hd: [ + "push", + param => ({ + TAG: "Eq", + _0: 4, + _1: [ + 1, + 2, + 3 + ].push(4) + }) + ], + tl: { + hd: [ + "pushMany", + param => ({ + TAG: "Eq", + _0: 5, + _1: [ + 1, + 2, + 3 + ].push(4, 5) + }) + ], + tl: { + hd: [ + "reverseInPlace", + param => ({ + TAG: "Eq", + _0: [ + 3, + 2, + 1 + ], + _1: [ + 1, + 2, + 3 + ].reverse() + }) + ], + tl: { + hd: [ + "shift", + param => ({ + TAG: "Eq", + _0: 1, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3 + ].shift()) + }) + ], + tl: { + hd: [ + "shift - empty array", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Primitive_option.fromUndefined([].shift()) + }) + ], + tl: { + hd: [ + "sortInPlace", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3 + ], + _1: [ + 3, + 1, + 2 + ].sort() + }) + ], + tl: { + hd: [ + "sortInPlaceWith", + param => ({ + TAG: "Eq", + _0: [ + 3, + 2, + 1 + ], + _1: [ + 3, + 1, + 2 + ].sort((a, b) => b - a | 0) + }) + ], + tl: { + hd: [ + "spliceInPlace", + param => { + let arr = [ + 1, + 2, + 3, + 4 + ]; + let removed = arr.splice(2, 0, 5); + return { + TAG: "Eq", + _0: [ + [ + 1, + 2, + 5, + 3, + 4 + ], + [] + ], + _1: [ + arr, + removed + ] + }; + } + ], + tl: { + hd: [ + "removeFromInPlace", + param => { + let arr = [ + 1, + 2, + 3, + 4 + ]; + let removed = arr.splice(2); + return { + TAG: "Eq", + _0: [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + _1: [ + arr, + removed + ] + }; + } + ], + tl: { + hd: [ + "removeCountInPlace", + param => { + let arr = [ + 1, + 2, + 3, + 4 + ]; + let removed = arr.splice(2, 1); + return { + TAG: "Eq", + _0: [ + [ + 1, + 2, + 4 + ], + [3] + ], + _1: [ + arr, + removed + ] + }; + } + ], + tl: { + hd: [ + "unshift", + param => ({ + TAG: "Eq", + _0: 4, + _1: [ + 1, + 2, + 3 + ].unshift(4) + }) + ], + tl: { + hd: [ + "unshiftMany", + param => ({ + TAG: "Eq", + _0: 5, + _1: [ + 1, + 2, + 3 + ].unshift(4, 5) + }) + ], + tl: { + hd: [ + "append", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3, + 4 + ], + _1: [ + 1, + 2, + 3 + ].concat([4]) + }) + ], + tl: { + hd: [ + "concat", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3, + 4, + 5 + ], + _1: [ + 1, + 2, + 3 + ].concat([ + 4, + 5 + ]) + }) + ], + tl: { + hd: [ + "concatMany", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + _1: [ + 1, + 2, + 3 + ].concat([ + 4, + 5 + ], [ + 6, + 7 + ]) + }) + ], + tl: { + hd: [ + "includes", + param => ({ + TAG: "Eq", + _0: true, + _1: [ + 1, + 2, + 3 + ].includes(3) + }) + ], + tl: { + hd: [ + "indexOf", + param => ({ + TAG: "Eq", + _0: 1, + _1: [ + 1, + 2, + 3 + ].indexOf(2) + }) + ], + tl: { + hd: [ + "indexOfFrom", + param => ({ + TAG: "Eq", + _0: 3, + _1: [ + 1, + 2, + 3, + 2 + ].indexOf(2, 2) + }) + ], + tl: { + hd: [ + "join", + param => ({ + TAG: "Eq", + _0: "1,2,3", + _1: [ + 1, + 2, + 3 + ].join() + }) + ], + tl: { + hd: [ + "joinWith", + param => ({ + TAG: "Eq", + _0: "1;2;3", + _1: [ + 1, + 2, + 3 + ].join(";") + }) + ], + tl: { + hd: [ + "lastIndexOf", + param => ({ + TAG: "Eq", + _0: 1, + _1: [ + 1, + 2, + 3 + ].lastIndexOf(2) + }) + ], + tl: { + hd: [ + "lastIndexOfFrom", + param => ({ + TAG: "Eq", + _0: 1, + _1: [ + 1, + 2, + 3, + 2 + ].lastIndexOf(2, 2) + }) + ], + tl: { + hd: [ + "slice", + param => ({ + TAG: "Eq", + _0: [ + 2, + 3 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].slice(1, 3) + }) + ], + tl: { + hd: [ + "copy", + param => ({ + TAG: "Eq", + _0: [ + 1, + 2, + 3, + 4, + 5 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].slice() + }) + ], + tl: { + hd: [ + "sliceFrom", + param => ({ + TAG: "Eq", + _0: [ + 3, + 4, + 5 + ], + _1: [ + 1, + 2, + 3, + 4, + 5 + ].slice(2) + }) + ], + tl: { + hd: [ + "toString", + param => ({ + TAG: "Eq", + _0: "1,2,3", + _1: [ + 1, + 2, + 3 + ].toString() + }) + ], + tl: { + hd: [ + "toLocaleString", + param => ({ + TAG: "Eq", + _0: "1,2,3", + _1: [ + 1, + 2, + 3 + ].toLocaleString() + }) + ], + tl: { + hd: [ + "every", + param => ({ + TAG: "Eq", + _0: true, + _1: [ + 1, + 2, + 3 + ].every(n => n > 0) + }) + ], + tl: { + hd: [ + "everyi", + param => ({ + TAG: "Eq", + _0: false, + _1: [ + 1, + 2, + 3 + ].every((param, i) => i > 0) + }) + ], + tl: { + hd: [ + "filter", + param => ({ + TAG: "Eq", + _0: [ + 2, + 4 + ], + _1: [ + 1, + 2, + 3, + 4 + ].filter(n => n % 2 === 0) + }) + ], + tl: { + hd: [ + "filteri", + param => ({ + TAG: "Eq", + _0: [ + 1, + 3 + ], + _1: [ + 1, + 2, + 3, + 4 + ].filter((param, i) => i % 2 === 0) + }) + ], + tl: { + hd: [ + "find", + param => ({ + TAG: "Eq", + _0: 2, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3, + 4 + ].find(n => n % 2 === 0)) + }) + ], + tl: { + hd: [ + "find - no match", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3, + 4 + ].find(n => n % 2 === 5)) + }) + ], + tl: { + hd: [ + "findi", + param => ({ + TAG: "Eq", + _0: 1, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3, + 4 + ].find((param, i) => i % 2 === 0)) + }) + ], + tl: { + hd: [ + "findi - no match", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Primitive_option.fromUndefined([ + 1, + 2, + 3, + 4 + ].find((param, i) => i % 2 === 5)) + }) + ], + tl: { + hd: [ + "findIndex", + param => ({ + TAG: "Eq", + _0: 1, + _1: [ + 1, + 2, + 3, + 4 + ].findIndex(n => n % 2 === 0) + }) + ], + tl: { + hd: [ + "findIndexi", + param => ({ + TAG: "Eq", + _0: 0, + _1: [ + 1, + 2, + 3, + 4 + ].findIndex((param, i) => i % 2 === 0) + }) + ], + tl: { + hd: [ + "forEach", + param => { + let sum = { + contents: 0 + }; + [ + 1, + 2, + 3 + ].forEach(n => { + sum.contents = sum.contents + n | 0; + }); + return { + TAG: "Eq", + _0: 6, + _1: sum.contents + }; + } + ], + tl: { + hd: [ + "forEachi", + param => { + let sum = { + contents: 0 + }; + [ + 1, + 2, + 3 + ].forEach((param, i) => { + sum.contents = sum.contents + i | 0; + }); + return { + TAG: "Eq", + _0: 3, + _1: sum.contents + }; + } + ], + tl: { + hd: [ + "map", + param => ({ + TAG: "Eq", + _0: [ + 2, + 4, + 6, + 8 + ], + _1: [ + 1, + 2, + 3, + 4 + ].map(n => (n << 1)) + }) + ], + tl: { + hd: [ + "map", + param => ({ + TAG: "Eq", + _0: [ + 0, + 2, + 4, + 6 + ], + _1: [ + 1, + 2, + 3, + 4 + ].map((param, i) => (i << 1)) + }) + ], + tl: { + hd: [ + "reduce", + param => ({ + TAG: "Eq", + _0: -10, + _1: [ + 1, + 2, + 3, + 4 + ].reduce((acc, n) => acc - n | 0, 0) + }) + ], + tl: { + hd: [ + "reducei", + param => ({ + TAG: "Eq", + _0: -6, + _1: [ + 1, + 2, + 3, + 4 + ].reduce((acc, param, i) => acc - i | 0, 0) + }) + ], + tl: { + hd: [ + "reduceRight", + param => ({ + TAG: "Eq", + _0: -10, + _1: [ + 1, + 2, + 3, + 4 + ].reduceRight((acc, n) => acc - n | 0, 0) + }) + ], + tl: { + hd: [ + "reduceRighti", + param => ({ + TAG: "Eq", + _0: -6, + _1: [ + 1, + 2, + 3, + 4 + ].reduceRight((acc, param, i) => acc - i | 0, 0) + }) + ], + tl: { + hd: [ + "some", + param => ({ + TAG: "Eq", + _0: false, + _1: [ + 1, + 2, + 3, + 4 + ].some(n => n <= 0) + }) + ], + tl: { + hd: [ + "somei", + param => ({ + TAG: "Eq", + _0: true, + _1: [ + 1, + 2, + 3, + 4 + ].some((param, i) => i <= 0) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_array_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_bool_test.js b/tests/tests/src/js_bool_test.js deleted file mode 100644 index 50bd8edab0..0000000000 --- a/tests/tests/src/js_bool_test.js +++ /dev/null @@ -1,147 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -function f(x) { - if (x) { - return true; - } else { - return false; - } -} - -function f2(x) { - if (x) { - return true; - } else { - return false; - } -} - -function f4(x) { - if (x) { - return true; - } else { - return false; - } -} - -let u = 1; - -let v = true; - -let suites_0 = [ - "?bool_eq_caml_bool", - param => ({ - TAG: "Eq", - _0: u, - _1: true - }) -]; - -let suites_1 = { - hd: [ - "js_bool_eq_js_bool", - param => ({ - TAG: "Eq", - _0: v, - _1: true - }) - ], - tl: { - hd: [ - "js_bool_neq_acml_bool", - param => ({ - TAG: "Eq", - _0: true, - _1: true === true - }) - ], - tl: /* [] */0 - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -function ff(u) { - if (u === true) { - return 1; - } else { - return 2; - } -} - -function fi(x, y) { - return x === y; -} - -function fb(x, y) { - return x === y; -} - -function fadd(x, y) { - return x + y | 0; -} - -function ffadd(x, y) { - return x + y; -} - -function ss(x) { - return "xx" > x; -} - -function bb(x) { - return [ - true > x, - false, - true, - true <= x, - false, - false < x, - false >= x, - true - ]; -} - -let consts = [ - false, - false, - true, - false, - true, - false, - true, - true -]; - -let bool_array = [ - true, - false -]; - -Mt.from_pair_suites("Js_bool_test", suites); - -let f3 = true; - -exports.f = f; -exports.f2 = f2; -exports.f4 = f4; -exports.f3 = f3; -exports.u = u; -exports.v = v; -exports.suites = suites; -exports.ff = ff; -exports.fi = fi; -exports.fb = fb; -exports.fadd = fadd; -exports.ffadd = ffadd; -exports.ss = ss; -exports.bb = bb; -exports.consts = consts; -exports.bool_array = bool_array; -/* Not a pure module */ diff --git a/tests/tests/src/js_bool_test.mjs b/tests/tests/src/js_bool_test.mjs new file mode 100644 index 0000000000..bb87a4f7f0 --- /dev/null +++ b/tests/tests/src/js_bool_test.mjs @@ -0,0 +1,148 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +function f(x) { + if (x) { + return true; + } else { + return false; + } +} + +function f2(x) { + if (x) { + return true; + } else { + return false; + } +} + +function f4(x) { + if (x) { + return true; + } else { + return false; + } +} + +let u = 1; + +let v = true; + +let suites_0 = [ + "?bool_eq_caml_bool", + param => ({ + TAG: "Eq", + _0: u, + _1: true + }) +]; + +let suites_1 = { + hd: [ + "js_bool_eq_js_bool", + param => ({ + TAG: "Eq", + _0: v, + _1: true + }) + ], + tl: { + hd: [ + "js_bool_neq_acml_bool", + param => ({ + TAG: "Eq", + _0: true, + _1: true === true + }) + ], + tl: /* [] */0 + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +function ff(u) { + if (u === true) { + return 1; + } else { + return 2; + } +} + +function fi(x, y) { + return x === y; +} + +function fb(x, y) { + return x === y; +} + +function fadd(x, y) { + return x + y | 0; +} + +function ffadd(x, y) { + return x + y; +} + +function ss(x) { + return "xx" > x; +} + +function bb(x) { + return [ + true > x, + false, + true, + true <= x, + false, + false < x, + false >= x, + true + ]; +} + +let consts = [ + false, + false, + true, + false, + true, + false, + true, + true +]; + +let bool_array = [ + true, + false +]; + +Mt.from_pair_suites("Js_bool_test", suites); + +let f3 = true; + +export { + f, + f2, + f4, + f3, + u, + v, + suites, + ff, + fi, + fb, + fadd, + ffadd, + ss, + bb, + consts, + bool_array, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_date_test.js b/tests/tests/src/js_date_test.js deleted file mode 100644 index 0cdf7f80be..0000000000 --- a/tests/tests/src/js_date_test.js +++ /dev/null @@ -1,1058 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_object = require("rescript/lib/js/Primitive_object.js"); - -function date() { - return new Date("1976-03-08T12:34:56.789+01:23"); -} - -let suites_0 = [ - "valueOf", - param => ({ - TAG: "Eq", - _0: 195131516789, - _1: new Date("1976-03-08T12:34:56.789+01:23").valueOf() - }) -]; - -let suites_1 = { - hd: [ - "make", - param => ({ - TAG: "Ok", - _0: new Date().getTime() > 1487223505382 - }) - ], - tl: { - hd: [ - "parseAsFloat", - param => ({ - TAG: "Eq", - _0: Date.parse("1976-03-08T12:34:56.789+01:23"), - _1: 195131516789 - }) - ], - tl: { - hd: [ - "parseAsFloat_invalid", - param => ({ - TAG: "Ok", - _0: Number.isNaN(Date.parse("gibberish")) - }) - ], - tl: { - hd: [ - "fromFloat", - param => ({ - TAG: "Eq", - _0: "1976-03-08T11:11:56.789Z", - _1: new Date(195131516789).toISOString() - }) - ], - tl: { - hd: [ - "fromString_valid", - param => ({ - TAG: "Eq", - _0: 195131516789, - _1: new Date("1976-03-08T12:34:56.789+01:23").getTime() - }) - ], - tl: { - hd: [ - "fromString_invalid", - param => ({ - TAG: "Ok", - _0: Number.isNaN(new Date("gibberish").getTime()) - }) - ], - tl: { - hd: [ - "makeWithYM", - param => { - let d = new Date(1984, 4); - return { - TAG: "Eq", - _0: [ - 1984, - 4 - ], - _1: [ - d.getFullYear(), - d.getMonth() - ] - }; - } - ], - tl: { - hd: [ - "makeWithYMD", - param => { - let d = new Date(1984, 4, 6); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6 - ], - _1: [ - d.getFullYear(), - d.getMonth(), - d.getDate() - ] - }; - } - ], - tl: { - hd: [ - "makeWithYMDH", - param => { - let d = new Date(1984, 4, 6, 3); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3 - ], - _1: [ - d.getFullYear(), - d.getMonth(), - d.getDate(), - d.getHours() - ] - }; - } - ], - tl: { - hd: [ - "makeWithYMDHM", - param => { - let d = new Date(1984, 4, 6, 3, 59); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3, - 59 - ], - _1: [ - d.getFullYear(), - d.getMonth(), - d.getDate(), - d.getHours(), - d.getMinutes() - ] - }; - } - ], - tl: { - hd: [ - "makeWithYMDHMS", - param => { - let d = new Date(1984, 4, 6, 3, 59, 27); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3, - 59, - 27 - ], - _1: [ - d.getFullYear(), - d.getMonth(), - d.getDate(), - d.getHours(), - d.getMinutes(), - d.getSeconds() - ] - }; - } - ], - tl: { - hd: [ - "utcWithYM", - param => { - let d = Date.UTC(1984, 4); - let d$1 = new Date(d); - return { - TAG: "Eq", - _0: [ - 1984, - 4 - ], - _1: [ - d$1.getUTCFullYear(), - d$1.getUTCMonth() - ] - }; - } - ], - tl: { - hd: [ - "utcWithYMD", - param => { - let d = Date.UTC(1984, 4, 6); - let d$1 = new Date(d); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6 - ], - _1: [ - d$1.getUTCFullYear(), - d$1.getUTCMonth(), - d$1.getUTCDate() - ] - }; - } - ], - tl: { - hd: [ - "utcWithYMDH", - param => { - let d = Date.UTC(1984, 4, 6, 3); - let d$1 = new Date(d); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3 - ], - _1: [ - d$1.getUTCFullYear(), - d$1.getUTCMonth(), - d$1.getUTCDate(), - d$1.getUTCHours() - ] - }; - } - ], - tl: { - hd: [ - "utcWithYMDHM", - param => { - let d = Date.UTC(1984, 4, 6, 3, 59); - let d$1 = new Date(d); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3, - 59 - ], - _1: [ - d$1.getUTCFullYear(), - d$1.getUTCMonth(), - d$1.getUTCDate(), - d$1.getUTCHours(), - d$1.getUTCMinutes() - ] - }; - } - ], - tl: { - hd: [ - "utcWithYMDHMS", - param => { - let d = Date.UTC(1984, 4, 6, 3, 59, 27); - let d$1 = new Date(d); - return { - TAG: "Eq", - _0: [ - 1984, - 4, - 6, - 3, - 59, - 27 - ], - _1: [ - d$1.getUTCFullYear(), - d$1.getUTCMonth(), - d$1.getUTCDate(), - d$1.getUTCHours(), - d$1.getUTCMinutes(), - d$1.getUTCSeconds() - ] - }; - } - ], - tl: { - hd: [ - "getFullYear", - param => ({ - TAG: "Eq", - _0: 1976, - _1: new Date("1976-03-08T12:34:56.789+01:23").getFullYear() - }) - ], - tl: { - hd: [ - "getMilliseconds", - param => ({ - TAG: "Eq", - _0: 789, - _1: new Date("1976-03-08T12:34:56.789+01:23").getMilliseconds() - }) - ], - tl: { - hd: [ - "getSeconds", - param => ({ - TAG: "Eq", - _0: 56, - _1: new Date("1976-03-08T12:34:56.789+01:23").getSeconds() - }) - ], - tl: { - hd: [ - "getTime", - param => ({ - TAG: "Eq", - _0: 195131516789, - _1: new Date("1976-03-08T12:34:56.789+01:23").getTime() - }) - ], - tl: { - hd: [ - "getUTCDate", - param => ({ - TAG: "Eq", - _0: 8, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCDate() - }) - ], - tl: { - hd: [ - "getUTCDay", - param => ({ - TAG: "Eq", - _0: 1, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCDay() - }) - ], - tl: { - hd: [ - "getUTCFUllYear", - param => ({ - TAG: "Eq", - _0: 1976, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCFullYear() - }) - ], - tl: { - hd: [ - "getUTCHours", - param => ({ - TAG: "Eq", - _0: 11, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCHours() - }) - ], - tl: { - hd: [ - "getUTCMilliseconds", - param => ({ - TAG: "Eq", - _0: 789, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMilliseconds() - }) - ], - tl: { - hd: [ - "getUTCMinutes", - param => ({ - TAG: "Eq", - _0: 11, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMinutes() - }) - ], - tl: { - hd: [ - "getUTCMonth", - param => ({ - TAG: "Eq", - _0: 2, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMonth() - }) - ], - tl: { - hd: [ - "getUTCSeconds", - param => ({ - TAG: "Eq", - _0: 56, - _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCSeconds() - }) - ], - tl: { - hd: [ - "getYear", - param => ({ - TAG: "Eq", - _0: 1976, - _1: new Date("1976-03-08T12:34:56.789+01:23").getFullYear() - }) - ], - tl: { - hd: [ - "setDate", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setDate(12); - return { - TAG: "Eq", - _0: 12, - _1: d.getDate() - }; - } - ], - tl: { - hd: [ - "setFullYear", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setFullYear(1986); - return { - TAG: "Eq", - _0: 1986, - _1: d.getFullYear() - }; - } - ], - tl: { - hd: [ - "setFullYearM", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setFullYear(1986, 7); - return { - TAG: "Eq", - _0: [ - 1986, - 7 - ], - _1: [ - d.getFullYear(), - d.getMonth() - ] - }; - } - ], - tl: { - hd: [ - "setFullYearMD", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setFullYear(1986, 7, 23); - return { - TAG: "Eq", - _0: [ - 1986, - 7, - 23 - ], - _1: [ - d.getFullYear(), - d.getMonth(), - d.getDate() - ] - }; - } - ], - tl: { - hd: [ - "setHours", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setHours(22); - return { - TAG: "Eq", - _0: 22, - _1: d.getHours() - }; - } - ], - tl: { - hd: [ - "setHoursM", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setHours(22, 48); - return { - TAG: "Eq", - _0: [ - 22, - 48 - ], - _1: [ - d.getHours(), - d.getMinutes() - ] - }; - } - ], - tl: { - hd: [ - "setHoursMS", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setHours(22, 48, 54); - return { - TAG: "Eq", - _0: [ - 22, - 48, - 54 - ], - _1: [ - d.getHours(), - d.getMinutes(), - d.getSeconds() - ] - }; - } - ], - tl: { - hd: [ - "setMilliseconds", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMilliseconds(543); - return { - TAG: "Eq", - _0: 543, - _1: d.getMilliseconds() - }; - } - ], - tl: { - hd: [ - "setMinutes", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMinutes(18); - return { - TAG: "Eq", - _0: 18, - _1: d.getMinutes() - }; - } - ], - tl: { - hd: [ - "setMinutesS", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMinutes(18, 42); - return { - TAG: "Eq", - _0: [ - 18, - 42 - ], - _1: [ - d.getMinutes(), - d.getSeconds() - ] - }; - } - ], - tl: { - hd: [ - "setMinutesSMs", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMinutes(18, 42, 311); - return { - TAG: "Eq", - _0: [ - 18, - 42, - 311 - ], - _1: [ - d.getMinutes(), - d.getSeconds(), - d.getMilliseconds() - ] - }; - } - ], - tl: { - hd: [ - "setMonth", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMonth(10); - return { - TAG: "Eq", - _0: 10, - _1: d.getMonth() - }; - } - ], - tl: { - hd: [ - "setMonthD", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setMonth(10, 14); - return { - TAG: "Eq", - _0: [ - 10, - 14 - ], - _1: [ - d.getMonth(), - d.getDate() - ] - }; - } - ], - tl: { - hd: [ - "setSeconds", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setSeconds(36); - return { - TAG: "Eq", - _0: 36, - _1: d.getSeconds() - }; - } - ], - tl: { - hd: [ - "setSecondsMs", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setSeconds(36, 420); - return { - TAG: "Eq", - _0: [ - 36, - 420 - ], - _1: [ - d.getSeconds(), - d.getMilliseconds() - ] - }; - } - ], - tl: { - hd: [ - "setUTCDate", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCDate(12); - return { - TAG: "Eq", - _0: 12, - _1: d.getUTCDate() - }; - } - ], - tl: { - hd: [ - "setUTCFullYear", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCFullYear(1986); - return { - TAG: "Eq", - _0: 1986, - _1: d.getUTCFullYear() - }; - } - ], - tl: { - hd: [ - "setUTCFullYearM", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCFullYear(1986, 7); - return { - TAG: "Eq", - _0: [ - 1986, - 7 - ], - _1: [ - d.getUTCFullYear(), - d.getUTCMonth() - ] - }; - } - ], - tl: { - hd: [ - "setUTCFullYearMD", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCFullYear(1986, 7, 23); - return { - TAG: "Eq", - _0: [ - 1986, - 7, - 23 - ], - _1: [ - d.getUTCFullYear(), - d.getUTCMonth(), - d.getUTCDate() - ] - }; - } - ], - tl: { - hd: [ - "setUTCHours", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCHours(22); - return { - TAG: "Eq", - _0: 22, - _1: d.getUTCHours() - }; - } - ], - tl: { - hd: [ - "setUTCHoursM", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCHours(22, 48); - return { - TAG: "Eq", - _0: [ - 22, - 48 - ], - _1: [ - d.getUTCHours(), - d.getUTCMinutes() - ] - }; - } - ], - tl: { - hd: [ - "setUTCHoursMS", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCHours(22, 48, 54); - return { - TAG: "Eq", - _0: [ - 22, - 48, - 54 - ], - _1: [ - d.getUTCHours(), - d.getUTCMinutes(), - d.getUTCSeconds() - ] - }; - } - ], - tl: { - hd: [ - "setUTCMilliseconds", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMilliseconds(543); - return { - TAG: "Eq", - _0: 543, - _1: d.getUTCMilliseconds() - }; - } - ], - tl: { - hd: [ - "setUTCMinutes", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMinutes(18); - return { - TAG: "Eq", - _0: 18, - _1: d.getUTCMinutes() - }; - } - ], - tl: { - hd: [ - "setUTCMinutesS", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMinutes(18, 42); - return { - TAG: "Eq", - _0: [ - 18, - 42 - ], - _1: [ - d.getUTCMinutes(), - d.getUTCSeconds() - ] - }; - } - ], - tl: { - hd: [ - "setUTCMinutesSMs", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMinutes(18, 42, 311); - return { - TAG: "Eq", - _0: [ - 18, - 42, - 311 - ], - _1: [ - d.getUTCMinutes(), - d.getUTCSeconds(), - d.getUTCMilliseconds() - ] - }; - } - ], - tl: { - hd: [ - "setUTCMonth", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMonth(10); - return { - TAG: "Eq", - _0: 10, - _1: d.getUTCMonth() - }; - } - ], - tl: { - hd: [ - "setUTCMonthD", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCMonth(10, 14); - return { - TAG: "Eq", - _0: [ - 10, - 14 - ], - _1: [ - d.getUTCMonth(), - d.getUTCDate() - ] - }; - } - ], - tl: { - hd: [ - "setUTCSeconds", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCSeconds(36); - return { - TAG: "Eq", - _0: 36, - _1: d.getUTCSeconds() - }; - } - ], - tl: { - hd: [ - "setUTCSecondsMs", - param => { - let d = new Date("1976-03-08T12:34:56.789+01:23"); - d.setUTCSeconds(36, 420); - return { - TAG: "Eq", - _0: [ - 36, - 420 - ], - _1: [ - d.getUTCSeconds(), - d.getUTCMilliseconds() - ] - }; - } - ], - tl: { - hd: [ - "toDateString", - param => ({ - TAG: "Eq", - _0: "Mon Mar 08 1976", - _1: new Date("1976-03-08T12:34:56.789+01:23").toDateString() - }) - ], - tl: { - hd: [ - "toGMTString", - param => ({ - TAG: "Eq", - _0: "Mon, 08 Mar 1976 11:11:56 GMT", - _1: new Date("1976-03-08T12:34:56.789+01:23").toUTCString() - }) - ], - tl: { - hd: [ - "toISOString", - param => ({ - TAG: "Eq", - _0: "1976-03-08T11:11:56.789Z", - _1: new Date("1976-03-08T12:34:56.789+01:23").toISOString() - }) - ], - tl: { - hd: [ - "toJSON", - param => ({ - TAG: "Eq", - _0: "1976-03-08T11:11:56.789Z", - _1: new Date("1976-03-08T12:34:56.789+01:23").toJSON() - }) - ], - tl: { - hd: [ - "toJSONUnsafe", - param => ({ - TAG: "Eq", - _0: "1976-03-08T11:11:56.789Z", - _1: new Date("1976-03-08T12:34:56.789+01:23").toJSON() - }) - ], - tl: { - hd: [ - "toUTCString", - param => ({ - TAG: "Eq", - _0: "Mon, 08 Mar 1976 11:11:56 GMT", - _1: new Date("1976-03-08T12:34:56.789+01:23").toUTCString() - }) - ], - tl: { - hd: [ - "eq", - param => { - let a = new Date("2013-03-01T01:10:00"); - let b = new Date("2013-03-01T01:10:00"); - let c = new Date("2013-03-01T01:10:01"); - return { - TAG: "Ok", - _0: Primitive_object.equal(a, b) && Primitive_object.notequal(b, c) && Primitive_object.greaterthan(c, b) - }; - } - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_date_test", suites); - -let N; - -exports.N = N; -exports.date = date; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_date_test.mjs b/tests/tests/src/js_date_test.mjs new file mode 100644 index 0000000000..6970ed1c59 --- /dev/null +++ b/tests/tests/src/js_date_test.mjs @@ -0,0 +1,1059 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_object from "rescript/lib/es6/Primitive_object.js"; + +function date() { + return new Date("1976-03-08T12:34:56.789+01:23"); +} + +let suites_0 = [ + "valueOf", + param => ({ + TAG: "Eq", + _0: 195131516789, + _1: new Date("1976-03-08T12:34:56.789+01:23").valueOf() + }) +]; + +let suites_1 = { + hd: [ + "make", + param => ({ + TAG: "Ok", + _0: new Date().getTime() > 1487223505382 + }) + ], + tl: { + hd: [ + "parseAsFloat", + param => ({ + TAG: "Eq", + _0: Date.parse("1976-03-08T12:34:56.789+01:23"), + _1: 195131516789 + }) + ], + tl: { + hd: [ + "parseAsFloat_invalid", + param => ({ + TAG: "Ok", + _0: Number.isNaN(Date.parse("gibberish")) + }) + ], + tl: { + hd: [ + "fromFloat", + param => ({ + TAG: "Eq", + _0: "1976-03-08T11:11:56.789Z", + _1: new Date(195131516789).toISOString() + }) + ], + tl: { + hd: [ + "fromString_valid", + param => ({ + TAG: "Eq", + _0: 195131516789, + _1: new Date("1976-03-08T12:34:56.789+01:23").getTime() + }) + ], + tl: { + hd: [ + "fromString_invalid", + param => ({ + TAG: "Ok", + _0: Number.isNaN(new Date("gibberish").getTime()) + }) + ], + tl: { + hd: [ + "makeWithYM", + param => { + let d = new Date(1984, 4); + return { + TAG: "Eq", + _0: [ + 1984, + 4 + ], + _1: [ + d.getFullYear(), + d.getMonth() + ] + }; + } + ], + tl: { + hd: [ + "makeWithYMD", + param => { + let d = new Date(1984, 4, 6); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6 + ], + _1: [ + d.getFullYear(), + d.getMonth(), + d.getDate() + ] + }; + } + ], + tl: { + hd: [ + "makeWithYMDH", + param => { + let d = new Date(1984, 4, 6, 3); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3 + ], + _1: [ + d.getFullYear(), + d.getMonth(), + d.getDate(), + d.getHours() + ] + }; + } + ], + tl: { + hd: [ + "makeWithYMDHM", + param => { + let d = new Date(1984, 4, 6, 3, 59); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3, + 59 + ], + _1: [ + d.getFullYear(), + d.getMonth(), + d.getDate(), + d.getHours(), + d.getMinutes() + ] + }; + } + ], + tl: { + hd: [ + "makeWithYMDHMS", + param => { + let d = new Date(1984, 4, 6, 3, 59, 27); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3, + 59, + 27 + ], + _1: [ + d.getFullYear(), + d.getMonth(), + d.getDate(), + d.getHours(), + d.getMinutes(), + d.getSeconds() + ] + }; + } + ], + tl: { + hd: [ + "utcWithYM", + param => { + let d = Date.UTC(1984, 4); + let d$1 = new Date(d); + return { + TAG: "Eq", + _0: [ + 1984, + 4 + ], + _1: [ + d$1.getUTCFullYear(), + d$1.getUTCMonth() + ] + }; + } + ], + tl: { + hd: [ + "utcWithYMD", + param => { + let d = Date.UTC(1984, 4, 6); + let d$1 = new Date(d); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6 + ], + _1: [ + d$1.getUTCFullYear(), + d$1.getUTCMonth(), + d$1.getUTCDate() + ] + }; + } + ], + tl: { + hd: [ + "utcWithYMDH", + param => { + let d = Date.UTC(1984, 4, 6, 3); + let d$1 = new Date(d); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3 + ], + _1: [ + d$1.getUTCFullYear(), + d$1.getUTCMonth(), + d$1.getUTCDate(), + d$1.getUTCHours() + ] + }; + } + ], + tl: { + hd: [ + "utcWithYMDHM", + param => { + let d = Date.UTC(1984, 4, 6, 3, 59); + let d$1 = new Date(d); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3, + 59 + ], + _1: [ + d$1.getUTCFullYear(), + d$1.getUTCMonth(), + d$1.getUTCDate(), + d$1.getUTCHours(), + d$1.getUTCMinutes() + ] + }; + } + ], + tl: { + hd: [ + "utcWithYMDHMS", + param => { + let d = Date.UTC(1984, 4, 6, 3, 59, 27); + let d$1 = new Date(d); + return { + TAG: "Eq", + _0: [ + 1984, + 4, + 6, + 3, + 59, + 27 + ], + _1: [ + d$1.getUTCFullYear(), + d$1.getUTCMonth(), + d$1.getUTCDate(), + d$1.getUTCHours(), + d$1.getUTCMinutes(), + d$1.getUTCSeconds() + ] + }; + } + ], + tl: { + hd: [ + "getFullYear", + param => ({ + TAG: "Eq", + _0: 1976, + _1: new Date("1976-03-08T12:34:56.789+01:23").getFullYear() + }) + ], + tl: { + hd: [ + "getMilliseconds", + param => ({ + TAG: "Eq", + _0: 789, + _1: new Date("1976-03-08T12:34:56.789+01:23").getMilliseconds() + }) + ], + tl: { + hd: [ + "getSeconds", + param => ({ + TAG: "Eq", + _0: 56, + _1: new Date("1976-03-08T12:34:56.789+01:23").getSeconds() + }) + ], + tl: { + hd: [ + "getTime", + param => ({ + TAG: "Eq", + _0: 195131516789, + _1: new Date("1976-03-08T12:34:56.789+01:23").getTime() + }) + ], + tl: { + hd: [ + "getUTCDate", + param => ({ + TAG: "Eq", + _0: 8, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCDate() + }) + ], + tl: { + hd: [ + "getUTCDay", + param => ({ + TAG: "Eq", + _0: 1, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCDay() + }) + ], + tl: { + hd: [ + "getUTCFUllYear", + param => ({ + TAG: "Eq", + _0: 1976, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCFullYear() + }) + ], + tl: { + hd: [ + "getUTCHours", + param => ({ + TAG: "Eq", + _0: 11, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCHours() + }) + ], + tl: { + hd: [ + "getUTCMilliseconds", + param => ({ + TAG: "Eq", + _0: 789, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMilliseconds() + }) + ], + tl: { + hd: [ + "getUTCMinutes", + param => ({ + TAG: "Eq", + _0: 11, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMinutes() + }) + ], + tl: { + hd: [ + "getUTCMonth", + param => ({ + TAG: "Eq", + _0: 2, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCMonth() + }) + ], + tl: { + hd: [ + "getUTCSeconds", + param => ({ + TAG: "Eq", + _0: 56, + _1: new Date("1976-03-08T12:34:56.789+01:23").getUTCSeconds() + }) + ], + tl: { + hd: [ + "getYear", + param => ({ + TAG: "Eq", + _0: 1976, + _1: new Date("1976-03-08T12:34:56.789+01:23").getFullYear() + }) + ], + tl: { + hd: [ + "setDate", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setDate(12); + return { + TAG: "Eq", + _0: 12, + _1: d.getDate() + }; + } + ], + tl: { + hd: [ + "setFullYear", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setFullYear(1986); + return { + TAG: "Eq", + _0: 1986, + _1: d.getFullYear() + }; + } + ], + tl: { + hd: [ + "setFullYearM", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setFullYear(1986, 7); + return { + TAG: "Eq", + _0: [ + 1986, + 7 + ], + _1: [ + d.getFullYear(), + d.getMonth() + ] + }; + } + ], + tl: { + hd: [ + "setFullYearMD", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setFullYear(1986, 7, 23); + return { + TAG: "Eq", + _0: [ + 1986, + 7, + 23 + ], + _1: [ + d.getFullYear(), + d.getMonth(), + d.getDate() + ] + }; + } + ], + tl: { + hd: [ + "setHours", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setHours(22); + return { + TAG: "Eq", + _0: 22, + _1: d.getHours() + }; + } + ], + tl: { + hd: [ + "setHoursM", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setHours(22, 48); + return { + TAG: "Eq", + _0: [ + 22, + 48 + ], + _1: [ + d.getHours(), + d.getMinutes() + ] + }; + } + ], + tl: { + hd: [ + "setHoursMS", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setHours(22, 48, 54); + return { + TAG: "Eq", + _0: [ + 22, + 48, + 54 + ], + _1: [ + d.getHours(), + d.getMinutes(), + d.getSeconds() + ] + }; + } + ], + tl: { + hd: [ + "setMilliseconds", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMilliseconds(543); + return { + TAG: "Eq", + _0: 543, + _1: d.getMilliseconds() + }; + } + ], + tl: { + hd: [ + "setMinutes", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMinutes(18); + return { + TAG: "Eq", + _0: 18, + _1: d.getMinutes() + }; + } + ], + tl: { + hd: [ + "setMinutesS", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMinutes(18, 42); + return { + TAG: "Eq", + _0: [ + 18, + 42 + ], + _1: [ + d.getMinutes(), + d.getSeconds() + ] + }; + } + ], + tl: { + hd: [ + "setMinutesSMs", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMinutes(18, 42, 311); + return { + TAG: "Eq", + _0: [ + 18, + 42, + 311 + ], + _1: [ + d.getMinutes(), + d.getSeconds(), + d.getMilliseconds() + ] + }; + } + ], + tl: { + hd: [ + "setMonth", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMonth(10); + return { + TAG: "Eq", + _0: 10, + _1: d.getMonth() + }; + } + ], + tl: { + hd: [ + "setMonthD", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setMonth(10, 14); + return { + TAG: "Eq", + _0: [ + 10, + 14 + ], + _1: [ + d.getMonth(), + d.getDate() + ] + }; + } + ], + tl: { + hd: [ + "setSeconds", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setSeconds(36); + return { + TAG: "Eq", + _0: 36, + _1: d.getSeconds() + }; + } + ], + tl: { + hd: [ + "setSecondsMs", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setSeconds(36, 420); + return { + TAG: "Eq", + _0: [ + 36, + 420 + ], + _1: [ + d.getSeconds(), + d.getMilliseconds() + ] + }; + } + ], + tl: { + hd: [ + "setUTCDate", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCDate(12); + return { + TAG: "Eq", + _0: 12, + _1: d.getUTCDate() + }; + } + ], + tl: { + hd: [ + "setUTCFullYear", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCFullYear(1986); + return { + TAG: "Eq", + _0: 1986, + _1: d.getUTCFullYear() + }; + } + ], + tl: { + hd: [ + "setUTCFullYearM", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCFullYear(1986, 7); + return { + TAG: "Eq", + _0: [ + 1986, + 7 + ], + _1: [ + d.getUTCFullYear(), + d.getUTCMonth() + ] + }; + } + ], + tl: { + hd: [ + "setUTCFullYearMD", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCFullYear(1986, 7, 23); + return { + TAG: "Eq", + _0: [ + 1986, + 7, + 23 + ], + _1: [ + d.getUTCFullYear(), + d.getUTCMonth(), + d.getUTCDate() + ] + }; + } + ], + tl: { + hd: [ + "setUTCHours", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCHours(22); + return { + TAG: "Eq", + _0: 22, + _1: d.getUTCHours() + }; + } + ], + tl: { + hd: [ + "setUTCHoursM", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCHours(22, 48); + return { + TAG: "Eq", + _0: [ + 22, + 48 + ], + _1: [ + d.getUTCHours(), + d.getUTCMinutes() + ] + }; + } + ], + tl: { + hd: [ + "setUTCHoursMS", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCHours(22, 48, 54); + return { + TAG: "Eq", + _0: [ + 22, + 48, + 54 + ], + _1: [ + d.getUTCHours(), + d.getUTCMinutes(), + d.getUTCSeconds() + ] + }; + } + ], + tl: { + hd: [ + "setUTCMilliseconds", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMilliseconds(543); + return { + TAG: "Eq", + _0: 543, + _1: d.getUTCMilliseconds() + }; + } + ], + tl: { + hd: [ + "setUTCMinutes", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMinutes(18); + return { + TAG: "Eq", + _0: 18, + _1: d.getUTCMinutes() + }; + } + ], + tl: { + hd: [ + "setUTCMinutesS", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMinutes(18, 42); + return { + TAG: "Eq", + _0: [ + 18, + 42 + ], + _1: [ + d.getUTCMinutes(), + d.getUTCSeconds() + ] + }; + } + ], + tl: { + hd: [ + "setUTCMinutesSMs", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMinutes(18, 42, 311); + return { + TAG: "Eq", + _0: [ + 18, + 42, + 311 + ], + _1: [ + d.getUTCMinutes(), + d.getUTCSeconds(), + d.getUTCMilliseconds() + ] + }; + } + ], + tl: { + hd: [ + "setUTCMonth", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMonth(10); + return { + TAG: "Eq", + _0: 10, + _1: d.getUTCMonth() + }; + } + ], + tl: { + hd: [ + "setUTCMonthD", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCMonth(10, 14); + return { + TAG: "Eq", + _0: [ + 10, + 14 + ], + _1: [ + d.getUTCMonth(), + d.getUTCDate() + ] + }; + } + ], + tl: { + hd: [ + "setUTCSeconds", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCSeconds(36); + return { + TAG: "Eq", + _0: 36, + _1: d.getUTCSeconds() + }; + } + ], + tl: { + hd: [ + "setUTCSecondsMs", + param => { + let d = new Date("1976-03-08T12:34:56.789+01:23"); + d.setUTCSeconds(36, 420); + return { + TAG: "Eq", + _0: [ + 36, + 420 + ], + _1: [ + d.getUTCSeconds(), + d.getUTCMilliseconds() + ] + }; + } + ], + tl: { + hd: [ + "toDateString", + param => ({ + TAG: "Eq", + _0: "Mon Mar 08 1976", + _1: new Date("1976-03-08T12:34:56.789+01:23").toDateString() + }) + ], + tl: { + hd: [ + "toGMTString", + param => ({ + TAG: "Eq", + _0: "Mon, 08 Mar 1976 11:11:56 GMT", + _1: new Date("1976-03-08T12:34:56.789+01:23").toUTCString() + }) + ], + tl: { + hd: [ + "toISOString", + param => ({ + TAG: "Eq", + _0: "1976-03-08T11:11:56.789Z", + _1: new Date("1976-03-08T12:34:56.789+01:23").toISOString() + }) + ], + tl: { + hd: [ + "toJSON", + param => ({ + TAG: "Eq", + _0: "1976-03-08T11:11:56.789Z", + _1: new Date("1976-03-08T12:34:56.789+01:23").toJSON() + }) + ], + tl: { + hd: [ + "toJSONUnsafe", + param => ({ + TAG: "Eq", + _0: "1976-03-08T11:11:56.789Z", + _1: new Date("1976-03-08T12:34:56.789+01:23").toJSON() + }) + ], + tl: { + hd: [ + "toUTCString", + param => ({ + TAG: "Eq", + _0: "Mon, 08 Mar 1976 11:11:56 GMT", + _1: new Date("1976-03-08T12:34:56.789+01:23").toUTCString() + }) + ], + tl: { + hd: [ + "eq", + param => { + let a = new Date("2013-03-01T01:10:00"); + let b = new Date("2013-03-01T01:10:00"); + let c = new Date("2013-03-01T01:10:01"); + return { + TAG: "Ok", + _0: Primitive_object.equal(a, b) && Primitive_object.notequal(b, c) && Primitive_object.greaterthan(c, b) + }; + } + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_date_test", suites); + +let N; + +export { + N, + date, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_dict_test.js b/tests/tests/src/js_dict_test.js deleted file mode 100644 index 911cabffba..0000000000 --- a/tests/tests/src/js_dict_test.js +++ /dev/null @@ -1,239 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_dict = require("rescript/lib/js/Js_dict.js"); - -function obj() { - return { - foo: 43, - bar: 86 - }; -} - -let suites_0 = [ - "empty", - param => ({ - TAG: "Eq", - _0: [], - _1: Object.keys({}) - }) -]; - -let suites_1 = { - hd: [ - "get", - param => ({ - TAG: "Eq", - _0: 43, - _1: Js_dict.get({ - foo: 43, - bar: 86 - }, "foo") - }) - ], - tl: { - hd: [ - "get - property not in object", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_dict.get({ - foo: 43, - bar: 86 - }, "baz") - }) - ], - tl: { - hd: [ - "unsafe_get", - param => ({ - TAG: "Eq", - _0: 43, - _1: ({ - foo: 43, - bar: 86 - })["foo"] - }) - ], - tl: { - hd: [ - "set", - param => { - let o = { - foo: 43, - bar: 86 - }; - o["foo"] = 36; - return { - TAG: "Eq", - _0: 36, - _1: Js_dict.get(o, "foo") - }; - } - ], - tl: { - hd: [ - "keys", - param => ({ - TAG: "Eq", - _0: [ - "foo", - "bar" - ], - _1: Object.keys({ - foo: 43, - bar: 86 - }) - }) - ], - tl: { - hd: [ - "entries", - param => ({ - TAG: "Eq", - _0: [ - [ - "foo", - 43 - ], - [ - "bar", - 86 - ] - ], - _1: Js_dict.entries({ - foo: 43, - bar: 86 - }) - }) - ], - tl: { - hd: [ - "values", - param => ({ - TAG: "Eq", - _0: [ - 43, - 86 - ], - _1: Js_dict.values({ - foo: 43, - bar: 86 - }) - }) - ], - tl: { - hd: [ - "fromList - []", - param => ({ - TAG: "Eq", - _0: {}, - _1: Js_dict.fromList(/* [] */0) - }) - ], - tl: { - hd: [ - "fromList", - param => ({ - TAG: "Eq", - _0: [ - [ - "x", - 23 - ], - [ - "y", - 46 - ] - ], - _1: Js_dict.entries(Js_dict.fromList({ - hd: [ - "x", - 23 - ], - tl: { - hd: [ - "y", - 46 - ], - tl: /* [] */0 - } - })) - }) - ], - tl: { - hd: [ - "fromArray - []", - param => ({ - TAG: "Eq", - _0: {}, - _1: Js_dict.fromArray([]) - }) - ], - tl: { - hd: [ - "fromArray", - param => ({ - TAG: "Eq", - _0: [ - [ - "x", - 23 - ], - [ - "y", - 46 - ] - ], - _1: Js_dict.entries(Js_dict.fromArray([ - [ - "x", - 23 - ], - [ - "y", - 46 - ] - ])) - }) - ], - tl: { - hd: [ - "map", - param => ({ - TAG: "Eq", - _0: { - foo: "43", - bar: "86" - }, - _1: Js_dict.map(i => i.toString(), { - foo: 43, - bar: 86 - }) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_dict_test", suites); - -exports.obj = obj; -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_dict_test.mjs b/tests/tests/src/js_dict_test.mjs new file mode 100644 index 0000000000..762b69f8de --- /dev/null +++ b/tests/tests/src/js_dict_test.mjs @@ -0,0 +1,240 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_dict from "rescript/lib/es6/Js_dict.js"; + +function obj() { + return { + foo: 43, + bar: 86 + }; +} + +let suites_0 = [ + "empty", + param => ({ + TAG: "Eq", + _0: [], + _1: Object.keys({}) + }) +]; + +let suites_1 = { + hd: [ + "get", + param => ({ + TAG: "Eq", + _0: 43, + _1: Js_dict.get({ + foo: 43, + bar: 86 + }, "foo") + }) + ], + tl: { + hd: [ + "get - property not in object", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_dict.get({ + foo: 43, + bar: 86 + }, "baz") + }) + ], + tl: { + hd: [ + "unsafe_get", + param => ({ + TAG: "Eq", + _0: 43, + _1: ({ + foo: 43, + bar: 86 + })["foo"] + }) + ], + tl: { + hd: [ + "set", + param => { + let o = { + foo: 43, + bar: 86 + }; + o["foo"] = 36; + return { + TAG: "Eq", + _0: 36, + _1: Js_dict.get(o, "foo") + }; + } + ], + tl: { + hd: [ + "keys", + param => ({ + TAG: "Eq", + _0: [ + "foo", + "bar" + ], + _1: Object.keys({ + foo: 43, + bar: 86 + }) + }) + ], + tl: { + hd: [ + "entries", + param => ({ + TAG: "Eq", + _0: [ + [ + "foo", + 43 + ], + [ + "bar", + 86 + ] + ], + _1: Js_dict.entries({ + foo: 43, + bar: 86 + }) + }) + ], + tl: { + hd: [ + "values", + param => ({ + TAG: "Eq", + _0: [ + 43, + 86 + ], + _1: Js_dict.values({ + foo: 43, + bar: 86 + }) + }) + ], + tl: { + hd: [ + "fromList - []", + param => ({ + TAG: "Eq", + _0: {}, + _1: Js_dict.fromList(/* [] */0) + }) + ], + tl: { + hd: [ + "fromList", + param => ({ + TAG: "Eq", + _0: [ + [ + "x", + 23 + ], + [ + "y", + 46 + ] + ], + _1: Js_dict.entries(Js_dict.fromList({ + hd: [ + "x", + 23 + ], + tl: { + hd: [ + "y", + 46 + ], + tl: /* [] */0 + } + })) + }) + ], + tl: { + hd: [ + "fromArray - []", + param => ({ + TAG: "Eq", + _0: {}, + _1: Js_dict.fromArray([]) + }) + ], + tl: { + hd: [ + "fromArray", + param => ({ + TAG: "Eq", + _0: [ + [ + "x", + 23 + ], + [ + "y", + 46 + ] + ], + _1: Js_dict.entries(Js_dict.fromArray([ + [ + "x", + 23 + ], + [ + "y", + 46 + ] + ])) + }) + ], + tl: { + hd: [ + "map", + param => ({ + TAG: "Eq", + _0: { + foo: "43", + bar: "86" + }, + _1: Js_dict.map(i => i.toString(), { + foo: 43, + bar: 86 + }) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_dict_test", suites); + +export { + obj, + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_exception_catch_test.js b/tests/tests/src/js_exception_catch_test.js deleted file mode 100644 index 60a773a8a0..0000000000 --- a/tests/tests/src/js_exception_catch_test.js +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Exn = require("rescript/lib/js/Exn.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); -let Primitive_exceptions = require("rescript/lib/js/Primitive_exceptions.js"); - -let suites = { - contents: /* [] */0 -}; - -let counter = { - contents: 0 -}; - -function add_test(loc, test) { - counter.contents = counter.contents + 1 | 0; - let id = loc + (" id " + counter.contents.toString()); - suites.contents = { - hd: [ - id, - test - ], - tl: suites.contents - }; -} - -function eq(loc, x, y) { - add_test(loc, () => ({ - TAG: "Eq", - _0: x, - _1: y - })); -} - -function false_(loc) { - add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); -} - -function true_(loc) { - add_test(loc, () => ({ - TAG: "Ok", - _0: true - })); -} - -let exit = 0; - -let e; - -try { - e = JSON.parse(" {\"x\"}"); - exit = 1; -} catch (raw_x) { - let x = Primitive_exceptions.internalToException(raw_x); - if (x.RE_EXN_ID === Exn.$$Error) { - add_test("File \"js_exception_catch_test.res\", line 18, characters 37-44", () => ({ - TAG: "Ok", - _0: true - })); - } else { - throw x; - } -} - -if (exit === 1) { - add_test("File \"js_exception_catch_test.res\", line 19, characters 14-21", () => ({ - TAG: "Ok", - _0: false - })); -} - -let A = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.A"); - -let B = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.B"); - -let C = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.C"); - -function test(f) { - try { - f(); - return "No_error"; - } catch (raw_e) { - let e = Primitive_exceptions.internalToException(raw_e); - if (e.RE_EXN_ID === "Not_found") { - return "Not_found"; - } else if (e.RE_EXN_ID === "Invalid_argument") { - if (e._1 === "x") { - return "Invalid_argument"; - } else { - return "Invalid_any"; - } - } else if (e.RE_EXN_ID === A) { - if (e._1 !== 2) { - return "A_any"; - } else { - return "A2"; - } - } else if (e.RE_EXN_ID === B) { - return "B"; - } else if (e.RE_EXN_ID === C) { - if (e._1 !== 1 || e._2 !== 2) { - return "C_any"; - } else { - return "C"; - } - } else if (e.RE_EXN_ID === Exn.$$Error) { - return "Js_error"; - } else { - return "Any"; - } - } -} - -eq("File \"js_exception_catch_test.res\", line 44, characters 5-12", test(() => {}), "No_error"); - -eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(() => { - throw { - RE_EXN_ID: "Not_found", - Error: new Error() - }; -}), "Not_found"); - -eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(() => Pervasives.invalid_arg("x")), "Invalid_argument"); - -eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(() => Pervasives.invalid_arg("")), "Invalid_any"); - -eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(() => { - throw { - RE_EXN_ID: A, - _1: 2, - Error: new Error() - }; -}), "A2"); - -eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(() => { - throw { - RE_EXN_ID: A, - _1: 3, - Error: new Error() - }; -}), "A_any"); - -eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(() => { - throw { - RE_EXN_ID: B, - Error: new Error() - }; -}), "B"); - -eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(() => { - throw { - RE_EXN_ID: C, - _1: 1, - _2: 2, - Error: new Error() - }; -}), "C"); - -eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(() => { - throw { - RE_EXN_ID: C, - _1: 0, - _2: 2, - Error: new Error() - }; -}), "C_any"); - -eq("File \"js_exception_catch_test.res\", line 53, characters 5-12", test(() => Exn.raiseError("x")), "Js_error"); - -eq("File \"js_exception_catch_test.res\", line 54, characters 5-12", test(() => Pervasives.failwith("x")), "Any"); - -Mt.from_pair_suites("Js_exception_catch_test", suites.contents); - -exports.suites = suites; -exports.add_test = add_test; -exports.eq = eq; -exports.false_ = false_; -exports.true_ = true_; -exports.A = A; -exports.B = B; -exports.C = C; -exports.test = test; -/* Not a pure module */ diff --git a/tests/tests/src/js_exception_catch_test.mjs b/tests/tests/src/js_exception_catch_test.mjs new file mode 100644 index 0000000000..040fd2c6ca --- /dev/null +++ b/tests/tests/src/js_exception_catch_test.mjs @@ -0,0 +1,189 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Exn from "rescript/lib/es6/Exn.js"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; +import * as Primitive_exceptions from "rescript/lib/es6/Primitive_exceptions.js"; + +let suites = { + contents: /* [] */0 +}; + +let counter = { + contents: 0 +}; + +function add_test(loc, test) { + counter.contents = counter.contents + 1 | 0; + let id = loc + (" id " + counter.contents.toString()); + suites.contents = { + hd: [ + id, + test + ], + tl: suites.contents + }; +} + +function eq(loc, x, y) { + add_test(loc, () => ({ + TAG: "Eq", + _0: x, + _1: y + })); +} + +function false_(loc) { + add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); +} + +function true_(loc) { + add_test(loc, () => ({ + TAG: "Ok", + _0: true + })); +} + +let exit = 0; + +let e; + +try { + e = JSON.parse(" {\"x\"}"); + exit = 1; +} catch (raw_x) { + let x = Primitive_exceptions.internalToException(raw_x); + if (x.RE_EXN_ID === Exn.$$Error) { + add_test("File \"js_exception_catch_test.res\", line 18, characters 37-44", () => ({ + TAG: "Ok", + _0: true + })); + } else { + throw x; + } +} + +if (exit === 1) { + add_test("File \"js_exception_catch_test.res\", line 19, characters 14-21", () => ({ + TAG: "Ok", + _0: false + })); +} + +let A = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.A"); + +let B = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.B"); + +let C = /* @__PURE__ */Primitive_exceptions.create("Js_exception_catch_test.C"); + +function test(f) { + try { + f(); + return "No_error"; + } catch (raw_e) { + let e = Primitive_exceptions.internalToException(raw_e); + if (e.RE_EXN_ID === "Not_found") { + return "Not_found"; + } else if (e.RE_EXN_ID === "Invalid_argument") { + if (e._1 === "x") { + return "Invalid_argument"; + } else { + return "Invalid_any"; + } + } else if (e.RE_EXN_ID === A) { + if (e._1 !== 2) { + return "A_any"; + } else { + return "A2"; + } + } else if (e.RE_EXN_ID === B) { + return "B"; + } else if (e.RE_EXN_ID === C) { + if (e._1 !== 1 || e._2 !== 2) { + return "C_any"; + } else { + return "C"; + } + } else if (e.RE_EXN_ID === Exn.$$Error) { + return "Js_error"; + } else { + return "Any"; + } + } +} + +eq("File \"js_exception_catch_test.res\", line 44, characters 5-12", test(() => {}), "No_error"); + +eq("File \"js_exception_catch_test.res\", line 45, characters 5-12", test(() => { + throw { + RE_EXN_ID: "Not_found", + Error: new Error() + }; +}), "Not_found"); + +eq("File \"js_exception_catch_test.res\", line 46, characters 5-12", test(() => Pervasives.invalid_arg("x")), "Invalid_argument"); + +eq("File \"js_exception_catch_test.res\", line 47, characters 5-12", test(() => Pervasives.invalid_arg("")), "Invalid_any"); + +eq("File \"js_exception_catch_test.res\", line 48, characters 5-12", test(() => { + throw { + RE_EXN_ID: A, + _1: 2, + Error: new Error() + }; +}), "A2"); + +eq("File \"js_exception_catch_test.res\", line 49, characters 5-12", test(() => { + throw { + RE_EXN_ID: A, + _1: 3, + Error: new Error() + }; +}), "A_any"); + +eq("File \"js_exception_catch_test.res\", line 50, characters 5-12", test(() => { + throw { + RE_EXN_ID: B, + Error: new Error() + }; +}), "B"); + +eq("File \"js_exception_catch_test.res\", line 51, characters 5-12", test(() => { + throw { + RE_EXN_ID: C, + _1: 1, + _2: 2, + Error: new Error() + }; +}), "C"); + +eq("File \"js_exception_catch_test.res\", line 52, characters 5-12", test(() => { + throw { + RE_EXN_ID: C, + _1: 0, + _2: 2, + Error: new Error() + }; +}), "C_any"); + +eq("File \"js_exception_catch_test.res\", line 53, characters 5-12", test(() => Exn.raiseError("x")), "Js_error"); + +eq("File \"js_exception_catch_test.res\", line 54, characters 5-12", test(() => Pervasives.failwith("x")), "Any"); + +Mt.from_pair_suites("Js_exception_catch_test", suites.contents); + +export { + suites, + add_test, + eq, + false_, + true_, + A, + B, + C, + test, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_float_test.js b/tests/tests/src/js_float_test.js deleted file mode 100644 index 3569b1f3d7..0000000000 --- a/tests/tests/src/js_float_test.js +++ /dev/null @@ -1,455 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Pervasives = require("rescript/lib/js/Pervasives.js"); - -let suites_0 = [ - "_NaN <> _NaN", - param => ({ - TAG: "Eq", - _0: false, - _1: NaN === NaN - }) -]; - -let suites_1 = { - hd: [ - "isNaN - _NaN", - param => ({ - TAG: "Eq", - _0: true, - _1: Number.isNaN(NaN) - }) - ], - tl: { - hd: [ - "isNaN - 0.", - param => ({ - TAG: "Eq", - _0: false, - _1: Number.isNaN(0) - }) - ], - tl: { - hd: [ - "isFinite - infinity", - param => ({ - TAG: "Eq", - _0: false, - _1: Number.isFinite(Pervasives.infinity) - }) - ], - tl: { - hd: [ - "isFinite - neg_infinity", - param => ({ - TAG: "Eq", - _0: false, - _1: Number.isFinite(Pervasives.neg_infinity) - }) - ], - tl: { - hd: [ - "isFinite - _NaN", - param => ({ - TAG: "Eq", - _0: false, - _1: Number.isFinite(NaN) - }) - ], - tl: { - hd: [ - "isFinite - 0.", - param => ({ - TAG: "Eq", - _0: true, - _1: Number.isFinite(0) - }) - ], - tl: { - hd: [ - "toExponential", - param => ({ - TAG: "Eq", - _0: "1.23456e+2", - _1: (123.456).toExponential() - }) - ], - tl: { - hd: [ - "toExponential - large number", - param => ({ - TAG: "Eq", - _0: "1.2e+21", - _1: (1.2e21).toExponential() - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:2", - param => ({ - TAG: "Eq", - _0: "1.23e+2", - _1: (123.456).toExponential(2) - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:4", - param => ({ - TAG: "Eq", - _0: "1.2346e+2", - _1: (123.456).toExponential(4) - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:20", - param => ({ - TAG: "Eq", - _0: "0.00000000000000000000e+0", - _1: (0).toExponential(20) - }) - ], - tl: { - hd: [ - "File \"js_float_test.res\", line 27, characters 5-12", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toExponential(101); - } - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toExponential(-1); - } - }) - ], - tl: { - hd: [ - "toFixed", - param => ({ - TAG: "Eq", - _0: "123", - _1: (123.456).toFixed() - }) - ], - tl: { - hd: [ - "toFixed - large number", - param => ({ - TAG: "Eq", - _0: "1.2e+21", - _1: (1.2e21).toFixed() - }) - ], - tl: { - hd: [ - "toFixedWithPrecision - digits:2", - param => ({ - TAG: "Eq", - _0: "123.46", - _1: (123.456).toFixed(2) - }) - ], - tl: { - hd: [ - "toFixedWithPrecision - digits:4", - param => ({ - TAG: "Eq", - _0: "123.4560", - _1: (123.456).toFixed(4) - }) - ], - tl: { - hd: [ - "toFixedWithPrecision - digits:20", - param => ({ - TAG: "Eq", - _0: "0.00000000000000000000", - _1: (0).toFixed(20) - }) - ], - tl: { - hd: [ - "toFixedWithPrecision - digits:101", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toFixed(101); - } - }) - ], - tl: { - hd: [ - "toFixedWithPrecision - digits:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toFixed(-1); - } - }) - ], - tl: { - hd: [ - "toPrecision", - param => ({ - TAG: "Eq", - _0: "123.456", - _1: (123.456).toPrecision() - }) - ], - tl: { - hd: [ - "toPrecision - large number", - param => ({ - TAG: "Eq", - _0: "1.2e+21", - _1: (1.2e21).toPrecision() - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:2", - param => ({ - TAG: "Eq", - _0: "1.2e+2", - _1: (123.456).toPrecision(2) - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:4", - param => ({ - TAG: "Eq", - _0: "123.5", - _1: (123.456).toPrecision(4) - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:20", - param => ({ - TAG: "Eq", - _0: "0.0000000000000000000", - _1: (0).toPrecision(20) - }) - ], - tl: { - hd: [ - "File \"js_float_test.res\", line 68, characters 5-12", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toPrecision(101); - } - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toPrecision(-1); - } - }) - ], - tl: { - hd: [ - "toString", - param => ({ - TAG: "Eq", - _0: "1.23", - _1: (1.23).toString() - }) - ], - tl: { - hd: [ - "toString - large number", - param => ({ - TAG: "Eq", - _0: "1.2e+21", - _1: (1.2e21).toString() - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:2", - param => ({ - TAG: "Eq", - _0: "1111011.0111010010111100011010100111111011111001110111", - _1: (123.456).toString(2) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:16", - param => ({ - TAG: "Eq", - _0: "7b.74bc6a7ef9dc", - _1: (123.456).toString(16) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:36", - param => ({ - TAG: "Eq", - _0: "3f", - _1: (123).toString(36) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:37", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(37); - } - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(1); - } - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(-1); - } - }) - ], - tl: { - hd: [ - "fromString - 123", - param => ({ - TAG: "Eq", - _0: 123, - _1: Number("123") - }) - ], - tl: { - hd: [ - "fromString - 12.3", - param => ({ - TAG: "Eq", - _0: 12.3, - _1: Number("12.3") - }) - ], - tl: { - hd: [ - "fromString - empty string", - param => ({ - TAG: "Eq", - _0: 0, - _1: Number("") - }) - ], - tl: { - hd: [ - "fromString - 0x11", - param => ({ - TAG: "Eq", - _0: 17, - _1: Number("0x11") - }) - ], - tl: { - hd: [ - "fromString - 0b11", - param => ({ - TAG: "Eq", - _0: 3, - _1: Number("0b11") - }) - ], - tl: { - hd: [ - "fromString - 0o11", - param => ({ - TAG: "Eq", - _0: 9, - _1: Number("0o11") - }) - ], - tl: { - hd: [ - "fromString - invalid string", - param => ({ - TAG: "Eq", - _0: true, - _1: Number.isNaN(Number("foo")) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_float_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_float_test.mjs b/tests/tests/src/js_float_test.mjs new file mode 100644 index 0000000000..509c5b5531 --- /dev/null +++ b/tests/tests/src/js_float_test.mjs @@ -0,0 +1,456 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Pervasives from "rescript/lib/es6/Pervasives.js"; + +let suites_0 = [ + "_NaN <> _NaN", + param => ({ + TAG: "Eq", + _0: false, + _1: NaN === NaN + }) +]; + +let suites_1 = { + hd: [ + "isNaN - _NaN", + param => ({ + TAG: "Eq", + _0: true, + _1: Number.isNaN(NaN) + }) + ], + tl: { + hd: [ + "isNaN - 0.", + param => ({ + TAG: "Eq", + _0: false, + _1: Number.isNaN(0) + }) + ], + tl: { + hd: [ + "isFinite - infinity", + param => ({ + TAG: "Eq", + _0: false, + _1: Number.isFinite(Pervasives.infinity) + }) + ], + tl: { + hd: [ + "isFinite - neg_infinity", + param => ({ + TAG: "Eq", + _0: false, + _1: Number.isFinite(Pervasives.neg_infinity) + }) + ], + tl: { + hd: [ + "isFinite - _NaN", + param => ({ + TAG: "Eq", + _0: false, + _1: Number.isFinite(NaN) + }) + ], + tl: { + hd: [ + "isFinite - 0.", + param => ({ + TAG: "Eq", + _0: true, + _1: Number.isFinite(0) + }) + ], + tl: { + hd: [ + "toExponential", + param => ({ + TAG: "Eq", + _0: "1.23456e+2", + _1: (123.456).toExponential() + }) + ], + tl: { + hd: [ + "toExponential - large number", + param => ({ + TAG: "Eq", + _0: "1.2e+21", + _1: (1.2e21).toExponential() + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:2", + param => ({ + TAG: "Eq", + _0: "1.23e+2", + _1: (123.456).toExponential(2) + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:4", + param => ({ + TAG: "Eq", + _0: "1.2346e+2", + _1: (123.456).toExponential(4) + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:20", + param => ({ + TAG: "Eq", + _0: "0.00000000000000000000e+0", + _1: (0).toExponential(20) + }) + ], + tl: { + hd: [ + "File \"js_float_test.res\", line 27, characters 5-12", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toExponential(101); + } + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toExponential(-1); + } + }) + ], + tl: { + hd: [ + "toFixed", + param => ({ + TAG: "Eq", + _0: "123", + _1: (123.456).toFixed() + }) + ], + tl: { + hd: [ + "toFixed - large number", + param => ({ + TAG: "Eq", + _0: "1.2e+21", + _1: (1.2e21).toFixed() + }) + ], + tl: { + hd: [ + "toFixedWithPrecision - digits:2", + param => ({ + TAG: "Eq", + _0: "123.46", + _1: (123.456).toFixed(2) + }) + ], + tl: { + hd: [ + "toFixedWithPrecision - digits:4", + param => ({ + TAG: "Eq", + _0: "123.4560", + _1: (123.456).toFixed(4) + }) + ], + tl: { + hd: [ + "toFixedWithPrecision - digits:20", + param => ({ + TAG: "Eq", + _0: "0.00000000000000000000", + _1: (0).toFixed(20) + }) + ], + tl: { + hd: [ + "toFixedWithPrecision - digits:101", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toFixed(101); + } + }) + ], + tl: { + hd: [ + "toFixedWithPrecision - digits:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toFixed(-1); + } + }) + ], + tl: { + hd: [ + "toPrecision", + param => ({ + TAG: "Eq", + _0: "123.456", + _1: (123.456).toPrecision() + }) + ], + tl: { + hd: [ + "toPrecision - large number", + param => ({ + TAG: "Eq", + _0: "1.2e+21", + _1: (1.2e21).toPrecision() + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:2", + param => ({ + TAG: "Eq", + _0: "1.2e+2", + _1: (123.456).toPrecision(2) + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:4", + param => ({ + TAG: "Eq", + _0: "123.5", + _1: (123.456).toPrecision(4) + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:20", + param => ({ + TAG: "Eq", + _0: "0.0000000000000000000", + _1: (0).toPrecision(20) + }) + ], + tl: { + hd: [ + "File \"js_float_test.res\", line 68, characters 5-12", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toPrecision(101); + } + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toPrecision(-1); + } + }) + ], + tl: { + hd: [ + "toString", + param => ({ + TAG: "Eq", + _0: "1.23", + _1: (1.23).toString() + }) + ], + tl: { + hd: [ + "toString - large number", + param => ({ + TAG: "Eq", + _0: "1.2e+21", + _1: (1.2e21).toString() + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:2", + param => ({ + TAG: "Eq", + _0: "1111011.0111010010111100011010100111111011111001110111", + _1: (123.456).toString(2) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:16", + param => ({ + TAG: "Eq", + _0: "7b.74bc6a7ef9dc", + _1: (123.456).toString(16) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:36", + param => ({ + TAG: "Eq", + _0: "3f", + _1: (123).toString(36) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:37", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(37); + } + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(1); + } + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(-1); + } + }) + ], + tl: { + hd: [ + "fromString - 123", + param => ({ + TAG: "Eq", + _0: 123, + _1: Number("123") + }) + ], + tl: { + hd: [ + "fromString - 12.3", + param => ({ + TAG: "Eq", + _0: 12.3, + _1: Number("12.3") + }) + ], + tl: { + hd: [ + "fromString - empty string", + param => ({ + TAG: "Eq", + _0: 0, + _1: Number("") + }) + ], + tl: { + hd: [ + "fromString - 0x11", + param => ({ + TAG: "Eq", + _0: 17, + _1: Number("0x11") + }) + ], + tl: { + hd: [ + "fromString - 0b11", + param => ({ + TAG: "Eq", + _0: 3, + _1: Number("0b11") + }) + ], + tl: { + hd: [ + "fromString - 0o11", + param => ({ + TAG: "Eq", + _0: 9, + _1: Number("0o11") + }) + ], + tl: { + hd: [ + "fromString - invalid string", + param => ({ + TAG: "Eq", + _0: true, + _1: Number.isNaN(Number("foo")) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_float_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_global_test.js b/tests/tests/src/js_global_test.js deleted file mode 100644 index 8a77b3aef1..0000000000 --- a/tests/tests/src/js_global_test.js +++ /dev/null @@ -1,81 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites_0 = [ - "setTimeout/clearTimeout sanity check", - param => { - let handle = setTimeout(() => {}, 0); - clearTimeout(handle); - return { - TAG: "Ok", - _0: true - }; - } -]; - -let suites_1 = { - hd: [ - "setInerval/clearInterval sanity check", - param => { - let handle = setInterval(() => {}, 0); - clearInterval(handle); - return { - TAG: "Ok", - _0: true - }; - } - ], - tl: { - hd: [ - "encodeURI", - param => ({ - TAG: "Eq", - _0: encodeURI("[-=-]"), - _1: "%5B-=-%5D" - }) - ], - tl: { - hd: [ - "decodeURI", - param => ({ - TAG: "Eq", - _0: decodeURI("%5B-=-%5D"), - _1: "[-=-]" - }) - ], - tl: { - hd: [ - "encodeURIComponent", - param => ({ - TAG: "Eq", - _0: encodeURIComponent("[-=-]"), - _1: "%5B-%3D-%5D" - }) - ], - tl: { - hd: [ - "decodeURIComponent", - param => ({ - TAG: "Eq", - _0: decodeURIComponent("%5B-%3D-%5D"), - _1: "[-=-]" - }) - ], - tl: /* [] */0 - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_global_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_global_test.mjs b/tests/tests/src/js_global_test.mjs new file mode 100644 index 0000000000..9d27ba39db --- /dev/null +++ b/tests/tests/src/js_global_test.mjs @@ -0,0 +1,82 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites_0 = [ + "setTimeout/clearTimeout sanity check", + param => { + let handle = setTimeout(() => {}, 0); + clearTimeout(handle); + return { + TAG: "Ok", + _0: true + }; + } +]; + +let suites_1 = { + hd: [ + "setInerval/clearInterval sanity check", + param => { + let handle = setInterval(() => {}, 0); + clearInterval(handle); + return { + TAG: "Ok", + _0: true + }; + } + ], + tl: { + hd: [ + "encodeURI", + param => ({ + TAG: "Eq", + _0: encodeURI("[-=-]"), + _1: "%5B-=-%5D" + }) + ], + tl: { + hd: [ + "decodeURI", + param => ({ + TAG: "Eq", + _0: decodeURI("%5B-=-%5D"), + _1: "[-=-]" + }) + ], + tl: { + hd: [ + "encodeURIComponent", + param => ({ + TAG: "Eq", + _0: encodeURIComponent("[-=-]"), + _1: "%5B-%3D-%5D" + }) + ], + tl: { + hd: [ + "decodeURIComponent", + param => ({ + TAG: "Eq", + _0: decodeURIComponent("%5B-%3D-%5D"), + _1: "[-=-]" + }) + ], + tl: /* [] */0 + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_global_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_int_test.js b/tests/tests/src/js_int_test.js deleted file mode 100644 index e7a41d3a1f..0000000000 --- a/tests/tests/src/js_int_test.js +++ /dev/null @@ -1,212 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites_0 = [ - "toExponential", - param => ({ - TAG: "Eq", - _0: "1.23456e+5", - _1: (123456).toExponential() - }) -]; - -let suites_1 = { - hd: [ - "toExponentialWithPrecision - digits:2", - param => ({ - TAG: "Eq", - _0: "1.23e+5", - _1: (123456).toExponential(2) - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:4", - param => ({ - TAG: "Eq", - _0: "1.2346e+5", - _1: (123456).toExponential(4) - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:20", - param => ({ - TAG: "Eq", - _0: "0.00000000000000000000e+0", - _1: (0).toExponential(20) - }) - ], - tl: { - hd: [ - "File \"js_int_test.res\", line 19, characters 5-12", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toExponential(101); - } - }) - ], - tl: { - hd: [ - "toExponentialWithPrecision - digits:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toExponential(-1); - } - }) - ], - tl: { - hd: [ - "toPrecision", - param => ({ - TAG: "Eq", - _0: "123456", - _1: (123456).toPrecision() - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:2", - param => ({ - TAG: "Eq", - _0: "1.2e+5", - _1: (123456).toPrecision(2) - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:4", - param => ({ - TAG: "Eq", - _0: "1.235e+5", - _1: (123456).toPrecision(4) - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:20", - param => ({ - TAG: "Eq", - _0: "0.0000000000000000000", - _1: (0).toPrecision(20) - }) - ], - tl: { - hd: [ - "File \"js_int_test.res\", line 37, characters 5-12", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toPrecision(101); - } - }) - ], - tl: { - hd: [ - "toPrecisionWithPrecision - digits:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toPrecision(-1); - } - }) - ], - tl: { - hd: [ - "toString", - param => ({ - TAG: "Eq", - _0: "123", - _1: (123).toString() - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:2", - param => ({ - TAG: "Eq", - _0: "11110001001000000", - _1: (123456).toString(2) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:16", - param => ({ - TAG: "Eq", - _0: "1e240", - _1: (123456).toString(16) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:36", - param => ({ - TAG: "Eq", - _0: "2n9c", - _1: (123456).toString(36) - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:37", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(37); - } - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(1); - } - }) - ], - tl: { - hd: [ - "toStringWithRadix - radix:-1", - param => ({ - TAG: "ThrowAny", - _0: () => { - (0).toString(-1); - } - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_int_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_int_test.mjs b/tests/tests/src/js_int_test.mjs new file mode 100644 index 0000000000..7a975543dc --- /dev/null +++ b/tests/tests/src/js_int_test.mjs @@ -0,0 +1,213 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites_0 = [ + "toExponential", + param => ({ + TAG: "Eq", + _0: "1.23456e+5", + _1: (123456).toExponential() + }) +]; + +let suites_1 = { + hd: [ + "toExponentialWithPrecision - digits:2", + param => ({ + TAG: "Eq", + _0: "1.23e+5", + _1: (123456).toExponential(2) + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:4", + param => ({ + TAG: "Eq", + _0: "1.2346e+5", + _1: (123456).toExponential(4) + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:20", + param => ({ + TAG: "Eq", + _0: "0.00000000000000000000e+0", + _1: (0).toExponential(20) + }) + ], + tl: { + hd: [ + "File \"js_int_test.res\", line 19, characters 5-12", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toExponential(101); + } + }) + ], + tl: { + hd: [ + "toExponentialWithPrecision - digits:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toExponential(-1); + } + }) + ], + tl: { + hd: [ + "toPrecision", + param => ({ + TAG: "Eq", + _0: "123456", + _1: (123456).toPrecision() + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:2", + param => ({ + TAG: "Eq", + _0: "1.2e+5", + _1: (123456).toPrecision(2) + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:4", + param => ({ + TAG: "Eq", + _0: "1.235e+5", + _1: (123456).toPrecision(4) + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:20", + param => ({ + TAG: "Eq", + _0: "0.0000000000000000000", + _1: (0).toPrecision(20) + }) + ], + tl: { + hd: [ + "File \"js_int_test.res\", line 37, characters 5-12", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toPrecision(101); + } + }) + ], + tl: { + hd: [ + "toPrecisionWithPrecision - digits:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toPrecision(-1); + } + }) + ], + tl: { + hd: [ + "toString", + param => ({ + TAG: "Eq", + _0: "123", + _1: (123).toString() + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:2", + param => ({ + TAG: "Eq", + _0: "11110001001000000", + _1: (123456).toString(2) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:16", + param => ({ + TAG: "Eq", + _0: "1e240", + _1: (123456).toString(16) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:36", + param => ({ + TAG: "Eq", + _0: "2n9c", + _1: (123456).toString(36) + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:37", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(37); + } + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(1); + } + }) + ], + tl: { + hd: [ + "toStringWithRadix - radix:-1", + param => ({ + TAG: "ThrowAny", + _0: () => { + (0).toString(-1); + } + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_int_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_json_test.js b/tests/tests/src/js_json_test.js deleted file mode 100644 index c4ca3be08c..0000000000 --- a/tests/tests/src/js_json_test.js +++ /dev/null @@ -1,698 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_dict = require("rescript/lib/js/Js_dict.js"); -let Js_json = require("rescript/lib/js/Js_json.js"); -let Belt_List = require("rescript/lib/js/Belt_List.js"); -let Belt_Array = require("rescript/lib/js/Belt_Array.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites = { - contents: /* [] */0 -}; - -let counter = { - contents: 0 -}; - -function add_test(loc, test) { - counter.contents = counter.contents + 1 | 0; - let id = loc + (" id " + counter.contents.toString()); - suites.contents = { - hd: [ - id, - test - ], - tl: suites.contents - }; -} - -function eq(loc, x, y) { - add_test(loc, () => ({ - TAG: "Eq", - _0: x, - _1: y - })); -} - -function false_(loc) { - add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); -} - -function true_(loc) { - add_test(loc, () => ({ - TAG: "Ok", - _0: true - })); -} - -let v = JSON.parse(" { \"x\" : [1, 2, 3 ] } "); - -add_test("File \"js_json_test.res\", line 23, characters 11-18", () => { - let ty = Js_json.classify(v); - if (typeof ty !== "object") { - return { - TAG: "Ok", - _0: false - }; - } - if (ty.TAG !== "JSONObject") { - return { - TAG: "Ok", - _0: false - }; - } - let v$1 = Js_dict.get(ty._0, "x"); - if (v$1 === undefined) { - return { - TAG: "Ok", - _0: false - }; - } - let ty2 = Js_json.classify(v$1); - if (typeof ty2 !== "object") { - return { - TAG: "Ok", - _0: false - }; - } - if (ty2.TAG !== "JSONArray") { - return { - TAG: "Ok", - _0: false - }; - } - ty2._0.forEach(x => { - let ty3 = Js_json.classify(x); - if (typeof ty3 !== "object") { - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 39, - 21 - ], - Error: new Error() - }; - } - if (ty3.TAG === "JSONNumber") { - return; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 39, - 21 - ], - Error: new Error() - }; - }); - return { - TAG: "Ok", - _0: true - }; -}); - -eq("File \"js_json_test.res\", line 51, characters 5-12", Js_json.test(v, "Object"), true); - -let json = JSON.parse(JSON.stringify(null)); - -let ty = Js_json.classify(json); - -if (typeof ty !== "object") { - if (ty === "JSONNull") { - add_test("File \"js_json_test.res\", line 58, characters 24-31", () => ({ - TAG: "Ok", - _0: true - })); - } else { - console.log(ty); - add_test("File \"js_json_test.res\", line 61, characters 11-18", () => ({ - TAG: "Ok", - _0: false - })); - } -} else { - console.log(ty); - add_test("File \"js_json_test.res\", line 61, characters 11-18", () => ({ - TAG: "Ok", - _0: false - })); -} - -let json$1 = JSON.parse(JSON.stringify("test string")); - -let ty$1 = Js_json.classify(json$1); - -if (typeof ty$1 !== "object") { - add_test("File \"js_json_test.res\", line 71, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} else if (ty$1.TAG === "JSONString") { - eq("File \"js_json_test.res\", line 70, characters 26-33", ty$1._0, "test string"); -} else { - add_test("File \"js_json_test.res\", line 71, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} - -let json$2 = JSON.parse(JSON.stringify(1.23456789)); - -let ty$2 = Js_json.classify(json$2); - -let exit = 0; - -if (typeof ty$2 !== "object" || ty$2.TAG !== "JSONNumber") { - exit = 1; -} else { - eq("File \"js_json_test.res\", line 80, characters 26-33", ty$2._0, 1.23456789); -} - -if (exit === 1) { - add_test("File \"js_json_test.res\", line 81, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); -} - -let json$3 = JSON.parse(JSON.stringify(-1347440721)); - -let ty$3 = Js_json.classify(json$3); - -let exit$1 = 0; - -if (typeof ty$3 !== "object" || ty$3.TAG !== "JSONNumber") { - exit$1 = 1; -} else { - eq("File \"js_json_test.res\", line 90, characters 26-33", ty$3._0 | 0, -1347440721); -} - -if (exit$1 === 1) { - add_test("File \"js_json_test.res\", line 91, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); -} - -function test(v) { - let json = JSON.parse(JSON.stringify(v)); - let ty = Js_json.classify(json); - if (typeof ty === "object") { - return add_test("File \"js_json_test.res\", line 103, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } - switch (ty) { - case "JSONFalse" : - return eq("File \"js_json_test.res\", line 102, characters 24-31", false, v); - case "JSONTrue" : - return eq("File \"js_json_test.res\", line 101, characters 23-30", true, v); - default: - return add_test("File \"js_json_test.res\", line 103, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } -} - -test(true); - -test(false); - -function option_get(x) { - if (x !== undefined) { - return Primitive_option.valFromOption(x); - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "js_json_test.res", - 114, - 12 - ], - Error: new Error() - }; -} - -let dict = {}; - -dict["a"] = "test string"; - -dict["b"] = 123.0; - -let json$4 = JSON.parse(JSON.stringify(dict)); - -let ty$4 = Js_json.classify(json$4); - -if (typeof ty$4 !== "object") { - add_test("File \"js_json_test.res\", line 145, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} else if (ty$4.TAG === "JSONObject") { - let x = ty$4._0; - let ta = Js_json.classify(option_get(Js_dict.get(x, "a"))); - if (typeof ta !== "object") { - add_test("File \"js_json_test.res\", line 143, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } else if (ta.TAG === "JSONString") { - if (ta._0 !== "test string") { - add_test("File \"js_json_test.res\", line 134, characters 15-22", () => ({ - TAG: "Ok", - _0: false - })); - } else { - let ty$5 = Js_json.classify(option_get(Js_dict.get(x, "b"))); - if (typeof ty$5 !== "object") { - add_test("File \"js_json_test.res\", line 140, characters 22-29", () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$5.TAG === "JSONNumber") { - let b = ty$5._0; - add_test("File \"js_json_test.res\", line 139, characters 38-45", () => ({ - TAG: "Approx", - _0: 123.0, - _1: b - })); - } else { - add_test("File \"js_json_test.res\", line 140, characters 22-29", () => ({ - TAG: "Ok", - _0: false - })); - } - } - } else { - add_test("File \"js_json_test.res\", line 143, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } -} else { - add_test("File \"js_json_test.res\", line 145, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} - -function eq_at_i(loc, json, i, kind, expected) { - let ty = Js_json.classify(json); - if (typeof ty !== "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - if (ty.TAG !== "JSONArray") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - let ty$1 = Js_json.classify(Primitive_array.get(ty._0, i)); - switch (kind) { - case "String" : - if (typeof ty$1 !== "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$1.TAG === "JSONString") { - return eq(loc, ty$1._0, expected); - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - case "Number" : - if (typeof ty$1 !== "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$1.TAG === "JSONNumber") { - return eq(loc, ty$1._0, expected); - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - case "Object" : - if (typeof ty$1 !== "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$1.TAG === "JSONObject") { - return eq(loc, ty$1._0, expected); - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - case "Array" : - if (typeof ty$1 !== "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$1.TAG === "JSONArray") { - return eq(loc, ty$1._0, expected); - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - case "Boolean" : - if (typeof ty$1 === "object") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - switch (ty$1) { - case "JSONFalse" : - return eq(loc, false, expected); - case "JSONTrue" : - return eq(loc, true, expected); - default: - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - case "Null" : - if (typeof ty$1 !== "object") { - if (ty$1 === "JSONNull") { - return add_test(loc, () => ({ - TAG: "Ok", - _0: true - })); - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - } else { - return add_test(loc, () => ({ - TAG: "Ok", - _0: false - })); - } - } -} - -let json$5 = JSON.parse(JSON.stringify(Belt_Array.map([ - "string 0", - "string 1", - "string 2" -], prim => prim))); - -eq_at_i("File \"js_json_test.res\", line 199, characters 10-17", json$5, 0, "String", "string 0"); - -eq_at_i("File \"js_json_test.res\", line 200, characters 10-17", json$5, 1, "String", "string 1"); - -eq_at_i("File \"js_json_test.res\", line 201, characters 10-17", json$5, 2, "String", "string 2"); - -let json$6 = JSON.parse(JSON.stringify([ - "string 0", - "string 1", - "string 2" -])); - -eq_at_i("File \"js_json_test.res\", line 208, characters 10-17", json$6, 0, "String", "string 0"); - -eq_at_i("File \"js_json_test.res\", line 209, characters 10-17", json$6, 1, "String", "string 1"); - -eq_at_i("File \"js_json_test.res\", line 210, characters 10-17", json$6, 2, "String", "string 2"); - -let a = [ - 1.0000001, - 10000000000.1, - 123.0 -]; - -let json$7 = JSON.parse(JSON.stringify(a)); - -eq_at_i("File \"js_json_test.res\", line 219, characters 10-17", json$7, 0, "Number", Primitive_array.get(a, 0)); - -eq_at_i("File \"js_json_test.res\", line 220, characters 10-17", json$7, 1, "Number", Primitive_array.get(a, 1)); - -eq_at_i("File \"js_json_test.res\", line 221, characters 10-17", json$7, 2, "Number", Primitive_array.get(a, 2)); - -let a$1 = [ - 0, - -1347440721, - -268391749 -]; - -let json$8 = JSON.parse(JSON.stringify(Belt_Array.map(a$1, prim => prim))); - -eq_at_i("File \"js_json_test.res\", line 230, characters 10-17", json$8, 0, "Number", Primitive_array.get(a$1, 0)); - -eq_at_i("File \"js_json_test.res\", line 231, characters 10-17", json$8, 1, "Number", Primitive_array.get(a$1, 1)); - -eq_at_i("File \"js_json_test.res\", line 232, characters 10-17", json$8, 2, "Number", Primitive_array.get(a$1, 2)); - -let a$2 = [ - true, - false, - true -]; - -let json$9 = JSON.parse(JSON.stringify(a$2)); - -eq_at_i("File \"js_json_test.res\", line 241, characters 10-17", json$9, 0, "Boolean", Primitive_array.get(a$2, 0)); - -eq_at_i("File \"js_json_test.res\", line 242, characters 10-17", json$9, 1, "Boolean", Primitive_array.get(a$2, 1)); - -eq_at_i("File \"js_json_test.res\", line 243, characters 10-17", json$9, 2, "Boolean", Primitive_array.get(a$2, 2)); - -function make_d(s, i) { - let d = {}; - d["a"] = s; - d["b"] = i; - return d; -} - -let a$3 = [ - make_d("aaa", 123), - make_d("bbb", 456) -]; - -let json$10 = JSON.parse(JSON.stringify(a$3)); - -let ty$6 = Js_json.classify(json$10); - -if (typeof ty$6 !== "object") { - add_test("File \"js_json_test.res\", line 271, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} else if (ty$6.TAG === "JSONArray") { - let ty$7 = Js_json.classify(Primitive_array.get(ty$6._0, 1)); - if (typeof ty$7 !== "object") { - add_test("File \"js_json_test.res\", line 269, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$7.TAG === "JSONObject") { - let ty$8 = Js_json.classify(option_get(Js_dict.get(ty$7._0, "a"))); - if (typeof ty$8 !== "object") { - add_test("File \"js_json_test.res\", line 267, characters 20-27", () => ({ - TAG: "Ok", - _0: false - })); - } else if (ty$8.TAG === "JSONString") { - eq("File \"js_json_test.res\", line 266, characters 35-42", ty$8._0, "bbb"); - } else { - add_test("File \"js_json_test.res\", line 267, characters 20-27", () => ({ - TAG: "Ok", - _0: false - })); - } - } else { - add_test("File \"js_json_test.res\", line 269, characters 18-25", () => ({ - TAG: "Ok", - _0: false - })); - } -} else { - add_test("File \"js_json_test.res\", line 271, characters 16-23", () => ({ - TAG: "Ok", - _0: false - })); -} - -try { - JSON.parse("{{ A}"); - add_test("File \"js_json_test.res\", line 279, characters 11-18", () => ({ - TAG: "Ok", - _0: false - })); -} catch (exn) { - add_test("File \"js_json_test.res\", line 281, characters 17-24", () => ({ - TAG: "Ok", - _0: true - })); -} - -eq("File \"js_json_test.res\", line 287, characters 12-19", JSON.stringify([ - 1, - 2, - 3 -]), "[1,2,3]"); - -eq("File \"js_json_test.res\", line 290, characters 2-9", JSON.stringify({ - foo: 1, - bar: "hello", - baz: { - baaz: 10 - } -}), "{\"foo\":1,\"bar\":\"hello\",\"baz\":{\"baaz\":10}}"); - -eq("File \"js_json_test.res\", line 295, characters 12-19", JSON.stringify(null), "null"); - -eq("File \"js_json_test.res\", line 297, characters 12-19", JSON.stringify(undefined), undefined); - -eq("File \"js_json_test.res\", line 300, characters 5-12", Js_json.decodeString("test"), "test"); - -eq("File \"js_json_test.res\", line 301, characters 5-12", Js_json.decodeString(true), undefined); - -eq("File \"js_json_test.res\", line 302, characters 5-12", Js_json.decodeString([]), undefined); - -eq("File \"js_json_test.res\", line 303, characters 5-12", Js_json.decodeString(null), undefined); - -eq("File \"js_json_test.res\", line 304, characters 5-12", Js_json.decodeString({}), undefined); - -eq("File \"js_json_test.res\", line 305, characters 5-12", Js_json.decodeString(1.23), undefined); - -eq("File \"js_json_test.res\", line 309, characters 5-12", Js_json.decodeNumber("test"), undefined); - -eq("File \"js_json_test.res\", line 310, characters 5-12", Js_json.decodeNumber(true), undefined); - -eq("File \"js_json_test.res\", line 311, characters 5-12", Js_json.decodeNumber([]), undefined); - -eq("File \"js_json_test.res\", line 312, characters 5-12", Js_json.decodeNumber(null), undefined); - -eq("File \"js_json_test.res\", line 313, characters 5-12", Js_json.decodeNumber({}), undefined); - -eq("File \"js_json_test.res\", line 314, characters 5-12", Js_json.decodeNumber(1.23), 1.23); - -eq("File \"js_json_test.res\", line 318, characters 5-12", Js_json.decodeObject("test"), undefined); - -eq("File \"js_json_test.res\", line 319, characters 5-12", Js_json.decodeObject(true), undefined); - -eq("File \"js_json_test.res\", line 320, characters 5-12", Js_json.decodeObject([]), undefined); - -eq("File \"js_json_test.res\", line 321, characters 5-12", Js_json.decodeObject(null), undefined); - -eq("File \"js_json_test.res\", line 322, characters 5-12", Js_json.decodeObject({}), {}); - -eq("File \"js_json_test.res\", line 323, characters 5-12", Js_json.decodeObject(1.23), undefined); - -eq("File \"js_json_test.res\", line 327, characters 5-12", Js_json.decodeArray("test"), undefined); - -eq("File \"js_json_test.res\", line 328, characters 5-12", Js_json.decodeArray(true), undefined); - -eq("File \"js_json_test.res\", line 329, characters 5-12", Js_json.decodeArray([]), []); - -eq("File \"js_json_test.res\", line 330, characters 5-12", Js_json.decodeArray(null), undefined); - -eq("File \"js_json_test.res\", line 331, characters 5-12", Js_json.decodeArray({}), undefined); - -eq("File \"js_json_test.res\", line 332, characters 5-12", Js_json.decodeArray(1.23), undefined); - -eq("File \"js_json_test.res\", line 336, characters 5-12", Js_json.decodeBoolean("test"), undefined); - -eq("File \"js_json_test.res\", line 337, characters 5-12", Js_json.decodeBoolean(true), true); - -eq("File \"js_json_test.res\", line 338, characters 5-12", Js_json.decodeBoolean([]), undefined); - -eq("File \"js_json_test.res\", line 339, characters 5-12", Js_json.decodeBoolean(null), undefined); - -eq("File \"js_json_test.res\", line 340, characters 5-12", Js_json.decodeBoolean({}), undefined); - -eq("File \"js_json_test.res\", line 341, characters 5-12", Js_json.decodeBoolean(1.23), undefined); - -eq("File \"js_json_test.res\", line 345, characters 5-12", Js_json.decodeNull("test"), undefined); - -eq("File \"js_json_test.res\", line 346, characters 5-12", Js_json.decodeNull(true), undefined); - -eq("File \"js_json_test.res\", line 347, characters 5-12", Js_json.decodeNull([]), undefined); - -eq("File \"js_json_test.res\", line 348, characters 5-12", Js_json.decodeNull(null), null); - -eq("File \"js_json_test.res\", line 349, characters 5-12", Js_json.decodeNull({}), undefined); - -eq("File \"js_json_test.res\", line 350, characters 5-12", Js_json.decodeNull(1.23), undefined); - -function id(obj) { - return Js_json.deserializeUnsafe(Js_json.serializeExn(obj)); -} - -function idtest(obj) { - eq("File \"js_json_test.res\", line 355, characters 23-30", obj, Js_json.deserializeUnsafe(Js_json.serializeExn(obj))); -} - -idtest(undefined); - -idtest({ - hd: [ - undefined, - undefined, - undefined - ], - tl: /* [] */0 -}); - -idtest(Belt_List.makeBy(500, i => { - if (i % 2 === 0) { - return; - } else { - return 1; - } -})); - -idtest(Belt_Array.makeBy(500, i => { - if (i % 2 === 0) { - return; - } else { - return 1; - } -})); - -Mt.from_pair_suites("Js_json_test", suites.contents); - -let J; - -let $$Array; - -exports.suites = suites; -exports.J = J; -exports.$$Array = $$Array; -exports.add_test = add_test; -exports.eq = eq; -exports.false_ = false_; -exports.true_ = true_; -exports.option_get = option_get; -exports.eq_at_i = eq_at_i; -exports.id = id; -exports.idtest = idtest; -/* v Not a pure module */ diff --git a/tests/tests/src/js_json_test.mjs b/tests/tests/src/js_json_test.mjs new file mode 100644 index 0000000000..89f0f5aa81 --- /dev/null +++ b/tests/tests/src/js_json_test.mjs @@ -0,0 +1,699 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_dict from "rescript/lib/es6/Js_dict.js"; +import * as Js_json from "rescript/lib/es6/Js_json.js"; +import * as Belt_List from "rescript/lib/es6/Belt_List.js"; +import * as Belt_Array from "rescript/lib/es6/Belt_Array.js"; +import * as Primitive_array from "rescript/lib/es6/Primitive_array.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let suites = { + contents: /* [] */0 +}; + +let counter = { + contents: 0 +}; + +function add_test(loc, test) { + counter.contents = counter.contents + 1 | 0; + let id = loc + (" id " + counter.contents.toString()); + suites.contents = { + hd: [ + id, + test + ], + tl: suites.contents + }; +} + +function eq(loc, x, y) { + add_test(loc, () => ({ + TAG: "Eq", + _0: x, + _1: y + })); +} + +function false_(loc) { + add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); +} + +function true_(loc) { + add_test(loc, () => ({ + TAG: "Ok", + _0: true + })); +} + +let v = JSON.parse(" { \"x\" : [1, 2, 3 ] } "); + +add_test("File \"js_json_test.res\", line 23, characters 11-18", () => { + let ty = Js_json.classify(v); + if (typeof ty !== "object") { + return { + TAG: "Ok", + _0: false + }; + } + if (ty.TAG !== "JSONObject") { + return { + TAG: "Ok", + _0: false + }; + } + let v$1 = Js_dict.get(ty._0, "x"); + if (v$1 === undefined) { + return { + TAG: "Ok", + _0: false + }; + } + let ty2 = Js_json.classify(v$1); + if (typeof ty2 !== "object") { + return { + TAG: "Ok", + _0: false + }; + } + if (ty2.TAG !== "JSONArray") { + return { + TAG: "Ok", + _0: false + }; + } + ty2._0.forEach(x => { + let ty3 = Js_json.classify(x); + if (typeof ty3 !== "object") { + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 39, + 21 + ], + Error: new Error() + }; + } + if (ty3.TAG === "JSONNumber") { + return; + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 39, + 21 + ], + Error: new Error() + }; + }); + return { + TAG: "Ok", + _0: true + }; +}); + +eq("File \"js_json_test.res\", line 51, characters 5-12", Js_json.test(v, "Object"), true); + +let json = JSON.parse(JSON.stringify(null)); + +let ty = Js_json.classify(json); + +if (typeof ty !== "object") { + if (ty === "JSONNull") { + add_test("File \"js_json_test.res\", line 58, characters 24-31", () => ({ + TAG: "Ok", + _0: true + })); + } else { + console.log(ty); + add_test("File \"js_json_test.res\", line 61, characters 11-18", () => ({ + TAG: "Ok", + _0: false + })); + } +} else { + console.log(ty); + add_test("File \"js_json_test.res\", line 61, characters 11-18", () => ({ + TAG: "Ok", + _0: false + })); +} + +let json$1 = JSON.parse(JSON.stringify("test string")); + +let ty$1 = Js_json.classify(json$1); + +if (typeof ty$1 !== "object") { + add_test("File \"js_json_test.res\", line 71, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} else if (ty$1.TAG === "JSONString") { + eq("File \"js_json_test.res\", line 70, characters 26-33", ty$1._0, "test string"); +} else { + add_test("File \"js_json_test.res\", line 71, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} + +let json$2 = JSON.parse(JSON.stringify(1.23456789)); + +let ty$2 = Js_json.classify(json$2); + +let exit = 0; + +if (typeof ty$2 !== "object" || ty$2.TAG !== "JSONNumber") { + exit = 1; +} else { + eq("File \"js_json_test.res\", line 80, characters 26-33", ty$2._0, 1.23456789); +} + +if (exit === 1) { + add_test("File \"js_json_test.res\", line 81, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); +} + +let json$3 = JSON.parse(JSON.stringify(-1347440721)); + +let ty$3 = Js_json.classify(json$3); + +let exit$1 = 0; + +if (typeof ty$3 !== "object" || ty$3.TAG !== "JSONNumber") { + exit$1 = 1; +} else { + eq("File \"js_json_test.res\", line 90, characters 26-33", ty$3._0 | 0, -1347440721); +} + +if (exit$1 === 1) { + add_test("File \"js_json_test.res\", line 91, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); +} + +function test(v) { + let json = JSON.parse(JSON.stringify(v)); + let ty = Js_json.classify(json); + if (typeof ty === "object") { + return add_test("File \"js_json_test.res\", line 103, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } + switch (ty) { + case "JSONFalse" : + return eq("File \"js_json_test.res\", line 102, characters 24-31", false, v); + case "JSONTrue" : + return eq("File \"js_json_test.res\", line 101, characters 23-30", true, v); + default: + return add_test("File \"js_json_test.res\", line 103, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } +} + +test(true); + +test(false); + +function option_get(x) { + if (x !== undefined) { + return Primitive_option.valFromOption(x); + } + throw { + RE_EXN_ID: "Assert_failure", + _1: [ + "js_json_test.res", + 114, + 12 + ], + Error: new Error() + }; +} + +let dict = {}; + +dict["a"] = "test string"; + +dict["b"] = 123.0; + +let json$4 = JSON.parse(JSON.stringify(dict)); + +let ty$4 = Js_json.classify(json$4); + +if (typeof ty$4 !== "object") { + add_test("File \"js_json_test.res\", line 145, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} else if (ty$4.TAG === "JSONObject") { + let x = ty$4._0; + let ta = Js_json.classify(option_get(Js_dict.get(x, "a"))); + if (typeof ta !== "object") { + add_test("File \"js_json_test.res\", line 143, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } else if (ta.TAG === "JSONString") { + if (ta._0 !== "test string") { + add_test("File \"js_json_test.res\", line 134, characters 15-22", () => ({ + TAG: "Ok", + _0: false + })); + } else { + let ty$5 = Js_json.classify(option_get(Js_dict.get(x, "b"))); + if (typeof ty$5 !== "object") { + add_test("File \"js_json_test.res\", line 140, characters 22-29", () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$5.TAG === "JSONNumber") { + let b = ty$5._0; + add_test("File \"js_json_test.res\", line 139, characters 38-45", () => ({ + TAG: "Approx", + _0: 123.0, + _1: b + })); + } else { + add_test("File \"js_json_test.res\", line 140, characters 22-29", () => ({ + TAG: "Ok", + _0: false + })); + } + } + } else { + add_test("File \"js_json_test.res\", line 143, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } +} else { + add_test("File \"js_json_test.res\", line 145, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} + +function eq_at_i(loc, json, i, kind, expected) { + let ty = Js_json.classify(json); + if (typeof ty !== "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + if (ty.TAG !== "JSONArray") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + let ty$1 = Js_json.classify(Primitive_array.get(ty._0, i)); + switch (kind) { + case "String" : + if (typeof ty$1 !== "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$1.TAG === "JSONString") { + return eq(loc, ty$1._0, expected); + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + case "Number" : + if (typeof ty$1 !== "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$1.TAG === "JSONNumber") { + return eq(loc, ty$1._0, expected); + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + case "Object" : + if (typeof ty$1 !== "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$1.TAG === "JSONObject") { + return eq(loc, ty$1._0, expected); + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + case "Array" : + if (typeof ty$1 !== "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$1.TAG === "JSONArray") { + return eq(loc, ty$1._0, expected); + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + case "Boolean" : + if (typeof ty$1 === "object") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + switch (ty$1) { + case "JSONFalse" : + return eq(loc, false, expected); + case "JSONTrue" : + return eq(loc, true, expected); + default: + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + case "Null" : + if (typeof ty$1 !== "object") { + if (ty$1 === "JSONNull") { + return add_test(loc, () => ({ + TAG: "Ok", + _0: true + })); + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + } else { + return add_test(loc, () => ({ + TAG: "Ok", + _0: false + })); + } + } +} + +let json$5 = JSON.parse(JSON.stringify(Belt_Array.map([ + "string 0", + "string 1", + "string 2" +], prim => prim))); + +eq_at_i("File \"js_json_test.res\", line 199, characters 10-17", json$5, 0, "String", "string 0"); + +eq_at_i("File \"js_json_test.res\", line 200, characters 10-17", json$5, 1, "String", "string 1"); + +eq_at_i("File \"js_json_test.res\", line 201, characters 10-17", json$5, 2, "String", "string 2"); + +let json$6 = JSON.parse(JSON.stringify([ + "string 0", + "string 1", + "string 2" +])); + +eq_at_i("File \"js_json_test.res\", line 208, characters 10-17", json$6, 0, "String", "string 0"); + +eq_at_i("File \"js_json_test.res\", line 209, characters 10-17", json$6, 1, "String", "string 1"); + +eq_at_i("File \"js_json_test.res\", line 210, characters 10-17", json$6, 2, "String", "string 2"); + +let a = [ + 1.0000001, + 10000000000.1, + 123.0 +]; + +let json$7 = JSON.parse(JSON.stringify(a)); + +eq_at_i("File \"js_json_test.res\", line 219, characters 10-17", json$7, 0, "Number", Primitive_array.get(a, 0)); + +eq_at_i("File \"js_json_test.res\", line 220, characters 10-17", json$7, 1, "Number", Primitive_array.get(a, 1)); + +eq_at_i("File \"js_json_test.res\", line 221, characters 10-17", json$7, 2, "Number", Primitive_array.get(a, 2)); + +let a$1 = [ + 0, + -1347440721, + -268391749 +]; + +let json$8 = JSON.parse(JSON.stringify(Belt_Array.map(a$1, prim => prim))); + +eq_at_i("File \"js_json_test.res\", line 230, characters 10-17", json$8, 0, "Number", Primitive_array.get(a$1, 0)); + +eq_at_i("File \"js_json_test.res\", line 231, characters 10-17", json$8, 1, "Number", Primitive_array.get(a$1, 1)); + +eq_at_i("File \"js_json_test.res\", line 232, characters 10-17", json$8, 2, "Number", Primitive_array.get(a$1, 2)); + +let a$2 = [ + true, + false, + true +]; + +let json$9 = JSON.parse(JSON.stringify(a$2)); + +eq_at_i("File \"js_json_test.res\", line 241, characters 10-17", json$9, 0, "Boolean", Primitive_array.get(a$2, 0)); + +eq_at_i("File \"js_json_test.res\", line 242, characters 10-17", json$9, 1, "Boolean", Primitive_array.get(a$2, 1)); + +eq_at_i("File \"js_json_test.res\", line 243, characters 10-17", json$9, 2, "Boolean", Primitive_array.get(a$2, 2)); + +function make_d(s, i) { + let d = {}; + d["a"] = s; + d["b"] = i; + return d; +} + +let a$3 = [ + make_d("aaa", 123), + make_d("bbb", 456) +]; + +let json$10 = JSON.parse(JSON.stringify(a$3)); + +let ty$6 = Js_json.classify(json$10); + +if (typeof ty$6 !== "object") { + add_test("File \"js_json_test.res\", line 271, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} else if (ty$6.TAG === "JSONArray") { + let ty$7 = Js_json.classify(Primitive_array.get(ty$6._0, 1)); + if (typeof ty$7 !== "object") { + add_test("File \"js_json_test.res\", line 269, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$7.TAG === "JSONObject") { + let ty$8 = Js_json.classify(option_get(Js_dict.get(ty$7._0, "a"))); + if (typeof ty$8 !== "object") { + add_test("File \"js_json_test.res\", line 267, characters 20-27", () => ({ + TAG: "Ok", + _0: false + })); + } else if (ty$8.TAG === "JSONString") { + eq("File \"js_json_test.res\", line 266, characters 35-42", ty$8._0, "bbb"); + } else { + add_test("File \"js_json_test.res\", line 267, characters 20-27", () => ({ + TAG: "Ok", + _0: false + })); + } + } else { + add_test("File \"js_json_test.res\", line 269, characters 18-25", () => ({ + TAG: "Ok", + _0: false + })); + } +} else { + add_test("File \"js_json_test.res\", line 271, characters 16-23", () => ({ + TAG: "Ok", + _0: false + })); +} + +try { + JSON.parse("{{ A}"); + add_test("File \"js_json_test.res\", line 279, characters 11-18", () => ({ + TAG: "Ok", + _0: false + })); +} catch (exn) { + add_test("File \"js_json_test.res\", line 281, characters 17-24", () => ({ + TAG: "Ok", + _0: true + })); +} + +eq("File \"js_json_test.res\", line 287, characters 12-19", JSON.stringify([ + 1, + 2, + 3 +]), "[1,2,3]"); + +eq("File \"js_json_test.res\", line 290, characters 2-9", JSON.stringify({ + foo: 1, + bar: "hello", + baz: { + baaz: 10 + } +}), "{\"foo\":1,\"bar\":\"hello\",\"baz\":{\"baaz\":10}}"); + +eq("File \"js_json_test.res\", line 295, characters 12-19", JSON.stringify(null), "null"); + +eq("File \"js_json_test.res\", line 297, characters 12-19", JSON.stringify(undefined), undefined); + +eq("File \"js_json_test.res\", line 300, characters 5-12", Js_json.decodeString("test"), "test"); + +eq("File \"js_json_test.res\", line 301, characters 5-12", Js_json.decodeString(true), undefined); + +eq("File \"js_json_test.res\", line 302, characters 5-12", Js_json.decodeString([]), undefined); + +eq("File \"js_json_test.res\", line 303, characters 5-12", Js_json.decodeString(null), undefined); + +eq("File \"js_json_test.res\", line 304, characters 5-12", Js_json.decodeString({}), undefined); + +eq("File \"js_json_test.res\", line 305, characters 5-12", Js_json.decodeString(1.23), undefined); + +eq("File \"js_json_test.res\", line 309, characters 5-12", Js_json.decodeNumber("test"), undefined); + +eq("File \"js_json_test.res\", line 310, characters 5-12", Js_json.decodeNumber(true), undefined); + +eq("File \"js_json_test.res\", line 311, characters 5-12", Js_json.decodeNumber([]), undefined); + +eq("File \"js_json_test.res\", line 312, characters 5-12", Js_json.decodeNumber(null), undefined); + +eq("File \"js_json_test.res\", line 313, characters 5-12", Js_json.decodeNumber({}), undefined); + +eq("File \"js_json_test.res\", line 314, characters 5-12", Js_json.decodeNumber(1.23), 1.23); + +eq("File \"js_json_test.res\", line 318, characters 5-12", Js_json.decodeObject("test"), undefined); + +eq("File \"js_json_test.res\", line 319, characters 5-12", Js_json.decodeObject(true), undefined); + +eq("File \"js_json_test.res\", line 320, characters 5-12", Js_json.decodeObject([]), undefined); + +eq("File \"js_json_test.res\", line 321, characters 5-12", Js_json.decodeObject(null), undefined); + +eq("File \"js_json_test.res\", line 322, characters 5-12", Js_json.decodeObject({}), {}); + +eq("File \"js_json_test.res\", line 323, characters 5-12", Js_json.decodeObject(1.23), undefined); + +eq("File \"js_json_test.res\", line 327, characters 5-12", Js_json.decodeArray("test"), undefined); + +eq("File \"js_json_test.res\", line 328, characters 5-12", Js_json.decodeArray(true), undefined); + +eq("File \"js_json_test.res\", line 329, characters 5-12", Js_json.decodeArray([]), []); + +eq("File \"js_json_test.res\", line 330, characters 5-12", Js_json.decodeArray(null), undefined); + +eq("File \"js_json_test.res\", line 331, characters 5-12", Js_json.decodeArray({}), undefined); + +eq("File \"js_json_test.res\", line 332, characters 5-12", Js_json.decodeArray(1.23), undefined); + +eq("File \"js_json_test.res\", line 336, characters 5-12", Js_json.decodeBoolean("test"), undefined); + +eq("File \"js_json_test.res\", line 337, characters 5-12", Js_json.decodeBoolean(true), true); + +eq("File \"js_json_test.res\", line 338, characters 5-12", Js_json.decodeBoolean([]), undefined); + +eq("File \"js_json_test.res\", line 339, characters 5-12", Js_json.decodeBoolean(null), undefined); + +eq("File \"js_json_test.res\", line 340, characters 5-12", Js_json.decodeBoolean({}), undefined); + +eq("File \"js_json_test.res\", line 341, characters 5-12", Js_json.decodeBoolean(1.23), undefined); + +eq("File \"js_json_test.res\", line 345, characters 5-12", Js_json.decodeNull("test"), undefined); + +eq("File \"js_json_test.res\", line 346, characters 5-12", Js_json.decodeNull(true), undefined); + +eq("File \"js_json_test.res\", line 347, characters 5-12", Js_json.decodeNull([]), undefined); + +eq("File \"js_json_test.res\", line 348, characters 5-12", Js_json.decodeNull(null), null); + +eq("File \"js_json_test.res\", line 349, characters 5-12", Js_json.decodeNull({}), undefined); + +eq("File \"js_json_test.res\", line 350, characters 5-12", Js_json.decodeNull(1.23), undefined); + +function id(obj) { + return Js_json.deserializeUnsafe(Js_json.serializeExn(obj)); +} + +function idtest(obj) { + eq("File \"js_json_test.res\", line 355, characters 23-30", obj, Js_json.deserializeUnsafe(Js_json.serializeExn(obj))); +} + +idtest(undefined); + +idtest({ + hd: [ + undefined, + undefined, + undefined + ], + tl: /* [] */0 +}); + +idtest(Belt_List.makeBy(500, i => { + if (i % 2 === 0) { + return; + } else { + return 1; + } +})); + +idtest(Belt_Array.makeBy(500, i => { + if (i % 2 === 0) { + return; + } else { + return 1; + } +})); + +Mt.from_pair_suites("Js_json_test", suites.contents); + +let J; + +let $$Array; + +export { + suites, + J, + $$Array, + add_test, + eq, + false_, + true_, + option_get, + eq_at_i, + id, + idtest, +} +/* v Not a pure module */ diff --git a/tests/tests/src/js_math_test.js b/tests/tests/src/js_math_test.js deleted file mode 100644 index e7ff1dd711..0000000000 --- a/tests/tests/src/js_math_test.js +++ /dev/null @@ -1,630 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_math = require("rescript/lib/js/Js_math.js"); - -let suites_0 = [ - "_E", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 2.718, - _2: Math.E - }) -]; - -let suites_1 = { - hd: [ - "_LN2", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.693, - _2: Math.LN2 - }) - ], - tl: { - hd: [ - "_LN10", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 2.303, - _2: Math.LN10 - }) - ], - tl: { - hd: [ - "_LOG2E", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.443, - _2: Math.LOG2E - }) - ], - tl: { - hd: [ - "_LOG10E", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.434, - _2: Math.LOG10E - }) - ], - tl: { - hd: [ - "_PI", - param => ({ - TAG: "ApproxThreshold", - _0: 0.00001, - _1: 3.14159, - _2: Math.PI - }) - ], - tl: { - hd: [ - "_SQRT1_2", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.707, - _2: Math.SQRT1_2 - }) - ], - tl: { - hd: [ - "_SQRT2", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.414, - _2: Math.SQRT2 - }) - ], - tl: { - hd: [ - "abs_int", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.abs(-4) - }) - ], - tl: { - hd: [ - "abs_float", - param => ({ - TAG: "Eq", - _0: 1.2, - _1: Math.abs(-1.2) - }) - ], - tl: { - hd: [ - "acos", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.159, - _2: Math.acos(0.4) - }) - ], - tl: { - hd: [ - "acosh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.622, - _2: Math.acosh(1.2) - }) - ], - tl: { - hd: [ - "asin", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.411, - _2: Math.asin(0.4) - }) - ], - tl: { - hd: [ - "asinh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.390, - _2: Math.asinh(0.4) - }) - ], - tl: { - hd: [ - "atan", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.380, - _2: Math.atan(0.4) - }) - ], - tl: { - hd: [ - "atanh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.423, - _2: Math.atanh(0.4) - }) - ], - tl: { - hd: [ - "atan2", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.588, - _2: Math.atan2(0.4, 0.6) - }) - ], - tl: { - hd: [ - "cbrt", - param => ({ - TAG: "Eq", - _0: 2, - _1: Math.cbrt(8) - }) - ], - tl: { - hd: [ - "unsafe_ceil_int", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.ceil(3.2) - }) - ], - tl: { - hd: [ - "ceil_int", - param => ({ - TAG: "Eq", - _0: 4, - _1: Js_math.ceil_int(3.2) - }) - ], - tl: { - hd: [ - "ceil_float", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.ceil(3.2) - }) - ], - tl: { - hd: [ - "cos", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.921, - _2: Math.cos(0.4) - }) - ], - tl: { - hd: [ - "cosh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.081, - _2: Math.cosh(0.4) - }) - ], - tl: { - hd: [ - "exp", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.491, - _2: Math.exp(0.4) - }) - ], - tl: { - hd: [ - "expm1", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.491, - _2: Math.expm1(0.4) - }) - ], - tl: { - hd: [ - "unsafe_floor_int", - param => ({ - TAG: "Eq", - _0: 3, - _1: Math.floor(3.2) - }) - ], - tl: { - hd: [ - "floor_int", - param => ({ - TAG: "Eq", - _0: 3, - _1: Js_math.floor_int(3.2) - }) - ], - tl: { - hd: [ - "floor_float", - param => ({ - TAG: "Eq", - _0: 3, - _1: Math.floor(3.2) - }) - ], - tl: { - hd: [ - "fround", - param => ({ - TAG: "Approx", - _0: 3.2, - _1: Math.fround(3.2) - }) - ], - tl: { - hd: [ - "hypot", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.721, - _2: Math.hypot(0.4, 0.6) - }) - ], - tl: { - hd: [ - "hypotMany", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 1.077, - _2: Math.hypot(0.4, 0.6, 0.8) - }) - ], - tl: { - hd: [ - "imul", - param => ({ - TAG: "Eq", - _0: 8, - _1: Math.imul(4, 2) - }) - ], - tl: { - hd: [ - "log", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: -0.916, - _2: Math.log(0.4) - }) - ], - tl: { - hd: [ - "log1p", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.336, - _2: Math.log1p(0.4) - }) - ], - tl: { - hd: [ - "log10", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: -0.397, - _2: Math.log10(0.4) - }) - ], - tl: { - hd: [ - "log2", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: -1.321, - _2: Math.log2(0.4) - }) - ], - tl: { - hd: [ - "max_int", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.max(2, 4) - }) - ], - tl: { - hd: [ - "maxMany_int", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.max(2, 4, 3) - }) - ], - tl: { - hd: [ - "max_float", - param => ({ - TAG: "Eq", - _0: 4.2, - _1: Math.max(2.7, 4.2) - }) - ], - tl: { - hd: [ - "maxMany_float", - param => ({ - TAG: "Eq", - _0: 4.2, - _1: Math.max(2.7, 4.2, 3.9) - }) - ], - tl: { - hd: [ - "min_int", - param => ({ - TAG: "Eq", - _0: 2, - _1: Math.min(2, 4) - }) - ], - tl: { - hd: [ - "minMany_int", - param => ({ - TAG: "Eq", - _0: 2, - _1: Math.min(2, 4, 3) - }) - ], - tl: { - hd: [ - "min_float", - param => ({ - TAG: "Eq", - _0: 2.7, - _1: Math.min(2.7, 4.2) - }) - ], - tl: { - hd: [ - "minMany_float", - param => ({ - TAG: "Eq", - _0: 2.7, - _1: Math.min(2.7, 4.2, 3.9) - }) - ], - tl: { - hd: [ - "random", - param => { - let a = Math.random(); - return { - TAG: "Ok", - _0: a >= 0 && a < 1 - }; - } - ], - tl: { - hd: [ - "random_int", - param => { - let a = Js_math.random_int(1, 3); - return { - TAG: "Ok", - _0: a >= 1 && a < 3 - }; - } - ], - tl: { - hd: [ - "unsafe_round", - param => ({ - TAG: "Eq", - _0: 3, - _1: Math.round(3.2) - }) - ], - tl: { - hd: [ - "round", - param => ({ - TAG: "Eq", - _0: 3, - _1: Math.round(3.2) - }) - ], - tl: { - hd: [ - "sign_int", - param => ({ - TAG: "Eq", - _0: -1, - _1: Math.sign(-4) - }) - ], - tl: { - hd: [ - "sign_float", - param => ({ - TAG: "Eq", - _0: -1, - _1: Math.sign(-4.2) - }) - ], - tl: { - hd: [ - "sign_float -0", - param => ({ - TAG: "Eq", - _0: -0, - _1: Math.sign(-0) - }) - ], - tl: { - hd: [ - "sin", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.389, - _2: Math.sin(0.4) - }) - ], - tl: { - hd: [ - "sinh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.410, - _2: Math.sinh(0.4) - }) - ], - tl: { - hd: [ - "sqrt", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.632, - _2: Math.sqrt(0.4) - }) - ], - tl: { - hd: [ - "tan", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.422, - _2: Math.tan(0.4) - }) - ], - tl: { - hd: [ - "tanh", - param => ({ - TAG: "ApproxThreshold", - _0: 0.001, - _1: 0.379, - _2: Math.tanh(0.4) - }) - ], - tl: { - hd: [ - "unsafe_trunc", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.trunc(4.2156) - }) - ], - tl: { - hd: [ - "trunc", - param => ({ - TAG: "Eq", - _0: 4, - _1: Math.trunc(4.2156) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_math_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_math_test.mjs b/tests/tests/src/js_math_test.mjs new file mode 100644 index 0000000000..4fd0796e70 --- /dev/null +++ b/tests/tests/src/js_math_test.mjs @@ -0,0 +1,631 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_math from "rescript/lib/es6/Js_math.js"; + +let suites_0 = [ + "_E", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 2.718, + _2: Math.E + }) +]; + +let suites_1 = { + hd: [ + "_LN2", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.693, + _2: Math.LN2 + }) + ], + tl: { + hd: [ + "_LN10", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 2.303, + _2: Math.LN10 + }) + ], + tl: { + hd: [ + "_LOG2E", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.443, + _2: Math.LOG2E + }) + ], + tl: { + hd: [ + "_LOG10E", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.434, + _2: Math.LOG10E + }) + ], + tl: { + hd: [ + "_PI", + param => ({ + TAG: "ApproxThreshold", + _0: 0.00001, + _1: 3.14159, + _2: Math.PI + }) + ], + tl: { + hd: [ + "_SQRT1_2", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.707, + _2: Math.SQRT1_2 + }) + ], + tl: { + hd: [ + "_SQRT2", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.414, + _2: Math.SQRT2 + }) + ], + tl: { + hd: [ + "abs_int", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.abs(-4) + }) + ], + tl: { + hd: [ + "abs_float", + param => ({ + TAG: "Eq", + _0: 1.2, + _1: Math.abs(-1.2) + }) + ], + tl: { + hd: [ + "acos", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.159, + _2: Math.acos(0.4) + }) + ], + tl: { + hd: [ + "acosh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.622, + _2: Math.acosh(1.2) + }) + ], + tl: { + hd: [ + "asin", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.411, + _2: Math.asin(0.4) + }) + ], + tl: { + hd: [ + "asinh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.390, + _2: Math.asinh(0.4) + }) + ], + tl: { + hd: [ + "atan", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.380, + _2: Math.atan(0.4) + }) + ], + tl: { + hd: [ + "atanh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.423, + _2: Math.atanh(0.4) + }) + ], + tl: { + hd: [ + "atan2", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.588, + _2: Math.atan2(0.4, 0.6) + }) + ], + tl: { + hd: [ + "cbrt", + param => ({ + TAG: "Eq", + _0: 2, + _1: Math.cbrt(8) + }) + ], + tl: { + hd: [ + "unsafe_ceil_int", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.ceil(3.2) + }) + ], + tl: { + hd: [ + "ceil_int", + param => ({ + TAG: "Eq", + _0: 4, + _1: Js_math.ceil_int(3.2) + }) + ], + tl: { + hd: [ + "ceil_float", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.ceil(3.2) + }) + ], + tl: { + hd: [ + "cos", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.921, + _2: Math.cos(0.4) + }) + ], + tl: { + hd: [ + "cosh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.081, + _2: Math.cosh(0.4) + }) + ], + tl: { + hd: [ + "exp", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.491, + _2: Math.exp(0.4) + }) + ], + tl: { + hd: [ + "expm1", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.491, + _2: Math.expm1(0.4) + }) + ], + tl: { + hd: [ + "unsafe_floor_int", + param => ({ + TAG: "Eq", + _0: 3, + _1: Math.floor(3.2) + }) + ], + tl: { + hd: [ + "floor_int", + param => ({ + TAG: "Eq", + _0: 3, + _1: Js_math.floor_int(3.2) + }) + ], + tl: { + hd: [ + "floor_float", + param => ({ + TAG: "Eq", + _0: 3, + _1: Math.floor(3.2) + }) + ], + tl: { + hd: [ + "fround", + param => ({ + TAG: "Approx", + _0: 3.2, + _1: Math.fround(3.2) + }) + ], + tl: { + hd: [ + "hypot", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.721, + _2: Math.hypot(0.4, 0.6) + }) + ], + tl: { + hd: [ + "hypotMany", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 1.077, + _2: Math.hypot(0.4, 0.6, 0.8) + }) + ], + tl: { + hd: [ + "imul", + param => ({ + TAG: "Eq", + _0: 8, + _1: Math.imul(4, 2) + }) + ], + tl: { + hd: [ + "log", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: -0.916, + _2: Math.log(0.4) + }) + ], + tl: { + hd: [ + "log1p", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.336, + _2: Math.log1p(0.4) + }) + ], + tl: { + hd: [ + "log10", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: -0.397, + _2: Math.log10(0.4) + }) + ], + tl: { + hd: [ + "log2", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: -1.321, + _2: Math.log2(0.4) + }) + ], + tl: { + hd: [ + "max_int", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.max(2, 4) + }) + ], + tl: { + hd: [ + "maxMany_int", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.max(2, 4, 3) + }) + ], + tl: { + hd: [ + "max_float", + param => ({ + TAG: "Eq", + _0: 4.2, + _1: Math.max(2.7, 4.2) + }) + ], + tl: { + hd: [ + "maxMany_float", + param => ({ + TAG: "Eq", + _0: 4.2, + _1: Math.max(2.7, 4.2, 3.9) + }) + ], + tl: { + hd: [ + "min_int", + param => ({ + TAG: "Eq", + _0: 2, + _1: Math.min(2, 4) + }) + ], + tl: { + hd: [ + "minMany_int", + param => ({ + TAG: "Eq", + _0: 2, + _1: Math.min(2, 4, 3) + }) + ], + tl: { + hd: [ + "min_float", + param => ({ + TAG: "Eq", + _0: 2.7, + _1: Math.min(2.7, 4.2) + }) + ], + tl: { + hd: [ + "minMany_float", + param => ({ + TAG: "Eq", + _0: 2.7, + _1: Math.min(2.7, 4.2, 3.9) + }) + ], + tl: { + hd: [ + "random", + param => { + let a = Math.random(); + return { + TAG: "Ok", + _0: a >= 0 && a < 1 + }; + } + ], + tl: { + hd: [ + "random_int", + param => { + let a = Js_math.random_int(1, 3); + return { + TAG: "Ok", + _0: a >= 1 && a < 3 + }; + } + ], + tl: { + hd: [ + "unsafe_round", + param => ({ + TAG: "Eq", + _0: 3, + _1: Math.round(3.2) + }) + ], + tl: { + hd: [ + "round", + param => ({ + TAG: "Eq", + _0: 3, + _1: Math.round(3.2) + }) + ], + tl: { + hd: [ + "sign_int", + param => ({ + TAG: "Eq", + _0: -1, + _1: Math.sign(-4) + }) + ], + tl: { + hd: [ + "sign_float", + param => ({ + TAG: "Eq", + _0: -1, + _1: Math.sign(-4.2) + }) + ], + tl: { + hd: [ + "sign_float -0", + param => ({ + TAG: "Eq", + _0: -0, + _1: Math.sign(-0) + }) + ], + tl: { + hd: [ + "sin", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.389, + _2: Math.sin(0.4) + }) + ], + tl: { + hd: [ + "sinh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.410, + _2: Math.sinh(0.4) + }) + ], + tl: { + hd: [ + "sqrt", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.632, + _2: Math.sqrt(0.4) + }) + ], + tl: { + hd: [ + "tan", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.422, + _2: Math.tan(0.4) + }) + ], + tl: { + hd: [ + "tanh", + param => ({ + TAG: "ApproxThreshold", + _0: 0.001, + _1: 0.379, + _2: Math.tanh(0.4) + }) + ], + tl: { + hd: [ + "unsafe_trunc", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.trunc(4.2156) + }) + ], + tl: { + hd: [ + "trunc", + param => ({ + TAG: "Eq", + _0: 4, + _1: Math.trunc(4.2156) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_math_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_null_test.js b/tests/tests/src/js_null_test.js deleted file mode 100644 index 5602d061e0..0000000000 --- a/tests/tests/src/js_null_test.js +++ /dev/null @@ -1,143 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_null = require("rescript/lib/js/Js_null.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites_0 = [ - "toOption - empty", - param => ({ - TAG: "Eq", - _0: undefined, - _1: undefined - }) -]; - -let suites_1 = { - hd: [ - "toOption - 'a", - param => ({ - TAG: "Eq", - _0: Primitive_option.some(undefined), - _1: Primitive_option.some() - }) - ], - tl: { - hd: [ - "return", - param => ({ - TAG: "Eq", - _0: "something", - _1: Primitive_option.fromNull("something") - }) - ], - tl: { - hd: [ - "test - empty", - param => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "test - 'a", - param => ({ - TAG: "Eq", - _0: false, - _1: false - }) - ], - tl: { - hd: [ - "bind - empty", - param => ({ - TAG: "StrictEq", - _0: null, - _1: Js_null.bind(null, v => v) - }) - ], - tl: { - hd: [ - "bind - 'a", - param => ({ - TAG: "StrictEq", - _0: 4, - _1: Js_null.bind(2, n => (n << 1)) - }) - ], - tl: { - hd: [ - "iter - empty", - param => { - let hit = { - contents: false - }; - Js_null.iter(null, param => { - hit.contents = true; - }); - return { - TAG: "Eq", - _0: false, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "iter - 'a", - param => { - let hit = { - contents: 0 - }; - Js_null.iter(2, v => { - hit.contents = v; - }); - return { - TAG: "Eq", - _0: 2, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "fromOption - None", - param => ({ - TAG: "Eq", - _0: null, - _1: Js_null.fromOption(undefined) - }) - ], - tl: { - hd: [ - "fromOption - Some", - param => ({ - TAG: "Eq", - _0: 2, - _1: Js_null.fromOption(2) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_null_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_null_test.mjs b/tests/tests/src/js_null_test.mjs new file mode 100644 index 0000000000..72e46d20a1 --- /dev/null +++ b/tests/tests/src/js_null_test.mjs @@ -0,0 +1,144 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_null from "rescript/lib/es6/Js_null.js"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; + +let suites_0 = [ + "toOption - empty", + param => ({ + TAG: "Eq", + _0: undefined, + _1: undefined + }) +]; + +let suites_1 = { + hd: [ + "toOption - 'a", + param => ({ + TAG: "Eq", + _0: Primitive_option.some(undefined), + _1: Primitive_option.some() + }) + ], + tl: { + hd: [ + "return", + param => ({ + TAG: "Eq", + _0: "something", + _1: Primitive_option.fromNull("something") + }) + ], + tl: { + hd: [ + "test - empty", + param => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "test - 'a", + param => ({ + TAG: "Eq", + _0: false, + _1: false + }) + ], + tl: { + hd: [ + "bind - empty", + param => ({ + TAG: "StrictEq", + _0: null, + _1: Js_null.bind(null, v => v) + }) + ], + tl: { + hd: [ + "bind - 'a", + param => ({ + TAG: "StrictEq", + _0: 4, + _1: Js_null.bind(2, n => (n << 1)) + }) + ], + tl: { + hd: [ + "iter - empty", + param => { + let hit = { + contents: false + }; + Js_null.iter(null, param => { + hit.contents = true; + }); + return { + TAG: "Eq", + _0: false, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "iter - 'a", + param => { + let hit = { + contents: 0 + }; + Js_null.iter(2, v => { + hit.contents = v; + }); + return { + TAG: "Eq", + _0: 2, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "fromOption - None", + param => ({ + TAG: "Eq", + _0: null, + _1: Js_null.fromOption(undefined) + }) + ], + tl: { + hd: [ + "fromOption - Some", + param => ({ + TAG: "Eq", + _0: 2, + _1: Js_null.fromOption(2) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_null_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_null_undefined_test.js b/tests/tests/src/js_null_undefined_test.js deleted file mode 100644 index 0be76007f1..0000000000 --- a/tests/tests/src/js_null_undefined_test.js +++ /dev/null @@ -1,275 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); -let Js_null_undefined = require("rescript/lib/js/Js_null_undefined.js"); - -let suites_0 = [ - "toOption - null", - param => ({ - TAG: "Eq", - _0: undefined, - _1: undefined - }) -]; - -let suites_1 = { - hd: [ - "toOption - undefined", - param => ({ - TAG: "Eq", - _0: undefined, - _1: undefined - }) - ], - tl: { - hd: [ - "toOption - empty", - param => ({ - TAG: "Eq", - _0: undefined, - _1: undefined - }) - ], - tl: { - hd: [ - "File \"js_null_undefined_test.res\", line 9, characters 5-12", - param => ({ - TAG: "Eq", - _0: "foo", - _1: Primitive_option.fromNullable("foo") - }) - ], - tl: { - hd: [ - "return", - param => ({ - TAG: "Eq", - _0: "something", - _1: Primitive_option.fromNullable("something") - }) - ], - tl: { - hd: [ - "test - null", - param => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "test - undefined", - param => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "test - empty", - param => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "File \"js_null_undefined_test.res\", line 14, characters 5-12", - param => ({ - TAG: "Eq", - _0: true, - _1: true - }) - ], - tl: { - hd: [ - "bind - null", - param => ({ - TAG: "StrictEq", - _0: null, - _1: Js_null_undefined.bind(null, v => v) - }) - ], - tl: { - hd: [ - "bind - undefined", - param => ({ - TAG: "StrictEq", - _0: undefined, - _1: Js_null_undefined.bind(undefined, v => v) - }) - ], - tl: { - hd: [ - "bind - empty", - param => ({ - TAG: "StrictEq", - _0: undefined, - _1: Js_null_undefined.bind(undefined, v => v) - }) - ], - tl: { - hd: [ - "bind - 'a", - param => ({ - TAG: "Eq", - _0: 4, - _1: Js_null_undefined.bind(2, n => (n << 1)) - }) - ], - tl: { - hd: [ - "iter - null", - param => { - let hit = { - contents: false - }; - Js_null_undefined.iter(null, param => { - hit.contents = true; - }); - return { - TAG: "Eq", - _0: false, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "iter - undefined", - param => { - let hit = { - contents: false - }; - Js_null_undefined.iter(undefined, param => { - hit.contents = true; - }); - return { - TAG: "Eq", - _0: false, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "iter - empty", - param => { - let hit = { - contents: false - }; - Js_null_undefined.iter(undefined, param => { - hit.contents = true; - }); - return { - TAG: "Eq", - _0: false, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "iter - 'a", - param => { - let hit = { - contents: 0 - }; - Js_null_undefined.iter(2, v => { - hit.contents = v; - }); - return { - TAG: "Eq", - _0: 2, - _1: hit.contents - }; - } - ], - tl: { - hd: [ - "fromOption - None", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_null_undefined.fromOption(undefined) - }) - ], - tl: { - hd: [ - "fromOption - Some", - param => ({ - TAG: "Eq", - _0: 2, - _1: Js_null_undefined.fromOption(2) - }) - ], - tl: { - hd: [ - "null <> undefined", - param => ({ - TAG: "Ok", - _0: true - }) - ], - tl: { - hd: [ - "null <> empty", - param => ({ - TAG: "Ok", - _0: true - }) - ], - tl: { - hd: [ - "undefined = empty", - param => ({ - TAG: "Ok", - _0: true - }) - ], - tl: { - hd: [ - "File \"js_null_undefined_test.res\", line 57, characters 6-13", - param => ({ - TAG: "Ok", - _0: true - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_null_undefined_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_null_undefined_test.mjs b/tests/tests/src/js_null_undefined_test.mjs new file mode 100644 index 0000000000..a6970c1b5b --- /dev/null +++ b/tests/tests/src/js_null_undefined_test.mjs @@ -0,0 +1,276 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Primitive_option from "rescript/lib/es6/Primitive_option.js"; +import * as Js_null_undefined from "rescript/lib/es6/Js_null_undefined.js"; + +let suites_0 = [ + "toOption - null", + param => ({ + TAG: "Eq", + _0: undefined, + _1: undefined + }) +]; + +let suites_1 = { + hd: [ + "toOption - undefined", + param => ({ + TAG: "Eq", + _0: undefined, + _1: undefined + }) + ], + tl: { + hd: [ + "toOption - empty", + param => ({ + TAG: "Eq", + _0: undefined, + _1: undefined + }) + ], + tl: { + hd: [ + "File \"js_null_undefined_test.res\", line 9, characters 5-12", + param => ({ + TAG: "Eq", + _0: "foo", + _1: Primitive_option.fromNullable("foo") + }) + ], + tl: { + hd: [ + "return", + param => ({ + TAG: "Eq", + _0: "something", + _1: Primitive_option.fromNullable("something") + }) + ], + tl: { + hd: [ + "test - null", + param => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "test - undefined", + param => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "test - empty", + param => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "File \"js_null_undefined_test.res\", line 14, characters 5-12", + param => ({ + TAG: "Eq", + _0: true, + _1: true + }) + ], + tl: { + hd: [ + "bind - null", + param => ({ + TAG: "StrictEq", + _0: null, + _1: Js_null_undefined.bind(null, v => v) + }) + ], + tl: { + hd: [ + "bind - undefined", + param => ({ + TAG: "StrictEq", + _0: undefined, + _1: Js_null_undefined.bind(undefined, v => v) + }) + ], + tl: { + hd: [ + "bind - empty", + param => ({ + TAG: "StrictEq", + _0: undefined, + _1: Js_null_undefined.bind(undefined, v => v) + }) + ], + tl: { + hd: [ + "bind - 'a", + param => ({ + TAG: "Eq", + _0: 4, + _1: Js_null_undefined.bind(2, n => (n << 1)) + }) + ], + tl: { + hd: [ + "iter - null", + param => { + let hit = { + contents: false + }; + Js_null_undefined.iter(null, param => { + hit.contents = true; + }); + return { + TAG: "Eq", + _0: false, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "iter - undefined", + param => { + let hit = { + contents: false + }; + Js_null_undefined.iter(undefined, param => { + hit.contents = true; + }); + return { + TAG: "Eq", + _0: false, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "iter - empty", + param => { + let hit = { + contents: false + }; + Js_null_undefined.iter(undefined, param => { + hit.contents = true; + }); + return { + TAG: "Eq", + _0: false, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "iter - 'a", + param => { + let hit = { + contents: 0 + }; + Js_null_undefined.iter(2, v => { + hit.contents = v; + }); + return { + TAG: "Eq", + _0: 2, + _1: hit.contents + }; + } + ], + tl: { + hd: [ + "fromOption - None", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_null_undefined.fromOption(undefined) + }) + ], + tl: { + hd: [ + "fromOption - Some", + param => ({ + TAG: "Eq", + _0: 2, + _1: Js_null_undefined.fromOption(2) + }) + ], + tl: { + hd: [ + "null <> undefined", + param => ({ + TAG: "Ok", + _0: true + }) + ], + tl: { + hd: [ + "null <> empty", + param => ({ + TAG: "Ok", + _0: true + }) + ], + tl: { + hd: [ + "undefined = empty", + param => ({ + TAG: "Ok", + _0: true + }) + ], + tl: { + hd: [ + "File \"js_null_undefined_test.res\", line 57, characters 6-13", + param => ({ + TAG: "Ok", + _0: true + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_null_undefined_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_nullable_test.js b/tests/tests/src/js_nullable_test.js deleted file mode 100644 index 1fe258c0b8..0000000000 --- a/tests/tests/src/js_nullable_test.js +++ /dev/null @@ -1,59 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + test_id.contents.toString()), - () => ({ - TAG: "Eq", - _0: x, - _1: y - }) - ], - tl: suites.contents - }; -} - -function test(dom) { - let elem = dom.getElementById("haha"); - if (elem == null) { - return 1; - } else { - console.log(elem); - return 2; - } -} - -function f(x, y) { - console.log("no inline"); - return x + y | 0; -} - -eq("File \"js_nullable_test.res\", line 31, characters 3-10", false, false); - -eq("File \"js_nullable_test.res\", line 33, characters 3-10", (f(1, 2) == null), false); - -eq("File \"js_nullable_test.res\", line 35, characters 3-10", (null == null), true); - -eq("File \"js_nullable_test.res\", line 40, characters 5-12", false, false); - -Mt.from_pair_suites("Js_nullable_test", suites.contents); - -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -exports.test = test; -exports.f = f; -/* Not a pure module */ diff --git a/tests/tests/src/js_nullable_test.mjs b/tests/tests/src/js_nullable_test.mjs new file mode 100644 index 0000000000..858584d04a --- /dev/null +++ b/tests/tests/src/js_nullable_test.mjs @@ -0,0 +1,60 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites = { + contents: /* [] */0 +}; + +let test_id = { + contents: 0 +}; + +function eq(loc, x, y) { + test_id.contents = test_id.contents + 1 | 0; + suites.contents = { + hd: [ + loc + (" id " + test_id.contents.toString()), + () => ({ + TAG: "Eq", + _0: x, + _1: y + }) + ], + tl: suites.contents + }; +} + +function test(dom) { + let elem = dom.getElementById("haha"); + if (elem == null) { + return 1; + } else { + console.log(elem); + return 2; + } +} + +function f(x, y) { + console.log("no inline"); + return x + y | 0; +} + +eq("File \"js_nullable_test.res\", line 31, characters 3-10", false, false); + +eq("File \"js_nullable_test.res\", line 33, characters 3-10", (f(1, 2) == null), false); + +eq("File \"js_nullable_test.res\", line 35, characters 3-10", (null == null), true); + +eq("File \"js_nullable_test.res\", line 40, characters 5-12", false, false); + +Mt.from_pair_suites("Js_nullable_test", suites.contents); + +export { + suites, + test_id, + eq, + test, + f, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_obj_test.js b/tests/tests/src/js_obj_test.js deleted file mode 100644 index b39bb04e02..0000000000 --- a/tests/tests/src/js_obj_test.js +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites_0 = [ - "empty", - param => ({ - TAG: "Eq", - _0: 0, - _1: Object.keys({}).length - }) -]; - -let suites_1 = { - hd: [ - "assign", - param => ({ - TAG: "Eq", - _0: { - a: 1 - }, - _1: Object.assign({}, { - a: 1 - }) - }) - ], - tl: /* [] */0 -}; - -let suites = { - hd: suites_0, - tl: suites_1 -}; - -Mt.from_pair_suites("Js_obj_test", suites); - -exports.suites = suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_obj_test.mjs b/tests/tests/src/js_obj_test.mjs new file mode 100644 index 0000000000..0a013ea480 --- /dev/null +++ b/tests/tests/src/js_obj_test.mjs @@ -0,0 +1,40 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; + +let suites_0 = [ + "empty", + param => ({ + TAG: "Eq", + _0: 0, + _1: Object.keys({}).length + }) +]; + +let suites_1 = { + hd: [ + "assign", + param => ({ + TAG: "Eq", + _0: { + a: 1 + }, + _1: Object.assign({}, { + a: 1 + }) + }) + ], + tl: /* [] */0 +}; + +let suites = { + hd: suites_0, + tl: suites_1 +}; + +Mt.from_pair_suites("Js_obj_test", suites); + +export { + suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_option_test.js b/tests/tests/src/js_option_test.js deleted file mode 100644 index 36a0a365e0..0000000000 --- a/tests/tests/src/js_option_test.js +++ /dev/null @@ -1,251 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Js_option = require("rescript/lib/js/Js_option.js"); - -function simpleEq(a, b) { - return a === b; -} - -let option_suites_0 = [ - "option_isSome_Some", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSome(1) - }) -]; - -let option_suites_1 = { - hd: [ - "option_isSome_None", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.isSome(undefined) - }) - ], - tl: { - hd: [ - "option_isNone_Some", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.isNone(1) - }) - ], - tl: { - hd: [ - "option_isNone_None", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isNone(undefined) - }) - ], - tl: { - hd: [ - "option_isSomeValue_Eq", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 2, 2) - }) - ], - tl: { - hd: [ - "option_isSomeValue_Diff", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.isSomeValue(simpleEq, 1, 2) - }) - ], - tl: { - hd: [ - "option_isSomeValue_DiffNone", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.isSomeValue(simpleEq, 1, undefined) - }) - ], - tl: { - hd: [ - "option_getExn_Some", - param => ({ - TAG: "Eq", - _0: 2, - _1: Js_option.getExn(2) - }) - ], - tl: { - hd: [ - "option_equal_Eq", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.equal(simpleEq, 2, 2) - }) - ], - tl: { - hd: [ - "option_equal_Diff", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.equal(simpleEq, 1, 2) - }) - ], - tl: { - hd: [ - "option_equal_DiffNone", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.equal(simpleEq, 1, undefined) - }) - ], - tl: { - hd: [ - "option_andThen_SomeSome", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 3, Js_option.andThen(a => a + 1 | 0, 2)) - }) - ], - tl: { - hd: [ - "option_andThen_SomeNone", - param => ({ - TAG: "Eq", - _0: false, - _1: Js_option.isSomeValue(simpleEq, 3, Js_option.andThen(param => {}, 2)) - }) - ], - tl: { - hd: [ - "option_map_Some", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 3, Js_option.map(a => a + 1 | 0, 2)) - }) - ], - tl: { - hd: [ - "option_map_None", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_option.map(a => a + 1 | 0, undefined) - }) - ], - tl: { - hd: [ - "option_default_Some", - param => ({ - TAG: "Eq", - _0: 2, - _1: Js_option.getWithDefault(3, 2) - }) - ], - tl: { - hd: [ - "option_default_None", - param => ({ - TAG: "Eq", - _0: 3, - _1: Js_option.getWithDefault(3, undefined) - }) - ], - tl: { - hd: [ - "option_filter_Pass", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 2, Js_option.filter(a => a % 2 === 0, 2)) - }) - ], - tl: { - hd: [ - "option_filter_Reject", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_option.filter(a => a % 3 === 0, 2) - }) - ], - tl: { - hd: [ - "option_filter_None", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_option.filter(a => a % 3 === 0, undefined) - }) - ], - tl: { - hd: [ - "option_firstSome_First", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 3, Js_option.firstSome(3, 2)) - }) - ], - tl: { - hd: [ - "option_firstSome_First", - param => ({ - TAG: "Eq", - _0: true, - _1: Js_option.isSomeValue(simpleEq, 2, Js_option.firstSome(undefined, 2)) - }) - ], - tl: { - hd: [ - "option_firstSome_None", - param => ({ - TAG: "Eq", - _0: undefined, - _1: Js_option.firstSome(undefined, undefined) - }) - ], - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -let option_suites = { - hd: option_suites_0, - tl: option_suites_1 -}; - -Mt.from_pair_suites("Js_option_test", option_suites); - -exports.simpleEq = simpleEq; -exports.option_suites = option_suites; -/* Not a pure module */ diff --git a/tests/tests/src/js_option_test.mjs b/tests/tests/src/js_option_test.mjs new file mode 100644 index 0000000000..3c4ab8a792 --- /dev/null +++ b/tests/tests/src/js_option_test.mjs @@ -0,0 +1,252 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE + +import * as Mt from "./mt.mjs"; +import * as Js_option from "rescript/lib/es6/Js_option.js"; + +function simpleEq(a, b) { + return a === b; +} + +let option_suites_0 = [ + "option_isSome_Some", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSome(1) + }) +]; + +let option_suites_1 = { + hd: [ + "option_isSome_None", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.isSome(undefined) + }) + ], + tl: { + hd: [ + "option_isNone_Some", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.isNone(1) + }) + ], + tl: { + hd: [ + "option_isNone_None", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isNone(undefined) + }) + ], + tl: { + hd: [ + "option_isSomeValue_Eq", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 2, 2) + }) + ], + tl: { + hd: [ + "option_isSomeValue_Diff", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.isSomeValue(simpleEq, 1, 2) + }) + ], + tl: { + hd: [ + "option_isSomeValue_DiffNone", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.isSomeValue(simpleEq, 1, undefined) + }) + ], + tl: { + hd: [ + "option_getExn_Some", + param => ({ + TAG: "Eq", + _0: 2, + _1: Js_option.getExn(2) + }) + ], + tl: { + hd: [ + "option_equal_Eq", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.equal(simpleEq, 2, 2) + }) + ], + tl: { + hd: [ + "option_equal_Diff", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.equal(simpleEq, 1, 2) + }) + ], + tl: { + hd: [ + "option_equal_DiffNone", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.equal(simpleEq, 1, undefined) + }) + ], + tl: { + hd: [ + "option_andThen_SomeSome", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 3, Js_option.andThen(a => a + 1 | 0, 2)) + }) + ], + tl: { + hd: [ + "option_andThen_SomeNone", + param => ({ + TAG: "Eq", + _0: false, + _1: Js_option.isSomeValue(simpleEq, 3, Js_option.andThen(param => {}, 2)) + }) + ], + tl: { + hd: [ + "option_map_Some", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 3, Js_option.map(a => a + 1 | 0, 2)) + }) + ], + tl: { + hd: [ + "option_map_None", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_option.map(a => a + 1 | 0, undefined) + }) + ], + tl: { + hd: [ + "option_default_Some", + param => ({ + TAG: "Eq", + _0: 2, + _1: Js_option.getWithDefault(3, 2) + }) + ], + tl: { + hd: [ + "option_default_None", + param => ({ + TAG: "Eq", + _0: 3, + _1: Js_option.getWithDefault(3, undefined) + }) + ], + tl: { + hd: [ + "option_filter_Pass", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 2, Js_option.filter(a => a % 2 === 0, 2)) + }) + ], + tl: { + hd: [ + "option_filter_Reject", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_option.filter(a => a % 3 === 0, 2) + }) + ], + tl: { + hd: [ + "option_filter_None", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_option.filter(a => a % 3 === 0, undefined) + }) + ], + tl: { + hd: [ + "option_firstSome_First", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 3, Js_option.firstSome(3, 2)) + }) + ], + tl: { + hd: [ + "option_firstSome_First", + param => ({ + TAG: "Eq", + _0: true, + _1: Js_option.isSomeValue(simpleEq, 2, Js_option.firstSome(undefined, 2)) + }) + ], + tl: { + hd: [ + "option_firstSome_None", + param => ({ + TAG: "Eq", + _0: undefined, + _1: Js_option.firstSome(undefined, undefined) + }) + ], + tl: /* [] */0 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +let option_suites = { + hd: option_suites_0, + tl: option_suites_1 +}; + +Mt.from_pair_suites("Js_option_test", option_suites); + +export { + simpleEq, + option_suites, +} +/* Not a pure module */ diff --git a/tests/tests/src/js_re_test.js b/tests/tests/src/js_re_test.js deleted file mode 100644 index c202252c06..0000000000 --- a/tests/tests/src/js_re_test.js +++ /dev/null @@ -1,279 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); -let Primitive_array = require("rescript/lib/js/Primitive_array.js"); -let Primitive_option = require("rescript/lib/js/Primitive_option.js"); - -let suites_0 = [ - "captures", - param => { - let re = /(\d+)-(?:(\d+))?/g; - let result = re.exec("3-"); - if (result === null) { - return { - TAG: "Fail", - _0: undefined - }; - } - let defined = Primitive_array.get(result, 1); - let $$undefined = Primitive_array.get(result, 2); - return { - TAG: "Eq", - _0: [ - "3", - null - ], - _1: [ - defined, - $$undefined - ] - }; - } -]; - -let suites_1 = { - hd: [ - "fromString", - param => { - let contentOf = (tag, xmlString) => { - let x = Primitive_option.fromNull(new RegExp("<" + (tag + (">(.*?)<\\/" + (tag + ">")))).exec(xmlString)); - if (x !== undefined) { - return Primitive_option.fromNullable(Primitive_array.get(Primitive_option.valFromOption(x), 1)); - } - - }; - return { - TAG: "Eq", - _0: contentOf("div", "