summaryrefslogtreecommitdiff
path: root/test/c
diff options
context:
space:
mode:
authorAlasdair Armstrong2020-02-20 16:03:03 +0000
committerAlasdair Armstrong2020-02-20 16:04:05 +0000
commit742eee392609a01b8565f4e64806ba0a14997844 (patch)
tree4b5a7f527e89c8dc6901dedf4138708c129030a5 /test/c
parent4284ce73ea121b6643cb72823136c4c60518f7ec (diff)
Fix missing code generation builtins for lists. Fixes #59
Also uncovered a few other issues w.r.t lists
Diffstat (limited to 'test/c')
-rw-r--r--test/c/warl.expect1
-rw-r--r--test/c/warl.sail31
2 files changed, 32 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")
+}