summaryrefslogtreecommitdiff
path: root/test/c
diff options
context:
space:
mode:
authorjp2020-02-23 17:45:35 +0000
committerjp2020-02-23 17:45:35 +0000
commite37855c0c43b8369aefa91cfd17889452011b137 (patch)
treea62a9300112abd81830b1650a7d2d29421f62540 /test/c
parent219f8ef5aec4d6a4f918693bccc9dc548716ea41 (diff)
parentdd32e257ddecdeece792b508cc05c9acab153e70 (diff)
Merge branch 'sail2' of https://github.com/rems-project/sail into sail2
Diffstat (limited to 'test/c')
-rw-r--r--test/c/warl.expect1
-rw-r--r--test/c/warl.sail31
-rw-r--r--test/c/warl_undef.expect1
-rw-r--r--test/c/warl_undef.sail29
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")
+}