diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 23:32:18 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:52 +0200 |
commit | 6749f88042d90dc2f50dc836f11d577fb7f16250 (patch) | |
tree | 11ec68468443ab491fb4efef05ba6259ba864112 /tests | |
parent | b738dbadbbd9a49d1ae093c451245f20d7664e09 (diff) |
Use do_run_from_file() for test_structs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_structs.in | 22 | ||||
-rw-r--r-- | tests/core/test_structs.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 27 |
3 files changed, 27 insertions, 23 deletions
diff --git a/tests/core/test_structs.in b/tests/core/test_structs.in new file mode 100644 index 00000000..47158351 --- /dev/null +++ b/tests/core/test_structs.in @@ -0,0 +1,22 @@ + + #include <stdio.h> + struct S + { + int x, y; + }; + int main() + { + S a, b; + a.x = 5; a.y = 6; + b.x = 101; b.y = 7009; + S *c, *d; + c = &a; + c->x *= 2; + c = &b; + c->y -= 1; + d = c; + d->y += 10; + printf("*%d,%d,%d,%d,%d,%d,%d,%d*\n", a.x, a.y, b.x, b.y, c->x, c->y, d->x, d->y); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_structs.out b/tests/core/test_structs.out new file mode 100644 index 00000000..7748b49e --- /dev/null +++ b/tests/core/test_structs.out @@ -0,0 +1 @@ +*10,6,101,7018,101,7018,101,7018*
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 823c0285..ffbdf487 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -964,29 +964,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_structs(self): - src = ''' - #include <stdio.h> - struct S - { - int x, y; - }; - int main() - { - S a, b; - a.x = 5; a.y = 6; - b.x = 101; b.y = 7009; - S *c, *d; - c = &a; - c->x *= 2; - c = &b; - c->y -= 1; - d = c; - d->y += 10; - printf("*%d,%d,%d,%d,%d,%d,%d,%d*\\n", a.x, a.y, b.x, b.y, c->x, c->y, d->x, d->y); - return 0; - } - ''' - self.do_run(src, '*10,6,101,7018,101,7018,101,7018*') + test_path = path_from_root('tests', 'core', 'test_structs') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) gen_struct_src = ''' #include <stdio.h> |