summaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 21:48:42 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:50 +0200
commit535b51e4e6f1f6c4fac05828ecde8f4444a01c51 (patch)
tree81c0ca9e5b7041b7b62e885bea498104444391ee /tests/core
parent3dcf74e687a4cf376d7cfdc6452a745b47687c4d (diff)
Use do_run_from_file() for test_floatvars
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/test_floatvars.in29
-rw-r--r--tests/core/test_floatvars.out3
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/core/test_floatvars.in b/tests/core/test_floatvars.in
new file mode 100644
index 00000000..f63da19c
--- /dev/null
+++ b/tests/core/test_floatvars.in
@@ -0,0 +1,29 @@
+
+ #include <stdio.h>
+
+ // headers test, see issue #1013
+ #include<cfloat>
+ #include<cmath>
+
+ int main(int argc, char **argv)
+ {
+ float x = 1.234, y = 3.5, q = 0.00000001;
+ y *= 3;
+ int z = x < y;
+ printf("*%d,%d,%.1f,%d,%.4f,%.2f*\n", z, int(y), y, (int)x, x, q);
+
+ printf("%.2f, %.2f, %.2f, %.2f\n", fmin(0.5, 3.3), fmin(NAN, 3.3), fmax(0.5, 3.3), fmax(NAN, 3.3));
+
+ printf("small: %.10f\n", argc * 0.000001);
+
+ /*
+ // Rounding behavior
+ float fs[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
+ double ds[6] = { -2.75, -2.50, -2.25, 2.25, 2.50, 2.75 };
+ for (int i = 0; i < 6; i++)
+ printf("*int(%.2f)=%d,%d*\n", fs[i], int(fs[i]), int(ds[i]));
+ */
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_floatvars.out b/tests/core/test_floatvars.out
new file mode 100644
index 00000000..57635092
--- /dev/null
+++ b/tests/core/test_floatvars.out
@@ -0,0 +1,3 @@
+*1,10,10.5,1,1.2340,0.00*
+0.50, 3.30, 3.30, 3.30
+small: 0.0000010000