summaryrefslogtreecommitdiff
path: root/src/test/lib
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-07-30 19:16:34 +0100
committerAlasdair Armstrong2018-08-01 16:42:33 +0100
commit1479ae359fd3afebf9c3dfb6e58a77254e8140ea (patch)
treeffcfd96409467a5c41009f68afe1f65a2c7a3d49 /src/test/lib
parent0b70a9d7464d6c30534d2f511cb8c9879c76b1e5 (diff)
Remove old test directory in src/test
Diffstat (limited to 'src/test/lib')
-rw-r--r--src/test/lib/Makefile52
-rw-r--r--src/test/lib/run_test_embed.ml2
-rw-r--r--src/test/lib/test_epilogue.sail5
-rw-r--r--src/test/lib/test_prelude.sail19
-rwxr-xr-xsrc/test/lib/test_to_junit.sh62
-rw-r--r--src/test/lib/tests/test_add.sail19
-rw-r--r--src/test/lib/tests/test_add_signed.sail27
-rw-r--r--src/test/lib/tests/test_and.sail7
-rw-r--r--src/test/lib/tests/test_div.sail39
-rw-r--r--src/test/lib/tests/test_duplicate.sail14
-rw-r--r--src/test/lib/tests/test_eq.sail18
-rw-r--r--src/test/lib/tests/test_ext.sail15
-rw-r--r--src/test/lib/tests/test_gt.sail36
-rw-r--r--src/test/lib/tests/test_gteq.sail41
-rw-r--r--src/test/lib/tests/test_leftshift.sail11
-rw-r--r--src/test/lib/tests/test_lt.sail36
-rw-r--r--src/test/lib/tests/test_lteq.sail40
-rw-r--r--src/test/lib/tests/test_minus.sail25
-rw-r--r--src/test/lib/tests/test_minus_signed.sail27
-rw-r--r--src/test/lib/tests/test_misc.sail19
-rw-r--r--src/test/lib/tests/test_mod.sail23
-rw-r--r--src/test/lib/tests/test_mod_signed.sail26
-rw-r--r--src/test/lib/tests/test_multiply.sail21
-rw-r--r--src/test/lib/tests/test_neq.sail20
-rw-r--r--src/test/lib/tests/test_not.sail8
-rw-r--r--src/test/lib/tests/test_oddments.sail14
-rw-r--r--src/test/lib/tests/test_or.sail7
-rw-r--r--src/test/lib/tests/test_quot_signed.sail18
-rw-r--r--src/test/lib/tests/test_rightshift.sail10
-rw-r--r--src/test/lib/tests/test_rotate.sail7
-rw-r--r--src/test/lib/tests/test_xor.sail7
31 files changed, 0 insertions, 675 deletions
diff --git a/src/test/lib/Makefile b/src/test/lib/Makefile
deleted file mode 100644
index fbd5a332..00000000
--- a/src/test/lib/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-
-# Disable built-in make madness
-MAKEFLAGS=-r
-.SUFFIXES:
-
-TESTS=div.sail
-
-BITBUCKET_DIR:=$(realpath ../../../../)
-LEM_DIR:=$(BITBUCKET_DIR)/lem
-LEM:=$(LEM_DIR)/lem
-SAIL_DIR:=$(BITBUCKET_DIR)/sail/src
-SAIL:=$(SAIL_DIR)/sail.native
-SAIL_VALUES:=$(SAIL_DIR)/gen_lib/sail_values.ml
-
-BUILD_DIR:=_build
-
-TESTS:=$(wildcard tests/*.sail)
-OCAML_RESULTS:=$(addsuffix _embed.out,$(addprefix $(BUILD_DIR)/,$(notdir $(basename $(TESTS)))))
-INTERP_RESULTS:=$(addsuffix _interp.out,$(addprefix $(BUILD_DIR)/,$(notdir $(basename $(TESTS)))))
-
-all: tests.xml
-
-clean:
- rm -rf $(BUILD_DIR) tests.xml
-
-$(BUILD_DIR):
- mkdir -p $@
-
-$(BUILD_DIR)/run_test_embed.ml: | $(BUILD_DIR)
- cp run_test_embed.ml $(BUILD_DIR)
-
-$(BUILD_DIR)/run_test_interp.ml: | $(BUILD_DIR)
- cp run_test_interp.ml $(BUILD_DIR)
-
-$(BUILD_DIR)/sail_values.ml: | $(BUILD_DIR)
- cp $(SAIL_VALUES) $(BUILD_DIR)
-
-$(BUILD_DIR)/%_embed.out : tests/%.sail $(BUILD_DIR)/run_test_embed.ml $(BUILD_DIR)/sail_values.ml
- cd $(BUILD_DIR) && \
- $(SAIL) -ocaml ../test_prelude.sail ../$< ../test_epilogue.sail -o test && \
- ocamlfind ocamlopt -package zarith -linkpkg sail_values.ml test.ml run_test_embed.ml -o test_embed.native && \
- ./test_embed.native > $(notdir $@)
-
-$(BUILD_DIR)/%_interp.out : tests/%.sail $(BUILD_DIR)/run_test_interp.ml
- cd $(BUILD_DIR) && \
- $(SAIL) -lem_ast ../test_prelude.sail ../$< ../test_epilogue.sail -o test_lem_ast && \
- $(LEM) -ocaml test_lem_ast.lem -lib $(SAIL_DIR)/lem_interp && \
- ocamlfind ocamlopt -g -package num -package zarith -package lem -linkpkg -I $(SAIL_DIR)/_build/lem_interp $(SAIL_DIR)/_build/lem_interp/extract.cmxa test_lem_ast.ml run_test_interp.ml -o test_interp.native && \
- ./test_interp.native >$(notdir $@) 2>&1
-
-tests.xml: $(OCAML_RESULTS) $(INTERP_RESULTS)
- ./test_to_junit.sh $^
diff --git a/src/test/lib/run_test_embed.ml b/src/test/lib/run_test_embed.ml
deleted file mode 100644
index f7b45316..00000000
--- a/src/test/lib/run_test_embed.ml
+++ /dev/null
@@ -1,2 +0,0 @@
-Test._run()
-
diff --git a/src/test/lib/test_epilogue.sail b/src/test/lib/test_epilogue.sail
deleted file mode 100644
index 434b8a95..00000000
--- a/src/test/lib/test_epilogue.sail
+++ /dev/null
@@ -1,5 +0,0 @@
-(* TranslateAddress compatible "main" function *)
-function (bit[64]) run ((bit[64]) x) = {
- test();
- return 0;
-}
diff --git a/src/test/lib/test_prelude.sail b/src/test/lib/test_prelude.sail
deleted file mode 100644
index 3525af8e..00000000
--- a/src/test/lib/test_prelude.sail
+++ /dev/null
@@ -1,19 +0,0 @@
-default Order inc
-
-scattered typedef ast = const union
-val ast -> unit effect pure execute
-scattered function unit execute
-
-union ast member (unit) DUMMY
-function clause execute (DUMMY) = ()
-
-end ast
-end execute
-
-function unit test_assert (name, pred) = {
- print (name);
- if pred then
- print (": pass\n")
- else
- print(": fail\n")
-}
diff --git a/src/test/lib/test_to_junit.sh b/src/test/lib/test_to_junit.sh
deleted file mode 100755
index 71e908bd..00000000
--- a/src/test/lib/test_to_junit.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-YELLOW='\033[0;33m'
-NC='\033[0m'
-
-
-pass=0
-fail=0
-
-XML=""
-
-XML_FILE=tests.xml
-
-function green {
- (( pass += 1 ))
- printf "$1: ${GREEN}$2${NC}\n"
- XML+=" <testcase name=\"$1\"/>\n"
-}
-
-function yellow {
- (( fail += 1 ))
- printf "$1: ${YELLOW}$2${NC}\n"
- XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
-}
-
-function red {
- (( fail += 1 ))
- printf "$1: ${RED}$2${NC}\n"
- XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
-}
-
-function finish_suite {
- printf "$1: Passed ${pass} out of $(( pass + fail ))\n"
- XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n"
- printf "$XML" >> $XML_FILE
- XML=""
- pass=0
- fail=0
-}
-
-test_regex="^\"*([^\"]*)\"*: (pass|fail)$"
-echo "<testsuites>" > $XML_FILE
-for result_file in $@; do
- while read line; do
- if [[ $line =~ $test_regex ]] ; then
- test_name=${BASH_REMATCH[1]}
- test_status=${BASH_REMATCH[2]}
- if [[ $test_status == pass ]] ; then
- green $test_name $test_status
- else
- red $test_name $test_status
- fi
- else
- echo $line
- fi
- done < "$result_file"
- finish_suite $result_file
-done
-echo "</testsuites>" >> $XML_FILE
diff --git a/src/test/lib/tests/test_add.sail b/src/test/lib/tests/test_add.sail
deleted file mode 100644
index ce0a19f0..00000000
--- a/src/test/lib/tests/test_add.sail
+++ /dev/null
@@ -1,19 +0,0 @@
-function unit test () = {
- test_assert ("add", 1 + 1 == 2);
- test_assert ("add_vec", ((bit[4])(0x1 + 0x1)) == 0x2);
- test_assert ("add_vec_ov", ((bit[4])(0xf + 0x1)) == 0x0);
- test_assert ("add_vec_vec_range", ((range<0,30>)(0x1 + 0x1)) == 2);
- test_assert ("add_vec_vec_range_ov", ((range<0,15>)(0xf + 0x1)) == 0); (* XXX broken... *)
- test_assert ("add_vec_range", ((bit[4])(0x1 + 1)) == 0x2);
- test_assert ("add_vec_range_range", ((range<0,15>)(0xe + 1)) == 15);
- test_assert ("add_overflow_vec", (((bit[4], bit, bit))(0x1 + 0x1)) == (0x2, false, false));
- test_assert ("add_overflow_vec_ov", (((bit[4], bit, bit))(0xf + 0x1)) == (0x0, true, true)); (* XXX overflow flag makes no sense for unsigned... *)
- test_assert ("add_overflow_vec_ovs", (((bit[4], bit, bit))(0x4 + 0x4)) == (0x8, false, false));
- test_assert ("add_vec_range_range", ((range<0,16>)(0xe + 1)) == 15);
- test_assert ("add_range_vec", ((bit[4])(1 + 0xe)) == 0xf);
- test_assert ("add_range_vec_range", ((range<0,3>)(1 + 0xe)) == 15);
- test_assert ("add_vec_bit", ((bit[4])(0xe + bitone)) == 0xf);
- (* not defined on either model...
- test_assert ("add_bit_vec", ((bit[4])(bitone + 0x1)) == 0x2); *)
-}
-
diff --git a/src/test/lib/tests/test_add_signed.sail b/src/test/lib/tests/test_add_signed.sail
deleted file mode 100644
index a723389e..00000000
--- a/src/test/lib/tests/test_add_signed.sail
+++ /dev/null
@@ -1,27 +0,0 @@
-function unit test() = {
- test_assert ("adds", 1 +_s 1 == 2); (* same as unsigned *)
- test_assert ("adds_vec", ((bit[4])(0x1 +_s 0x1)) == 0x2); (* same as unsigned *)
- test_assert ("adds_vec_ov", ((bit[4])(0xf +_s 0x1)) == 0x0); (* same as unsigned *)
-
- (* XXX would be good to restrict range type *)
- test_assert ("adds_vec_vec_range_pp", ((int)(0x1 +_s 0x1)) == 2);
- test_assert ("adds_vec_vec_range_np", ((int)(0xa +_s 0x1)) == (-5));
- test_assert ("adds_vec_vec_range_pn", ((int)(0x3 +_s 0xe)) == 1);
- test_assert ("adds_vec_vec_range_nn", ((int)(0x8 +_s 0x8)) == (-16));
-
- test_assert ("adds_vec_range", ((bit[4])(0xe +_s 1)) == 0xf);
- test_assert ("adds_vec_range_range", ((int)(0xe +_s 1)) == (-1));
- (* returns (result, signed overflow, carry out)*)
- test_assert ("adds_overflow_vec0", (((bit[4], bit, bit))(0x1 +_s 0x1)) == (0x2, false, false));
- test_assert ("adds_overflow_vec1", (((bit[4], bit, bit))(0xf +_s 0x1)) == (0x0, false, true));
- test_assert ("adds_overflow_vec2", (((bit[4], bit, bit))(0x7 +_s 0x1)) == (0x8, true, false));
- test_assert ("adds_overflow_vec3", (((bit[4], bit, bit))(0x8 +_s 0x8)) == (0x0, true, true));
-
- test_assert ("adds_vec_range_range", ((int)(0xe +_s 1)) == (-1));
- test_assert ("adds_range_vec", ((bit[4])(1 +_s 0xe)) == 0xf);
- test_assert ("adds_range_vec_range", ((int)(1 +_s 0xe)) == -1);
- test_assert ("adds_vec_bit", ((bit[4])(0xe +_s bitone)) == 0xf);
- (* not defined on either model...
- test_assert ("adds_bit_vec", ((bit[4])(bitone +_s 0xe)) == 0xf);*)
-}
-
diff --git a/src/test/lib/tests/test_and.sail b/src/test/lib/tests/test_and.sail
deleted file mode 100644
index 7c9cd800..00000000
--- a/src/test/lib/tests/test_and.sail
+++ /dev/null
@@ -1,7 +0,0 @@
-function unit test () = {
- test_assert ("bitwise_and", (0b0101 & 0b0011) == 0b0001);
- test_assert ("bitwise_and_00", (bitzero & bitzero) == bitzero);
- test_assert ("bitwise_and_01", (bitzero & bitone) == bitzero);
- test_assert ("bitwise_and_10", (bitone & bitzero) == bitzero);
- test_assert ("bitwise_and_11", (bitone & bitone) == bitone);
-}
diff --git a/src/test/lib/tests/test_div.sail b/src/test/lib/tests/test_div.sail
deleted file mode 100644
index 1af58d20..00000000
--- a/src/test/lib/tests/test_div.sail
+++ /dev/null
@@ -1,39 +0,0 @@
-function unit test () = {
- test_assert ("divpospos_exact", (21 div 7) == 3);
- test_assert ("divposneg_exact", (21 div -7) == -3);
- test_assert ("divnegpos_exact", (-21 div 7) == -3);
- test_assert ("divnegneg_exact", (-21 div -7) == 3);
-
- test_assert ("divpospos_approx", (21 div 8) == 2);
- test_assert ("divposneg_approx", (21 div -8) == -2);
- test_assert ("divnegpos_approx", (-21 div 8) == -2);
- test_assert ("divnegneg_approx", (-21 div -8) == 2);
-
- (* quot and div are synonyms but let's check... *)
- test_assert ("quotpospos_exact", (21 quot 7) == 3);
- test_assert ("quotposneg_exact", (21 quot -7) == -3);
- test_assert ("quotnegpos_exact", (-21 quot 7) == -3);
- test_assert ("quotnegneg_exact", (-21 quot -7) == 3);
-
- test_assert ("quotpospos_approx", (21 quot 8) == 2);
- test_assert ("quotposneg_approx", (21 quot -8) == -2);
- test_assert ("quotnegpos_approx", (-21 quot 8) == -2);
- test_assert ("quotnegneg_approx", (-21 quot -8) == 2);
-
- (* XXX currently crashes on shallow embedding
- test_assert ("div_overflow", ((bit[8])(0x80 quot_s 0xff)) == 0x80);
- *)
- test_assert ("quot_vec_pospos_exact", ((bit[8])(0x15 quot 0x07)) == 0x03);
- test_assert ("quot_vec_posneg_exact", ((bit[8])(0x15 quot 0xf9)) == 0x00);
- test_assert ("quot_vec_negpos_exact", ((bit[8])(0xeb quot 0x07)) == 0x21);
- test_assert ("quot_vec_negneg_exact", ((bit[8])(0xeb quot 0xf9)) == 0x00);
-
- test_assert ("quot_vec_pospos_approx", ((bit[8])(0x15 quot 0x08)) == 0x02);
- test_assert ("quot_vec_posneg_approx", ((bit[8])(0x15 quot 0xf8)) == 0x00);
- test_assert ("quot_vec_negpos_approx", ((bit[8])(0xeb quot 0x08)) == 0x1d);
- test_assert ("quot_vec_negneg_approx", ((bit[8])(0xeb quot 0xf8)) == 0x00);
-
- test_assert ("quot_overflow_vec", (((bit[8], bit, bit))(0x15 quot 0x08)) == (0x02, false, false));
- test_assert ("quot_overflow_vec", (((bit[8], bit, bit))(0x80 quot 0xff)) == (0x00, false, false));
-}
-
diff --git a/src/test/lib/tests/test_duplicate.sail b/src/test/lib/tests/test_duplicate.sail
deleted file mode 100644
index 99ffbe6c..00000000
--- a/src/test/lib/tests/test_duplicate.sail
+++ /dev/null
@@ -1,14 +0,0 @@
-function unit test () = {
- (* XXX crashes on shallow embedding
- should type have a constraint n>0?
- test_assert ("duplicate_empty", (bitzero ^^ 0) == []); *)
- test_assert ("duplicate0", (bitzero ^^ 8) == 0x00);
- test_assert ("duplicate1", (bitone ^^ 8) == 0xff);
-
- (* XXX crashes on shallow embedding
- test_assert ("duplicate_bits0", (0x21 ^^ 0) == []);*)
- test_assert ("duplicate_bits1", (0xce ^^ 1) == 0xce);
- test_assert ("duplicate_bits9", (0xce ^^ 9) == 0xcecececececececece);
- test_assert ("duplicate_covfefe", (0xc0 : (0xfe ^^ 2)) == 0xc0fefe);
-}
-
diff --git a/src/test/lib/tests/test_eq.sail b/src/test/lib/tests/test_eq.sail
deleted file mode 100644
index 3000b7c5..00000000
--- a/src/test/lib/tests/test_eq.sail
+++ /dev/null
@@ -1,18 +0,0 @@
-function unit test () = {
- test_assert("eq_bit00", false == bitzero);
- test_assert("eq_bit01", not(false == bitone));
- test_assert("eq_bit10", not(true == bitzero));
- test_assert("eq_bit11", true == bitone);
-
- test_assert("eq_vec0", not (0x1 == 0x2));
- test_assert("eq_vec1", 0x2 == 0x2);
- test_assert("eq_vec_range0", not (0xf == 16));
- test_assert("eq_vec_range1", 0xf == 15);
- test_assert("eq_range_vec0", not (16 == 0xf));
- test_assert("eq_range_vec1", 15 == 0xf);
- test_assert("eq_range0", not(12 == 13));
- test_assert("eq_range1", 13 == 13);
- test_assert("eq_tup0", not ((true, false) == (bitzero, bitzero)));
- test_assert("eq_tup1", (true, false) == (bitone, bitzero));
-}
-
diff --git a/src/test/lib/tests/test_ext.sail b/src/test/lib/tests/test_ext.sail
deleted file mode 100644
index 1cbc2855..00000000
--- a/src/test/lib/tests/test_ext.sail
+++ /dev/null
@@ -1,15 +0,0 @@
-function unit test () = {
- test_assert ("extz0", EXTZ(0b00) == 0x00);
- test_assert ("extz1", EXTZ(0b10) == 0x02);
- test_assert ("extz2", EXTZ(0b10) == 0b10);
- test_assert ("extz3", EXTZ(0b10) == 0b0);
-
- test_assert ("exts0", EXTS(0b00) == 0x00);
- test_assert ("exts1", EXTS(0b10) == 0xfe);
- test_assert ("exts2", EXTS(0b10) == 0b10);
- test_assert ("exts3", EXTS(0b10) == 0b0);
-
- test_assert ("most_significant0", most_significant(0b011) == bitzero);
- test_assert ("most_significant1", most_significant(0b100) == bitone);
- }
-
diff --git a/src/test/lib/tests/test_gt.sail b/src/test/lib/tests/test_gt.sail
deleted file mode 100644
index 8576a8cd..00000000
--- a/src/test/lib/tests/test_gt.sail
+++ /dev/null
@@ -1,36 +0,0 @@
-function unit test() = {
- test_assert("gt0", ( 1 > -1));
- test_assert("gt1", not(-1 > -1));
- test_assert("gt2", not(-1 > 1));
-
- (* XXX default is signed -- document this! *)
- test_assert("gt_vec0", (0x1 > 0xf));
- test_assert("gt_vec1", not(0xf > 0xf));
- test_assert("gt_vec2", not(0xf > 0x1));
-
- test_assert("gt_vec_range0", (0x1 > -1));
- test_assert("gt_vec_range1", not(0xf > -1));
- test_assert("gt_vec_range2", not(0xf > 1));
- (* NB missing range_vec version *)
-
- (* XXX missing implementations
- test_assert("gt_unsigned0", ( 1 >_u -1));
- test_assert("gt_unsigned1", not(-1 >_u -1));
- test_assert("gt_unsigned2", not(-1 >_u 1)); *)
-
- test_assert("gt_vec_unsigned0", not(0x1 >_u 0xf));
- test_assert("gt_vec_unsigned1", not(0xf >_u 0xf));
- test_assert("gt_vec_unsigned2", (0xf >_u 0x1));
-
- (* NB there is no gt_vec_range unsigned or signed *)
-
- (* XXX missing implementations
- test_assert("gt_signed0", ( 1 >_s -1));
- test_assert("gt_signed1", not(-1 >_s -1));
- test_assert("gt_signed2", not(-1 >_s 1)); *)
-
- test_assert("gt_vec_signed0", (0x1 >_s 0xf));
- test_assert("gt_vec_signed1", not(0xf >_s 0xf));
- test_assert("gt_vec_signed2", not(0xf >_s 0x1));
-}
-
diff --git a/src/test/lib/tests/test_gteq.sail b/src/test/lib/tests/test_gteq.sail
deleted file mode 100644
index 79d4d378..00000000
--- a/src/test/lib/tests/test_gteq.sail
+++ /dev/null
@@ -1,41 +0,0 @@
-function unit test() = {
- test_assert("gteq0", ( 1 >= -1));
- test_assert("gteq1", (-1 >= -1));
- test_assert("gteq2", not(-1 >= 1));
-
- (* XXX default is signed -- document this! *)
- test_assert("gteq_vec0", (0x1 >= 0xf));
- test_assert("gteq_vec1", (0xf >= 0xf));
- test_assert("gteq_vec2", not(0xf >= 0x1));
-
- (* XXX odd type error here -- sail seems to prefer gteq_vec...
- test_assert("gteq_vec_range0", (0x1 >= -1));
- test_assert("gteq_vec_range1", (0xf >= -1));
- test_assert("gteq_vec_range2", not(0xf >= 1));
-
- test_assert("gteq_range_vec0", ( 1 >= 0xf));
- test_assert("gteq_range_vec1", (-1 >= 0xf));
- test_assert("gteq_range_vec2", not(-1 >= 0x1));*)
-
- (* XXX missing implementations
- test_assert("gteq_unsigned0", ( 1 >=_u -1));
- test_assert("gteq_unsigned1", not(-1 >=_u -1));
- test_assert("gteq_unsigned2", not(-1 >=_u 1)); *)
-
- (* XXX missing
- test_assert("gteq_unsigned_vec0", not(0x1 >=_u 0xf));
- test_assert("gteq_unsigned_vec1", not(0xf >=_u 0xf));
- test_assert("gteq_unsigned_vec2", (0xf >=_u 0x1)); *)
-
- (* NB there is no gteq_vec_range unsigned or signed *)
-
- (* XXX missing implementations
- test_assert("gteq_signed0", ( 1 >=_s -1));
- test_assert("gteq_signed1", not(-1 >=_s -1));
- test_assert("gteq_signed2", not(-1 >=_s 1)); *)
-
- test_assert("gteq_vec_signed0", (0x1 >=_s 0xf));
- test_assert("gteq_vec_signed1", (0xf >=_s 0xf));
- test_assert("gteq_vec_signed2", not(0xf >=_s 0x1));
-}
-
diff --git a/src/test/lib/tests/test_leftshift.sail b/src/test/lib/tests/test_leftshift.sail
deleted file mode 100644
index 15c308bc..00000000
--- a/src/test/lib/tests/test_leftshift.sail
+++ /dev/null
@@ -1,11 +0,0 @@
-function unit test () = {
- test_assert ("leftshift_small0", (0x99 << 0) == 0x99);
- test_assert ("leftshift_small3", (0x99 << 3) == 0xc8);
- test_assert ("leftshift_small7", (0x99 << 7) == 0x80);
- test_assert ("leftshift_small8", (0x99 << 8) == 0x00);
- test_assert ("leftshift_big0", (0x99999999999999999 << 0) == 0x99999999999999999);
- test_assert ("leftshift_big3", (0x99999999999999999 << 3) == 0xcccccccccccccccc8);
- test_assert ("leftshift_big7", (0x99999999999999999 << 7) == 0xccccccccccccccc80);
- test_assert ("leftshift_big68", (0x99999999999999999 << 68) == 0x00000000000000000);
-}
-
diff --git a/src/test/lib/tests/test_lt.sail b/src/test/lib/tests/test_lt.sail
deleted file mode 100644
index 6ae7a3c3..00000000
--- a/src/test/lib/tests/test_lt.sail
+++ /dev/null
@@ -1,36 +0,0 @@
-function unit test() = {
- test_assert("lt0", not( 1 < -1));
- test_assert("lt1", not(-1 < -1));
- test_assert("lt2", (-1 < 1));
-
- (* XXX default is signed -- document this! *)
- test_assert("lt_vec0", not(0x1 < 0xf));
- test_assert("lt_vec1", not(0xf < 0xf));
- test_assert("lt_vec2", (0xf < 0x1));
-
- test_assert("lt_vec_range0", not(0x1 < -1));
- test_assert("lt_vec_range1", not(0xf < -1));
- test_assert("lt_vec_range2", (0xf < 1));
- (* NB missing range_vec version *)
-
- (* XXX missing implementations
- test_assert("lt_unsigned0", not( 1 <_u -1));
- test_assert("lt_unsigned1", not(-1 <_u -1));
- test_assert("lt_unsigned2", (-1 <_u 1)); *)
-
- test_assert("lt_vec_unsigned0", (0x1 <_u 0xf));
- test_assert("lt_vec_unsigned1", not(0xf <_u 0xf));
- test_assert("lt_vec_unsigned2", not(0xf <_u 0x1));
-
- (* NB there is no lt_vec_range unsigned or signed *)
-
- (* XXX missing implementations
- test_assert("lt_signed0", not( 1 <_s -1));
- test_assert("lt_signed1", not(-1 <_s -1));
- test_assert("lt_signed2", (-1 <_s 1)); *)
-
- test_assert("lt_vec_signed0", not(0x1 <_s 0xf));
- test_assert("lt_vec_signed1", not(0xf <_s 0xf));
- test_assert("lt_vec_signed2", (0xf <_s 0x1));
-}
-
diff --git a/src/test/lib/tests/test_lteq.sail b/src/test/lib/tests/test_lteq.sail
deleted file mode 100644
index 612023e9..00000000
--- a/src/test/lib/tests/test_lteq.sail
+++ /dev/null
@@ -1,40 +0,0 @@
-function unit test() = {
- test_assert("lteq0", not( 1 <= -1));
- test_assert("lteq1", (-1 <= -1));
- test_assert("lteq2", (-1 <= 1));
-
- (* XXX default is signed -- document this! *)
- test_assert("lteq_vec0", not(0x1 <= 0xf));
- test_assert("lteq_vec1", (0xf <= 0xf));
- test_assert("lteq_vec2", (0xf <= 0x1));
-
- test_assert("lteq_vec_range0", not(0x1 <= -1));
- test_assert("lteq_vec_range1", (0xf <= -1));
- test_assert("lteq_vec_range2", (0xf <= 1));
-
- test_assert("lteq_range_vec0", not( 1 <= 0xf));
- test_assert("lteq_range_vec1", (-1 <= 0xf));
- test_assert("lteq_range_vec2", (-1 <= 0x1));
-
- (* XXX missing implementations
- test_assert("lteq_unsigned0", not( 1 <=_u -1));
- test_assert("lteq_unsigned1", (-1 <=_u -1));
- test_assert("lteq_unsigned2", (-1 <=_u 1)); *)
-
- (* XXX missing type / parser
- test_assert("lteq_unsigned_vec0", (0x1 <=_u 0xf));
- test_assert("lteq_unsigned_vec1", (0xf <=_u 0xf));
- test_assert("lteq_unsigned_vec2", not(0xf <=_u 0x1));*)
-
- (* NB there is no lteq_vec_range unsigned or signed *)
-
- (* XXX missing implementations
- test_assert("lteq_signed0", not( 1 <=_s -1));
- test_assert("lteq_signed1", (-1 <=_s -1));
- test_assert("lteq_signed2", (-1 <=_s 1)); *)
-
- test_assert("lteq_vec_signed0", not(0x1 <=_s 0xf));
- test_assert("lteq_vec_signed1", (0xf <=_s 0xf));
- test_assert("lteq_vec_signed2", (0xf <=_s 0x1));
-}
-
diff --git a/src/test/lib/tests/test_minus.sail b/src/test/lib/tests/test_minus.sail
deleted file mode 100644
index 455f3954..00000000
--- a/src/test/lib/tests/test_minus.sail
+++ /dev/null
@@ -1,25 +0,0 @@
-function unit test() = {
- test_assert("minus", 1 - 1 == 0);
- test_assert("minus_vec", ((bit[4])(0x2 - 0x1)) == 0x1);
- test_assert("minus_vec_ov", ((bit[4])(0x1 - 0xf)) == 0x2);
- (* XXX minus_vec_vec_range not implemented
- test_assert("minus_vec_vec_range_pp", ((int)(0x1 - 0x1)) == 0);
- test_assert("minus_vec_vec_range_np", ((int)(0xa - 0x1)) == 9);
- test_assert("minus_vec_vec_range_pn", ((int)(0x3 - 0xe)) == 5);
- test_assert("minus_vec_vec_range_nn", ((int)(0x8 - 0x8)) == 0);*)
- test_assert("minus_vec_range", ((bit[4])(0xe - 1)) == 0xd);
- test_assert("minus_vec_range_range", ((int)(0xe - 1)) == 13);
- test_assert("minus_range_vec", ((bit[4])(1 - 0xe)) == 0x3);
- test_assert("minus_range_vec_range", ((int)(1 - 0xe)) == -13);
- (* returns (result, signed overflow, borrow in)*)
- test_assert ("minus_overflow_vec0", (((bit[4], bit, bit))(0x1 - 0x1)) == (0x0, false, false));
- test_assert ("minus_overflow_vec1", (((bit[4], bit, bit))(0x0 - 0x1)) == (0xf, true, true));
- test_assert ("minus_overflow_vec2", (((bit[4], bit, bit))(0x8 - 0x1)) == (0x7, false, false));
- test_assert ("minus_overflow_vec3", (((bit[4], bit, bit))(0x0 - 0x8)) == (0x8, true, true));
-
- test_assert ("minus_overflow_vec_bit0", (((bit[4], bit, bit))(0x1 - bitone)) == (0x0, false, false));
- test_assert ("minus_overflow_vec_bit1", (((bit[4], bit, bit))(0x0 - bitone)) == (0xf, true, true));
- test_assert ("minus_overflow_vec_bit2", (((bit[4], bit, bit))(0x8 - bitone)) == (0x7, false, false));
- test_assert ("minus_overflow_vec_bit3", (((bit[4], bit, bit))(0x8 - bitzero)) == (0x8, false, false)); (* XXX shallow embedding returns true, false... *)
-}
-
diff --git a/src/test/lib/tests/test_minus_signed.sail b/src/test/lib/tests/test_minus_signed.sail
deleted file mode 100644
index 7268f340..00000000
--- a/src/test/lib/tests/test_minus_signed.sail
+++ /dev/null
@@ -1,27 +0,0 @@
-function unit test() = {
- test_assert("minus_signed", 1 -_s 1 == 0);
- (* XXX minus_vec_signed not implemented
- test_assert("minus_vec_signed", ((bit[4])(0x2 -_s 0x1)) == 0x1);
- test_assert("minus_vec_ov_signed", ((bit[4])(0x1 -_s 0xf)) == 0x2); *)
- (* XXX minus_vec_vec_range_signed not implemented
- test_assert("minus_vec_vec_range_signed_pp", ((int)(0x1 -_s 0x1)) == 0);
- test_assert("minus_vec_vec_range_signed_np", ((int)(0xa -_s 0x1)) == 9);
- test_assert("minus_vec_vec_range_signed_pn", ((int)(0x3 -_s 0xe)) == 5);
- test_assert("minus_vec_vec_range_signed_nn", ((int)(0x8 -_s 0x8)) == 0);*)
- (* XXX not implemented
- test_assert("minus_vec_range_signed", ((bit[4])(0xe -_s 1)) == 0xd);
- test_assert("minus_vec_range_range_signed", ((int)(0xe -_s 1)) == -3);
- test_assert("minus_range_vec_signed", ((bit[4])(1 -_s 0xe)) == 0x3);
- test_assert("minus_range_vec_range_signed", ((int)(1 -_s 0xe)) == 3);*)
- (* returns (result, signed overflow, borrow in)*)
- test_assert ("minus_overflow_vec_signed0", (((bit[4], bit, bit))(0x1 -_s 0x1)) == (0x0, false, false));
- test_assert ("minus_overflow_vec_signed1", (((bit[4], bit, bit))(0x0 -_s 0x1)) == (0xf, true, true));
- test_assert ("minus_overflow_vec_signed2", (((bit[4], bit, bit))(0x8 -_s 0x1)) == (0x7, false, false));
- test_assert ("minus_overflow_vec_signed3", (((bit[4], bit, bit))(0x0 -_s 0x8)) == (0x8, true, true));
-
- test_assert ("minus_overflow_vec_bit_signed0", (((bit[4], bit, bit))(0x1 -_s bitone)) == (0x0, false, false));
- test_assert ("minus_overflow_vec_bit_signed1", (((bit[4], bit, bit))(0x0 -_s bitone)) == (0xf, true, true));
- test_assert ("minus_overflow_vec_bit_signed2", (((bit[4], bit, bit))(0x8 -_s bitone)) == (0x7, false, false));
- test_assert ("minus_overflow_vec_bit_signed3", (((bit[4], bit, bit))(0x8 -_s bitzero)) == (0x8, false, false));
-}
-
diff --git a/src/test/lib/tests/test_misc.sail b/src/test/lib/tests/test_misc.sail
deleted file mode 100644
index 5b4b6fd4..00000000
--- a/src/test/lib/tests/test_misc.sail
+++ /dev/null
@@ -1,19 +0,0 @@
-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);
-}
-
diff --git a/src/test/lib/tests/test_mod.sail b/src/test/lib/tests/test_mod.sail
deleted file mode 100644
index 7f078bae..00000000
--- a/src/test/lib/tests/test_mod.sail
+++ /dev/null
@@ -1,23 +0,0 @@
-function unit test () = {
- test_assert ("modpospos_exact", (21 mod 7) == 0);
- test_assert ("modposneg_exact", (21 mod -7) == 0);
- test_assert ("modnegpos_exact", (-21 mod 7) == 0);
- test_assert ("modnegneg_exact", (-21 mod -7) == 0);
-
- test_assert ("modpospos_approx", (21 mod 8) == 5);
- test_assert ("modposneg_approx", (21 mod -8) == 5);
- test_assert ("modnegpos_approx", (-21 mod 8) == -5);
- test_assert ("modnegneg_approx", (-21 mod -8) == -5);
-
- (* XXX how to test this? Type checker should catch?
- test_assert ("mod_zero", (21 mod 0) == undefined); *)
-
- test_assert("mod_vec_range_pos", (0x7 mod 5) == 2);
- test_assert("mod_vec_range_neg", (0xf mod 5) == 0);
-
- test_assert("mod_vec_pos", (0x7 mod 0x5) == 0x2);
- test_assert("mod_vec_neg", (0xf mod 0x5) == 0x0);
- test_assert("mod_vec_pos_neg", (0x7 mod 0x8) == 0x7);
- test_assert("mod_vec_neg_neg", (0xf mod 0x8) == 0x7);
-}
-
diff --git a/src/test/lib/tests/test_mod_signed.sail b/src/test/lib/tests/test_mod_signed.sail
deleted file mode 100644
index 61acec17..00000000
--- a/src/test/lib/tests/test_mod_signed.sail
+++ /dev/null
@@ -1,26 +0,0 @@
-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);
- *)
-}
-
diff --git a/src/test/lib/tests/test_multiply.sail b/src/test/lib/tests/test_multiply.sail
deleted file mode 100644
index 03adfa27..00000000
--- a/src/test/lib/tests/test_multiply.sail
+++ /dev/null
@@ -1,21 +0,0 @@
-function unit test () = {
- test_assert ("multiply", 6 * 9 == 54);
- test_assert ("multiply_vec", ((bit[8])(0x6 * 0xb)) == 0x42);
- test_assert ("mult_range_vec", ((bit[8])(6 * 0xb)) == 0x42);
- test_assert ("mult_vec_range", ((bit[8])(0x6 * 11)) == 0x42);
- (* XXX mult_oveflow_vec missing *)
-
- (* XXX not implmented
- test_assert ("multiply_signed", 6 *_s 9 == 54); *)
- test_assert ("multiply_vec_signed", ((bit[8])(0x6 *_s 0xb)) == 0xe2);
- test_assert ("mult_range_vec_signed", ((bit[8])(6 *_s 0xb)) == 0xe2);
- test_assert ("mult_vec_range_signed", ((bit[8])(0x6 *_s 11)) == 0xe2);
-
- (* XXX don't think it's possible to set carryout out bit *)
- test_assert ("mult_overflow_vec_signed0", (((bit[8], bit, bit)) (0xf *_s 0x2)) == (0xfe, false, false));
- test_assert ("mult_overflow_vec_signed1", (((bit[8], bit, bit)) (0xf *_s 0xf)) == (0x01, false, false));
- test_assert ("mult_overflow_vec_signed2", (((bit[8], bit, bit)) (0x8 *_s 0x8)) == (0x40, true, false));
- test_assert ("mult_overflow_vec_signed3", (((bit[8], bit, bit)) (0x7 *_s 0x7)) == (0x31, true, false));
- test_assert ("mult_overflow_vec_signed4", (((bit[8], bit, bit)) (0x8 *_s 0x7)) == (0xc8, true, false));
-}
-
diff --git a/src/test/lib/tests/test_neq.sail b/src/test/lib/tests/test_neq.sail
deleted file mode 100644
index e3ad50cf..00000000
--- a/src/test/lib/tests/test_neq.sail
+++ /dev/null
@@ -1,20 +0,0 @@
-function unit test () = {
- test_assert("neq_bit00", not(false != bitzero));
- test_assert("neq_bit01", false != bitone);
- test_assert("neq_bit10", true != bitzero);
- test_assert("neq_bit11", not(true != bitone));
-
- test_assert("neq_vec0", 0x1 != 0x2);
- test_assert("neq_vec1", not(0x2 != 0x2));
- test_assert("neq_vec_range0", 0xf != 16);
- test_assert("neq_vec_range0", 0x7 != 8);
- test_assert("neq_vec_range1", not(0xf != 15));
- (* XXX not implemented for ocaml
- test_assert("neq_range_vec0", 16 != 0xf);
- test_assert("neq_range_vec1", not(15 != 0xf)); *)
- test_assert("neq_range0", 12 != 13);
- test_assert("neq_range1", not(13 != 13));
- test_assert("neq_tup0", (true, false) != (bitzero, bitzero));
- test_assert("neq_tup1", not((true, false) != (bitone, bitzero)));
-}
-
diff --git a/src/test/lib/tests/test_not.sail b/src/test/lib/tests/test_not.sail
deleted file mode 100644
index 8ae2514f..00000000
--- a/src/test/lib/tests/test_not.sail
+++ /dev/null
@@ -1,8 +0,0 @@
-function unit test () = {
- test_assert ("not_bit0", (not (bitzero)) == bitone);
- test_assert ("not_bit1", (not (bitone)) == bitzero);
-
- test_assert ("bitwise_not", (~ (0b01) == 0b10));
- test_assert ("bitwise_not_bit0", ((~ (bitzero)) == bitone));
- test_assert ("bitwise_not_bit1", ((~ (bitone)) == bitzero));
-}
diff --git a/src/test/lib/tests/test_oddments.sail b/src/test/lib/tests/test_oddments.sail
deleted file mode 100644
index 4c8fd086..00000000
--- a/src/test/lib/tests/test_oddments.sail
+++ /dev/null
@@ -1,14 +0,0 @@
-function unit test () = {
- (* XXX this is weird, wrong type?
- test_assert("is_one0", not(is_one(bitzero)));
- test_assert("is_one1", is_one(bitone)); *)
-
- test_assert("signed-1", signed(0xf) == -1);
- test_assert("signed0", signed(0x0) == 0);
- test_assert("signed1", signed(0x1) == 1);
-
- test_assert("unsigned-1", unsigned(0xf) == 15);
- test_assert("unsigned0", unsigned(0x0) == 0);
- test_assert("unsigned1", unsigned(0x1) == 1);
-}
-
diff --git a/src/test/lib/tests/test_or.sail b/src/test/lib/tests/test_or.sail
deleted file mode 100644
index c48caedc..00000000
--- a/src/test/lib/tests/test_or.sail
+++ /dev/null
@@ -1,7 +0,0 @@
-function unit test () = {
- test_assert ("bitwise_or", (0b0101 | 0b0011) == 0b0111);
- test_assert ("bitwise_or_00", (bitzero | bitzero) == bitzero);
- test_assert ("bitwise_or_01", (bitzero | bitone) == bitone);
- test_assert ("bitwise_or_10", (bitone | bitzero) == bitone);
- test_assert ("bitwise_or_11", (bitone | bitone) == bitone);
-}
diff --git a/src/test/lib/tests/test_quot_signed.sail b/src/test/lib/tests/test_quot_signed.sail
deleted file mode 100644
index 39259204..00000000
--- a/src/test/lib/tests/test_quot_signed.sail
+++ /dev/null
@@ -1,18 +0,0 @@
-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);
- };*)
-}
diff --git a/src/test/lib/tests/test_rightshift.sail b/src/test/lib/tests/test_rightshift.sail
deleted file mode 100644
index 7879a33e..00000000
--- a/src/test/lib/tests/test_rightshift.sail
+++ /dev/null
@@ -1,10 +0,0 @@
-function unit test () = {
- test_assert ("rightshift_small0", (0x99 >> 0) == 0x99);
- test_assert ("rightshift_small3", (0x99 >> 3) == 0x13);
- test_assert ("rightshift_small7", (0x99 >> 7) == 0x01);
- test_assert ("rightshift_small8", (0x99 >> 8) == 0x00); (* XXX fails on interp *)
- test_assert ("rightshift_big0", (0x99999999999999999 >> 0) == 0x99999999999999999);
- test_assert ("rightshift_big3", (0x99999999999999999 >> 3) == 0x13333333333333333);
- test_assert ("rightshift_big7", (0x99999999999999999 >> 7) == 0x01333333333333333);
- test_assert ("rightshift_big68", (0x99999999999999999 >> 68) == 0x00000000000000000); (* XXX fails on interp *)
-}
diff --git a/src/test/lib/tests/test_rotate.sail b/src/test/lib/tests/test_rotate.sail
deleted file mode 100644
index f0f8e45c..00000000
--- a/src/test/lib/tests/test_rotate.sail
+++ /dev/null
@@ -1,7 +0,0 @@
-function unit test () = {
- test_assert ("rotate0", (0x99 <<< 0) == 0x99); (* XXX fails on interp *)
- test_assert ("rotate3", (0x99 <<< 3) == 0xcc);
- test_assert ("rotate7", (0x99 <<< 7) == 0xcc);
- test_assert ("rotate8", (0x99 <<< 8) == 0x99);
-}
-
diff --git a/src/test/lib/tests/test_xor.sail b/src/test/lib/tests/test_xor.sail
deleted file mode 100644
index 125b2f10..00000000
--- a/src/test/lib/tests/test_xor.sail
+++ /dev/null
@@ -1,7 +0,0 @@
-function unit test () = {
- test_assert ("bitwise_xor", (0b0101 ^ 0b0011) == 0b0110);
- test_assert ("bitwise_xor_00", (bitzero ^ bitzero) == bitzero);
- test_assert ("bitwise_xor_01", (bitzero ^ bitone) == bitone);
- test_assert ("bitwise_xor_10", (bitone ^ bitzero) == bitone);
- test_assert ("bitwise_xor_11", (bitone ^ bitone) == bitzero);
-}