summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-06-27 19:23:41 +0100
committerAlasdair Armstrong2018-06-27 19:24:17 +0100
commit84e5c99514eddd1c8ea962dcf3e787bc5bc91101 (patch)
treea004792ea73b611d801834ba79d974ab10e08cfe /test
parentf3f31252202ea745970e99805574eac39d1d9b7b (diff)
Fix reading reals from strings in C lib
Diffstat (limited to 'test')
-rw-r--r--test/c/real.expect12
-rw-r--r--test/c/real.sail22
2 files changed, 34 insertions, 0 deletions
diff --git a/test/c/real.expect b/test/c/real.expect
new file mode 100644
index 00000000..81587184
--- /dev/null
+++ b/test/c/real.expect
@@ -0,0 +1,12 @@
+1: 16
+1: 16
+1: 16
+1: 4
+1: 4
+1: 4
+2: 17
+2: 17
+2: 17
+2: 8340353015645794683299462704812268882126086134656108363777/2022832731673317417391502561215986991699553462632778473728
+2: 4
+2: 5
diff --git a/test/c/real.sail b/test/c/real.sail
new file mode 100644
index 00000000..32e58af6
--- /dev/null
+++ b/test/c/real.sail
@@ -0,0 +1,22 @@
+
+$include <arith.sail>
+$include <real.sail>
+
+val main : unit -> unit
+
+function main() = {
+ let x : real = 16.0;
+ print_real("1: ", x);
+ print_int("1: ", floor(x));
+ print_int("1: ", ceil(x));
+ print_real("1: ", sqrt(x));
+ print_int("1: ", floor(sqrt(x)));
+ print_int("1: ", ceil(sqrt(x)));
+ let x : real = 17.0;
+ print_real("2: ", x);
+ print_int("2: ", floor(x));
+ print_int("2: ", ceil(x));
+ print_real("2: ", sqrt(x));
+ print_int("2: ", floor(sqrt(x)));
+ print_int("2: ", ceil(sqrt(x)));
+} \ No newline at end of file