aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:02:04 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:59 +0200
commit71abd62af718a75477e0fb3feb954278d811a044 (patch)
tree617af14af536ce0df56a40e6509ec5e97cd9becf
parentd952588f9f15e7c461d6ddac8d229cd80c06d93b (diff)
Use do_run_from_file() for test_printf_2
-rw-r--r--tests/core/test_printf_2.in17
-rw-r--r--tests/core/test_printf_2.out2
-rw-r--r--tests/test_core.py20
3 files changed, 22 insertions, 17 deletions
diff --git a/tests/core/test_printf_2.in b/tests/core/test_printf_2.in
new file mode 100644
index 00000000..ef94aec1
--- /dev/null
+++ b/tests/core/test_printf_2.in
@@ -0,0 +1,17 @@
+
+ #include <stdio.h>
+
+ int main() {
+ char c = '1';
+ short s = 2;
+ int i = 3;
+ long long l = 4;
+ float f = 5.5;
+ double d = 6.6;
+
+ printf("%c,%hd,%d,%lld,%.1f,%.1llf\n", c, s, i, l, f, d);
+ printf("%#x,%#x\n", 1, 0);
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_printf_2.out b/tests/core/test_printf_2.out
new file mode 100644
index 00000000..002cd93a
--- /dev/null
+++ b/tests/core/test_printf_2.out
@@ -0,0 +1,2 @@
+1,2,3,4,5.5,6.6
+0x1,0
diff --git a/tests/test_core.py b/tests/test_core.py
index 5b3a64dd..cdee3c76 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3588,24 +3588,10 @@ ok
self.do_run(src, expected)
def test_printf_2(self):
- src = r'''
- #include <stdio.h>
-
- int main() {
- char c = '1';
- short s = 2;
- int i = 3;
- long long l = 4;
- float f = 5.5;
- double d = 6.6;
-
- printf("%c,%hd,%d,%lld,%.1f,%.1llf\n", c, s, i, l, f, d);
- printf("%#x,%#x\n", 1, 0);
+ test_path = path_from_root('tests', 'core', 'test_printf_2')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- self.do_run(src, '1,2,3,4,5.5,6.6\n0x1,0\n')
+ self.do_run_from_file(src, output)
def test_vprintf(self):
src = r'''