diff options
Diffstat (limited to 'test/c')
| -rw-r--r-- | test/c/warl.expect | 1 | ||||
| -rw-r--r-- | test/c/warl.sail | 31 | ||||
| -rw-r--r-- | test/c/warl_undef.expect | 1 | ||||
| -rw-r--r-- | test/c/warl_undef.sail | 29 |
4 files changed, 62 insertions, 0 deletions
diff --git a/test/c/warl.expect b/test/c/warl.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/warl.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/warl.sail b/test/c/warl.sail new file mode 100644 index 00000000..cc5337b5 --- /dev/null +++ b/test/c/warl.sail @@ -0,0 +1,31 @@ +default Order dec + +$include <prelude.sail> + +val "eq_anything" : forall ('a: Type). ('a, 'a) -> bool + +overload operator == = {eq_anything} + +function neq_anything forall ('a: Type). (x: 'a, y: 'a) -> bool = + not_bool(x == y) + +overload operator != = {neq_anything} + +val "print_endline" : string -> unit + +struct WARL_range = { + rangelist : list(int), +} + +let x : WARL_range = struct { + rangelist = [|0, 1|] +} + +function main () : unit -> unit = { + let y = x; + assert(x == y); + assert(x == x); + let z = y; + assert(z.rangelist != [||]); + print_endline("ok") +} diff --git a/test/c/warl_undef.expect b/test/c/warl_undef.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/warl_undef.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/warl_undef.sail b/test/c/warl_undef.sail new file mode 100644 index 00000000..4828afc8 --- /dev/null +++ b/test/c/warl_undef.sail @@ -0,0 +1,29 @@ +default Order dec + +$option -undefined_gen + +$include <prelude.sail> + +val "eq_anything" : forall ('a: Type). ('a, 'a) -> bool + +overload operator == = {eq_anything} + +function neq_anything forall ('a: Type). (x: 'a, y: 'a) -> bool = + not_bool(x == y) + +overload operator != = {neq_anything} + +val "print_endline" : string -> unit + +struct WARL_range = { + rangelist : list(int), +} + +let x : WARL_range = struct { + rangelist = [|0, 1|] +} + +function main () : unit -> unit = { + let z: WARL_range = undefined; + print_endline("ok") +} |
