summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 22:32:24 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:51 +0200
commit333d6d12f4c5b10c31164a45786aca79c5931354 (patch)
treee04560d03ad93d4863ffb605980835e805c9176a /tests
parentdbc6b41b79db2907f5b5e496e9d3c32c7d811453 (diff)
Use do_run_from_file() for test_zero_multiplication
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_zero_multiplication.in14
-rw-r--r--tests/core/test_zero_multiplication.out1
-rw-r--r--tests/test_core.py19
3 files changed, 19 insertions, 15 deletions
diff --git a/tests/core/test_zero_multiplication.in b/tests/core/test_zero_multiplication.in
new file mode 100644
index 00000000..2be87594
--- /dev/null
+++ b/tests/core/test_zero_multiplication.in
@@ -0,0 +1,14 @@
+
+ #include <stdio.h>
+ int main(int argc, char * argv[]) {
+ int one = argc;
+
+ printf("%d ", 0 * one);
+ printf("%d ", 0 * -one);
+ printf("%d ", -one * 0);
+ printf("%g ", 0.0 * one);
+ printf("%g ", 0.0 * -one);
+ printf("%g", -one * 0.0);
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_zero_multiplication.out b/tests/core/test_zero_multiplication.out
new file mode 100644
index 00000000..bb69c671
--- /dev/null
+++ b/tests/core/test_zero_multiplication.out
@@ -0,0 +1 @@
+0 0 0 0 -0 -0 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index d8d2cbd7..19e9e188 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -782,21 +782,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_zero_multiplication(self):
- src = '''
- #include <stdio.h>
- int main(int argc, char * argv[]) {
- int one = argc;
-
- printf("%d ", 0 * one);
- printf("%d ", 0 * -one);
- printf("%d ", -one * 0);
- printf("%g ", 0.0 * one);
- printf("%g ", 0.0 * -one);
- printf("%g", -one * 0.0);
- return 0;
- }
- '''
- self.do_run(src, '0 0 0 0 -0 -0')
+ test_path = path_from_root('tests', 'core', 'test_zero_multiplication')
+ src, output = (test_path + s for s in ('.in', '.out'))
+
+ self.do_run_from_file(src, output)
def test_isnan(self):
src = r'''