summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 11:54:31 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:54 +0200
commitc704860e22fe37c0e0ae1502d12cb1abbe7992bf (patch)
tree50b4b00648fe2c3662dbc22ced777525ed90f514 /tests
parent2be08eb3a196ad79e66309d0632a659ea052cf17 (diff)
Use do_run_from_file() for test_funcptrfunc
Diffstat (limited to 'tests')
-rw-r--r--tests/core/test_funcptrfunc.in17
-rw-r--r--tests/core/test_funcptrfunc.out1
-rw-r--r--tests/test_core.py20
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_funcptrfunc.in b/tests/core/test_funcptrfunc.in
new file mode 100644
index 00000000..6c146421
--- /dev/null
+++ b/tests/core/test_funcptrfunc.in
@@ -0,0 +1,17 @@
+
+ #include <stdio.h>
+
+ typedef void (*funcptr)(int, int);
+ typedef funcptr (*funcptrfunc)(int);
+
+ funcptr __attribute__ ((noinline)) getIt(int x) {
+ return (funcptr)x;
+ }
+
+ int main(int argc, char **argv)
+ {
+ funcptrfunc fpf = argc < 100 ? getIt : NULL;
+ printf("*%p*\n", fpf(argc));
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_funcptrfunc.out b/tests/core/test_funcptrfunc.out
new file mode 100644
index 00000000..0d1299f6
--- /dev/null
+++ b/tests/core/test_funcptrfunc.out
@@ -0,0 +1 @@
+*0x1* \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 6e4ef726..7b9cd750 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1532,24 +1532,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_funcptrfunc(self):
- src = r'''
- #include <stdio.h>
-
- typedef void (*funcptr)(int, int);
- typedef funcptr (*funcptrfunc)(int);
-
- funcptr __attribute__ ((noinline)) getIt(int x) {
- return (funcptr)x;
- }
+ test_path = path_from_root('tests', 'core', 'test_funcptrfunc')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main(int argc, char **argv)
- {
- funcptrfunc fpf = argc < 100 ? getIt : NULL;
- printf("*%p*\n", fpf(argc));
- return 0;
- }
- '''
- self.do_run(src, '*0x1*')
+ self.do_run_from_file(src, output)
def test_funcptr_namecollide(self):
src = r'''