diff options
Diffstat (limited to 'test/c')
| -rw-r--r-- | test/c/bitvector_update.expect | 1 | ||||
| -rw-r--r-- | test/c/bitvector_update.sail | 13 | ||||
| -rw-r--r-- | test/c/bitvector_update2.expect | 1 | ||||
| -rw-r--r-- | test/c/bitvector_update2.sail | 14 | ||||
| -rw-r--r-- | test/c/nested_fields.expect | 1 | ||||
| -rw-r--r-- | test/c/nested_fields.sail | 20 | ||||
| -rw-r--r-- | test/c/scattered_mapping.expect | 1 | ||||
| -rw-r--r-- | test/c/scattered_mapping.sail | 17 | ||||
| -rw-r--r-- | test/c/undefined_union.expect | 1 | ||||
| -rw-r--r-- | test/c/undefined_union.sail | 11 |
10 files changed, 80 insertions, 0 deletions
diff --git a/test/c/bitvector_update.expect b/test/c/bitvector_update.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/bitvector_update.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/bitvector_update.sail b/test/c/bitvector_update.sail new file mode 100644 index 00000000..6f506e23 --- /dev/null +++ b/test/c/bitvector_update.sail @@ -0,0 +1,13 @@ +default Order dec +$include <prelude.sail> + +val "print_endline" : string -> unit + +function main() -> unit = { + let x = bitzero; + let y = bitone; + let z = bitzero; + let bv = [x, y, z]; + assert(bv == 0b010); + print_endline("ok") +}
\ No newline at end of file diff --git a/test/c/bitvector_update2.expect b/test/c/bitvector_update2.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/bitvector_update2.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/bitvector_update2.sail b/test/c/bitvector_update2.sail new file mode 100644 index 00000000..8e5e9918 --- /dev/null +++ b/test/c/bitvector_update2.sail @@ -0,0 +1,14 @@ +default Order dec +$include <prelude.sail> + +val "print_endline" : string -> unit + +function main() -> unit = { + var bv = 0b101; + let x = bitzero; + let y = bitone; + let z = bitzero; + bv = [x, y, z]; + assert(bv == 0b010); + print_endline("ok") +} diff --git a/test/c/nested_fields.expect b/test/c/nested_fields.expect new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/test/c/nested_fields.expect @@ -0,0 +1 @@ +2 diff --git a/test/c/nested_fields.sail b/test/c/nested_fields.sail new file mode 100644 index 00000000..1e26dac9 --- /dev/null +++ b/test/c/nested_fields.sail @@ -0,0 +1,20 @@ +default Order dec + +$include <prelude.sail> + +struct B = { + f3: int, + f4: int, +} + +struct A = { + f1: B, + f2: int, +} + +register R : A + +function main() -> unit = { + R.f1.f3 = 2; + print_int("", R.f1.f3) +}
\ No newline at end of file diff --git a/test/c/scattered_mapping.expect b/test/c/scattered_mapping.expect new file mode 100644 index 00000000..6a452c18 --- /dev/null +++ b/test/c/scattered_mapping.expect @@ -0,0 +1 @@ +() diff --git a/test/c/scattered_mapping.sail b/test/c/scattered_mapping.sail new file mode 100644 index 00000000..4f523e45 --- /dev/null +++ b/test/c/scattered_mapping.sail @@ -0,0 +1,17 @@ +default Order dec + +$include <prelude.sail> +$include <string.sail> +$include <mapping.sail> + +val "print_endline" : string -> unit + +val unit_str_map : unit <-> string +scattered mapping unit_str_map +val unit_str : unit -> string +function unit_str () = unit_str_map_forwards(()) +mapping clause unit_str_map = () <-> "()" + +function main () : unit -> unit = { + print_endline(unit_str()) +} diff --git a/test/c/undefined_union.expect b/test/c/undefined_union.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/undefined_union.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/undefined_union.sail b/test/c/undefined_union.sail new file mode 100644 index 00000000..9b652b34 --- /dev/null +++ b/test/c/undefined_union.sail @@ -0,0 +1,11 @@ + +union Test = { + Ctor1 : int, + Ctor2 : (int, int) +} + +val "print_endline" : string -> unit + +function main() -> unit = { + print_endline("ok") +} |
