diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-02 19:00:58 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:05 -0700 |
commit | 26576167eb0794d54dfb2e3d305edaacde635bd4 (patch) | |
tree | decabaf93cb46d59d5045ed4a877a70c00bbafb3 | |
parent | c3965c1799c7682dcba8c477c13e8a9705d5b95f (diff) |
add function pointers test
-rwxr-xr-x | tests/runner.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 68d3246c..ab1e3e9f 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10672,6 +10672,21 @@ f.close() void sidey() { printf("hello from side\n"); } ''', 'hello from main\nhello from side\n') + # function pointers + test('fp1', 'typedef void (*voidfunc)();', r''' + #include <stdio.h> + #include "header.h" + voidfunc sidey(voidfunc f); + void a() { printf("hello from funcptr\n"); } + int main() { + sidey(a)(); + return 0; + } + ''', ''' + #include "header.h" + voidfunc sidey(voidfunc f) { return f; } + ''', 'hello from funcptr\n') + # Global initializer test('global init', '', r''' #include <stdio.h> |