-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 intPow = ((a, b) => Math.pow(a, b) | 0); | ||
|
||
eq("File \"exponentiation_test.res\", line 10, characters 5-12", 2 ** 3 ** 2, Math.pow(2, Math.pow(3, 2))); | ||
|
||
eq("File \"exponentiation_test.res\", line 11, characters 5-12", 2 ** (-3) ** 2, Math.pow(2, Math.pow(-3, 2))); | ||
|
||
eq("File \"exponentiation_test.res\", line 12, characters 5-12", (2 ** 3) ** 2, Math.pow(Math.pow(2, 3), 2)); | ||
|
||
eq("File \"exponentiation_test.res\", line 13, characters 5-12", (-2) ** 2, Math.pow(-2, 2)); | ||
|
||
eq("File \"exponentiation_test.res\", line 15, characters 5-12", 512, intPow(2, intPow(3, 2))); | ||
|
||
eq("File \"exponentiation_test.res\", line 16, characters 5-12", 512, intPow(2, intPow(-3, 2))); | ||
|
||
eq("File \"exponentiation_test.res\", line 17, characters 5-12", 64, intPow(intPow(2, 3), 2)); | ||
|
||
eq("File \"exponentiation_test.res\", line 18, characters 5-12", -2147483648, intPow(-2, 31)); | ||
|
||
eq("File \"exponentiation_test.res\", line 19, characters 5-12", 0, intPow(2, 32)); | ||
|
||
Mt.from_pair_suites("Exponentiation_test", suites.contents); | ||
|
||
export { | ||
suites, | ||
test_id, | ||
eq, | ||
intPow, | ||
} | ||
/* Not a pure module */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
let suites: ref<Mt.pair_suites> = ref(list{}) | ||
let test_id = ref(0) | ||
let eq = (loc, x, y) => Mt.eq_suites(~test_id, ~suites, loc, x, y) | ||
|
||
external jsPow: (float, float) => float = "Math.pow" | ||
|
||
let intPow: (int, int) => int = %raw(`(a, b) => Math.pow(a, b) | 0`) | ||
|
||
let () = { | ||
eq(__LOC__, 2. ** 3. ** 2., jsPow(2., jsPow(3., 2.))) | ||
eq(__LOC__, 2. ** -3. ** 2., jsPow(2., jsPow(-3., 2.))) | ||
eq(__LOC__, (2. ** 3.) ** 2., jsPow(jsPow(2., 3.), 2.)) | ||
eq(__LOC__, -2. ** 2., jsPow(-2., 2.)) | ||
|
||
eq(__LOC__, 2 ** 3 ** 2, intPow(2, intPow(3, 2))) | ||
eq(__LOC__, 2 ** -3 ** 2, intPow(2, intPow(-3, 2))) | ||
eq(__LOC__, (2 ** 3) ** 2, intPow(intPow(2, 3), 2)) | ||
eq(__LOC__, -2 ** 31, intPow(-2, 31)) | ||
eq(__LOC__, 2 ** 32, intPow(2, 32)) | ||
} | ||
|
||
let () = Mt.from_pair_suites(__MODULE__, suites.contents) |