diff options
| author | Robert Norton | 2017-07-19 18:08:02 +0100 |
|---|---|---|
| committer | Robert Norton | 2017-07-19 18:08:02 +0100 |
| commit | 632b10c0d4b01dc1af8593b8ae1f088fbfd9e342 (patch) | |
| tree | ac566808213125670da5f4dc3d702fe663333f7e /src/test/lib/tests/test_misc.sail | |
| parent | d8969b1f9631dc15d5fb6b3b33a4a69dbfb7358a (diff) | |
split library tests into separate files to avoid risk of sail compiler stack overflow.
Diffstat (limited to 'src/test/lib/tests/test_misc.sail')
| -rw-r--r-- | src/test/lib/tests/test_misc.sail | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/lib/tests/test_misc.sail b/src/test/lib/tests/test_misc.sail new file mode 100644 index 00000000..5b4b6fd4 --- /dev/null +++ b/src/test/lib/tests/test_misc.sail @@ -0,0 +1,19 @@ +function unit test () = { + test_assert ("power0", (0 ** 3) == 0); + test_assert ("power1", (3 ** 0) == 1); + test_assert ("power2", (11 ** 17) == 505447028499293771); + (* XXX should be type error but isn't + test_assert ("power-1", (1 ** -1) == 0); *) + + test_assert ("abs_neg", (abs (-42)) == 42); + test_assert ("abs_zero", (abs (0)) == 0); + test_assert ("abs_pos", (abs (143)) == 143); + + test_assert ("max", max(-1, 1) == 1); + test_assert ("min", min(-1, 1) == -1); + + test_assert ("length0", length([]) == 0); + test_assert ("length1", length([bitzero]) == 1); + test_assert ("length2", length(0x1234) == 16); +} + |
