diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-06 21:46:38 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:50 +0200 |
commit | 3dcf74e687a4cf376d7cfdc6452a745b47687c4d (patch) | |
tree | 8adc742156350aa96e79eeccff30c3a6ec9ca529 /tests | |
parent | a611d82983c7a6d08039b60ac93fd89fe82e875d (diff) |
Use do_run_from_file() for test_bitfields
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_bitfields.in | 23 | ||||
-rw-r--r-- | tests/core/test_bitfields.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 29 |
3 files changed, 29 insertions, 24 deletions
diff --git a/tests/core/test_bitfields.in b/tests/core/test_bitfields.in new file mode 100644 index 00000000..08831f23 --- /dev/null +++ b/tests/core/test_bitfields.in @@ -0,0 +1,23 @@ + + #include <stdio.h> + struct bitty { + unsigned x : 1; + unsigned y : 1; + unsigned z : 1; + }; + int main() + { + bitty b; + printf("*"); + for (int i = 0; i <= 1; i++) + for (int j = 0; j <= 1; j++) + for (int k = 0; k <= 1; k++) { + b.x = i; + b.y = j; + b.z = k; + printf("%d,%d,%d,", b.x, b.y, b.z); + } + printf("*\n"); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_bitfields.out b/tests/core/test_bitfields.out new file mode 100644 index 00000000..e121b181 --- /dev/null +++ b/tests/core/test_bitfields.out @@ -0,0 +1 @@ +*0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,1,1,*
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 0ddbede2..59ad79d8 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -754,30 +754,11 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_bitfields(self): if self.emcc_args is None: Settings.SAFE_HEAP = 0 # bitfields do loads on invalid areas, by design - src = ''' - #include <stdio.h> - struct bitty { - unsigned x : 1; - unsigned y : 1; - unsigned z : 1; - }; - int main() - { - bitty b; - printf("*"); - for (int i = 0; i <= 1; i++) - for (int j = 0; j <= 1; j++) - for (int k = 0; k <= 1; k++) { - b.x = i; - b.y = j; - b.z = k; - printf("%d,%d,%d,", b.x, b.y, b.z); - } - printf("*\\n"); - return 0; - } - ''' - self.do_run(src, '*0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,1,1,*') + + test_path = path_from_root('tests', 'core', 'test_bitfields') + src, output = (test_path + s for s in ('.in', '.out')) + + self.do_run_from_file(src, output) def test_floatvars(self): src = ''' |