summaryrefslogtreecommitdiff
path: root/src/test/lib/tests/test_mod_signed.sail
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-07-26 14:12:09 +0100
committerAlasdair Armstrong2017-07-26 14:12:09 +0100
commit678ab0e23ba4a8d95010df2bd2467dae7d544e29 (patch)
tree0b2e02773327b9483f24b2e1ad46b7235ec9633e /src/test/lib/tests/test_mod_signed.sail
parent26e59493cde0ffbf1868426fe3bec158f2dbaad0 (diff)
parent18cf235fad35a0e06e26ea91ee0e1c673febddb8 (diff)
Merge remote-tracking branch 'origin/master' into sail_new_tc
Diffstat (limited to 'src/test/lib/tests/test_mod_signed.sail')
-rw-r--r--src/test/lib/tests/test_mod_signed.sail26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/lib/tests/test_mod_signed.sail b/src/test/lib/tests/test_mod_signed.sail
new file mode 100644
index 00000000..61acec17
--- /dev/null
+++ b/src/test/lib/tests/test_mod_signed.sail
@@ -0,0 +1,26 @@
+function unit test () = {
+ ();
+ (* XXX mod_signed does exist on ocaml shallow embedding...
+ test_assert ("mod_signed_pospos_exact", (21 mod_s 7) == 0);
+ test_assert ("mod_signed_posneg_exact", (21 mod_s -7) == 0);
+ test_assert ("mod_signed_negpos_exact", (-21 mod_s 7) == 0);
+ test_assert ("mod_signed_negneg_exact", (-21 mod_s -7) == 0);
+
+ test_assert ("mod_signed_pospos_approx", (21 mod_s 8) == 5);
+ test_assert ("mod_signed_posneg_approx", (21 mod_s -8) == 5);
+ test_assert ("mod_signed_negpos_approx", (-21 mod_s 8) == -5);
+ test_assert ("mod_signed_negneg_approx", (-21 mod_s -8) == -5);
+
+ (* XXX how to test this? Type checker should catch?
+ test_assert ("mod_signed_zero", (21 mod_s 0) == undefined); *)
+
+ test_assert("mod_vec_range_signed_pos", (0x7 mod_s 5) == 2);
+ test_assert("mod_vec_range_signed_neg", (0xf mod_s 5) == -1);
+
+ test_assert("mod_vec_signed_pos", (0x7 mod_s 0x5) == 0x2);
+ test_assert("mod_vec_signed_neg", (0xf mod_s 0x5) == 0xf);
+ test_assert("mod_vec_signed_pos_neg", (0x7 mod_s 0x8) == 0x7);
+ test_assert("mod_vec_signed_neg_neg", (0xf mod_s 0x8) == 0x7);
+ *)
+}
+