diff options
| author | Alasdair Armstrong | 2017-07-26 14:12:09 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-07-26 14:12:09 +0100 |
| commit | 678ab0e23ba4a8d95010df2bd2467dae7d544e29 (patch) | |
| tree | 0b2e02773327b9483f24b2e1ad46b7235ec9633e /src/test/lib/tests/test_misc.sail | |
| parent | 26e59493cde0ffbf1868426fe3bec158f2dbaad0 (diff) | |
| parent | 18cf235fad35a0e06e26ea91ee0e1c673febddb8 (diff) | |
Merge remote-tracking branch 'origin/master' into sail_new_tc
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); +} + |
