aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:55:56 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:00 +0200
commitbd0e4075eaa1dab1894947e2fa6650c723ee2911 (patch)
tree14588748cd943575130680ce5228113449721a7f
parent0411512023fa05dee8bb16bd23be6e7b303d2557 (diff)
Use do_run_from_file() for test_sscanf_float
-rw-r--r--tests/core/test_sscanf_float.in9
-rw-r--r--tests/core/test_sscanf_float.out2
-rw-r--r--tests/test_core.py12
3 files changed, 14 insertions, 9 deletions
diff --git a/tests/core/test_sscanf_float.in b/tests/core/test_sscanf_float.in
new file mode 100644
index 00000000..e87d839a
--- /dev/null
+++ b/tests/core/test_sscanf_float.in
@@ -0,0 +1,9 @@
+
+ #include "stdio.h"
+
+ int main(){
+ float f1, f2, f3, f4, f5, f6, f7, f8, f9;
+ sscanf("0.512 0.250x5.129_-9.98 1.12*+54.32E3 +54.32E3^87.5E-3 87.5E-3$", "%f %fx%f_%f %f*%f %f^%f %f$", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9);
+ printf("\n%f, %f, %f, %f, %f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9);
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_sscanf_float.out b/tests/core/test_sscanf_float.out
new file mode 100644
index 00000000..ea5a276d
--- /dev/null
+++ b/tests/core/test_sscanf_float.out
@@ -0,0 +1,2 @@
+
+0.512000, 0.250000, 5.129000, -9.980000, 1.120000, 54320.000000, 54320.000000, 0.087500, 0.087500
diff --git a/tests/test_core.py b/tests/test_core.py
index c4fef6eb..b0a676d0 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3765,16 +3765,10 @@ Pass: 0.000012 0.000012''')
self.do_run_from_file(src, output)
def test_sscanf_float(self):
- src = r'''
- #include "stdio.h"
+ test_path = path_from_root('tests', 'core', 'test_sscanf_float')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main(){
- float f1, f2, f3, f4, f5, f6, f7, f8, f9;
- sscanf("0.512 0.250x5.129_-9.98 1.12*+54.32E3 +54.32E3^87.5E-3 87.5E-3$", "%f %fx%f_%f %f*%f %f^%f %f$", &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9);
- printf("\n%f, %f, %f, %f, %f, %f, %f, %f, %f\n", f1, f2, f3, f4, f5, f6, f7, f8, f9);
- }
- '''
- self.do_run(src, '\n0.512000, 0.250000, 5.129000, -9.980000, 1.120000, 54320.000000, 54320.000000, 0.087500, 0.087500\n')
+ self.do_run_from_file(src, output)
def test_langinfo(self):
src = open(path_from_root('tests', 'langinfo', 'test.c'), 'r').read()