summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Bauereiss2019-06-18 14:39:21 +0100
committerThomas Bauereiss2019-06-18 14:39:21 +0100
commit65a8bd3e771f5c062c96dbc940b024ec513aeeca (patch)
treed797d547b5b99fe94f877702f087fd0796d50b98 /test
parent7f4a1bd529fc120ad86a28d05571903805d92c9e (diff)
Implement count_leading_zeros in Lem
Diffstat (limited to 'test')
-rw-r--r--test/builtins/count_leading_zeros.sail11
-rwxr-xr-xtest/builtins/run_tests.py1
2 files changed, 12 insertions, 0 deletions
diff --git a/test/builtins/count_leading_zeros.sail b/test/builtins/count_leading_zeros.sail
new file mode 100644
index 00000000..6d6d0901
--- /dev/null
+++ b/test/builtins/count_leading_zeros.sail
@@ -0,0 +1,11 @@
+default Order dec
+
+$include <vector_dec.sail>
+
+val main : unit -> unit effect {escape}
+
+function main () = {
+ foreach (i from 0 to 32 by 1 in inc) {
+ assert(count_leading_zeros(sail_shiftright(0xDEADBEEF, i)) == i);
+ }
+}
diff --git a/test/builtins/run_tests.py b/test/builtins/run_tests.py
index ba13d5b9..a677ccfe 100755
--- a/test/builtins/run_tests.py
+++ b/test/builtins/run_tests.py
@@ -68,6 +68,7 @@ def test_lem_builtins(name):
step('mkdir -p _lbuild_{}'.format(basename))
step('mv {}.lem _lbuild_{}'.format(basename, basename))
step('mv {}_types.lem _lbuild_{}'.format(basename, basename))
+ step('cp $SAIL_DIR/src/lem_interp/sail2_instr_kinds.lem _lbuild_{}'.format(basename))
step('cp myocamlbuild.ml _lbuild_{}'.format(basename))
os.chdir('_lbuild_{}'.format(basename))
step('ln -s $SAIL_DIR/src/gen_lib/ gen_lib')