summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 22:42:52 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:51 +0200
commitd2b62ebf3f225d543c40d2ef566c9a1af5003615 (patch)
tree68561d894d15579a896264dabee346159ce0dcda /tests
parent48b989b4e4f87919eb702f0686f56a5a198568d3 (diff)
Use do_run_from_file() for test_erf
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_erf.in15
-rw-r--r--tests/core/test_erf.out1
-rw-r--r--tests/test_core.py20
3 files changed, 20 insertions, 16 deletions
diff --git a/tests/core/test_erf.in b/tests/core/test_erf.in
new file mode 100644
index 00000000..70658ea5
--- /dev/null
+++ b/tests/core/test_erf.in
@@ -0,0 +1,15 @@
+
+ #include <math.h>
+ #include <stdio.h>
+ int main()
+ {
+ printf("%1.6f, %1.6f, %1.6f, %1.6f, %1.6f, %1.6f\n",
+ erf(1.0),
+ erf(3.0),
+ erf(-1.0),
+ erfc(1.0),
+ erfc(3.0),
+ erfc(-1.5));
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_erf.out b/tests/core/test_erf.out
new file mode 100644
index 00000000..3b48202f
--- /dev/null
+++ b/tests/core/test_erf.out
@@ -0,0 +1 @@
+0.842701, 0.999978, -0.842701, 0.157299, 0.000022, 1.966105 \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 0abf38b1..5d827234 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -808,22 +808,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_erf(self):
- src = '''
- #include <math.h>
- #include <stdio.h>
- int main()
- {
- printf("%1.6f, %1.6f, %1.6f, %1.6f, %1.6f, %1.6f\\n",
- erf(1.0),
- erf(3.0),
- erf(-1.0),
- erfc(1.0),
- erfc(3.0),
- erfc(-1.5));
- return 0;
- }
- '''
- self.do_run(src, '0.842701, 0.999978, -0.842701, 0.157299, 0.000022, 1.966105')
+ test_path = path_from_root('tests', 'core', 'test_erf')
+ src, output = (test_path + s for s in ('.in', '.out'))
+
+ self.do_run_from_file(src, output)
def test_math_hyperbolic(self):
src = open(path_from_root('tests', 'hyperbolic', 'src.c'), 'r').read()