aboutsummaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 22:48:09 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:51 +0200
commitc9bf465d5a56efd7a14cd8ad01acccca77527aad (patch)
tree1b98cb458436903a05dc21bf4deae8116505804e /tests/core
parent63678388a4028a93c7bdd0ac45263faf509ce955 (diff)
Use do_run_from_file() for test_rounding
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/test_rounding.in29
-rw-r--r--tests/core/test_rounding.out1
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/core/test_rounding.in b/tests/core/test_rounding.in
new file mode 100644
index 00000000..63960ac4
--- /dev/null
+++ b/tests/core/test_rounding.in
@@ -0,0 +1,29 @@
+
+ #include <stdio.h>
+ #include <math.h>
+
+ int main()
+ {
+ printf("%.1f ", round(1.4));
+ printf("%.1f ", round(1.6));
+ printf("%.1f ", round(-1.4));
+ printf("%.1f ", round(-1.6));
+
+ printf("%.1f ", round(1.5));
+ printf("%.1f ", round(2.5));
+ printf("%.1f ", round(-1.5));
+ printf("%.1f ", round(-2.5));
+
+ printf("%ld ", lrint(1.4));
+ printf("%ld ", lrint(1.6));
+ printf("%ld ", lrint(-1.4));
+ printf("%ld ", lrint(-1.6));
+
+ printf("%ld ", lrint(1.5));
+ printf("%ld ", lrint(2.5));
+ printf("%ld ", lrint(-1.5));
+ printf("%ld ", lrint(-2.5));
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_rounding.out b/tests/core/test_rounding.out
new file mode 100644
index 00000000..b826ceab
--- /dev/null
+++ b/tests/core/test_rounding.out
@@ -0,0 +1 @@
+1.0 2.0 -1.0 -2.0 2.0 3.0 -2.0 -3.0 1 2 -1 -2 2 2 -2 -2 \ No newline at end of file