diff options
-rw-r--r-- | tests/core/test_functionpointer_libfunc_varargs.in | 13 | ||||
-rw-r--r-- | tests/core/test_functionpointer_libfunc_varargs.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 18 |
3 files changed, 18 insertions, 14 deletions
diff --git a/tests/core/test_functionpointer_libfunc_varargs.in b/tests/core/test_functionpointer_libfunc_varargs.in new file mode 100644 index 00000000..6cabe8c5 --- /dev/null +++ b/tests/core/test_functionpointer_libfunc_varargs.in @@ -0,0 +1,13 @@ + + #include <stdio.h> + #include <fcntl.h> + typedef int (*fp_t)(int, int, ...); + int main(int argc, char **argv) { + fp_t fp = &fcntl; + if (argc == 1337) fp = (fp_t)&main; + (*fp)(0, 10); + (*fp)(0, 10, 5); + printf("waka\n"); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_functionpointer_libfunc_varargs.out b/tests/core/test_functionpointer_libfunc_varargs.out new file mode 100644 index 00000000..360b24da --- /dev/null +++ b/tests/core/test_functionpointer_libfunc_varargs.out @@ -0,0 +1 @@ +waka
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 714254e4..d34313f7 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -2165,20 +2165,10 @@ The current type of b is: 9 ''') def test_functionpointer_libfunc_varargs(self): - src = r''' - #include <stdio.h> - #include <fcntl.h> - typedef int (*fp_t)(int, int, ...); - int main(int argc, char **argv) { - fp_t fp = &fcntl; - if (argc == 1337) fp = (fp_t)&main; - (*fp)(0, 10); - (*fp)(0, 10, 5); - printf("waka\n"); - return 0; - } - ''' - self.do_run(src, '''waka''') + test_path = path_from_root('tests', 'core', 'test_functionpointer_libfunc_varargs') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) def test_structbyval(self): Settings.INLINING_LIMIT = 50 |