summaryrefslogtreecommitdiff
path: root/src/test/lib/tests/test_quot_signed.sail
diff options
context:
space:
mode:
authorRobert Norton2017-07-19 18:08:02 +0100
committerRobert Norton2017-07-19 18:08:02 +0100
commit632b10c0d4b01dc1af8593b8ae1f088fbfd9e342 (patch)
treeac566808213125670da5f4dc3d702fe663333f7e /src/test/lib/tests/test_quot_signed.sail
parentd8969b1f9631dc15d5fb6b3b33a4a69dbfb7358a (diff)
split library tests into separate files to avoid risk of sail compiler stack overflow.
Diffstat (limited to 'src/test/lib/tests/test_quot_signed.sail')
-rw-r--r--src/test/lib/tests/test_quot_signed.sail18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/lib/tests/test_quot_signed.sail b/src/test/lib/tests/test_quot_signed.sail
new file mode 100644
index 00000000..39259204
--- /dev/null
+++ b/src/test/lib/tests/test_quot_signed.sail
@@ -0,0 +1,18 @@
+function unit test () = {
+ test_assert ("quot_vec_signed_pospos_exact", ((bit[8])(0x15 quot_s 0x07)) == 0x03);
+ test_assert ("quot_vec_signed_posneg_exact", ((bit[8])(0x15 quot_s 0xf9)) == 0xfd);
+ test_assert ("quot_vec_signed_negpos_exact", ((bit[8])(0xeb quot_s 0x07)) == 0xfd);
+ test_assert ("quot_vec_signed_negneg_exact", ((bit[8])(0xeb quot_s 0xf9)) == 0x03);
+
+ test_assert ("quot_vec_signed_pospos_approx", ((bit[8])(0x15 quot_s 0x08)) == 0x02);
+ test_assert ("quot_vec_signed_posneg_approx", ((bit[8])(0x15 quot_s 0xf8)) == 0xfe);
+ test_assert ("quot_vec_signed_negpos_approx", ((bit[8])(0xeb quot_s 0x08)) == 0xfe);
+ test_assert ("quot_vec_signed_negneg_approx", ((bit[8])(0xeb quot_s 0xf8)) == 0x02);
+
+ test_assert ("quot_signed_overflow_vec", (((bit[8], bit, bit))(0x15 quot_s 0x08)) == (0x02, false, false));
+ (* XXX crashes shallow embedding due to undefined result
+ let (result, overflow, carry) = ((bit[8], bit, bit))(0x80 quot_s 0xff) in {
+ test_assert ("quot_signed_overflow_vec_ov", overflow);
+ test_assert ("quot_signed_overflow_vec_ca", carry);
+ };*)
+}