diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 16:50:11 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:01 +0200 |
commit | 9669423b703fc50f7acbf9f640743669cf893bcc (patch) | |
tree | de2a17c1cabd333ea3d1395a93e7293fb83fba1e /tests | |
parent | 66db5a1d3ed9055ff58a2d249c18b55f7fd677df (diff) |
Use do_run_from_file() for test_phiundef
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_phiundef.in | 33 | ||||
-rw-r--r-- | tests/core/test_phiundef.out | 5 | ||||
-rw-r--r-- | tests/test_core.py | 37 |
3 files changed, 41 insertions, 34 deletions
diff --git a/tests/core/test_phiundef.in b/tests/core/test_phiundef.in new file mode 100644 index 00000000..cf4b0f18 --- /dev/null +++ b/tests/core/test_phiundef.in @@ -0,0 +1,33 @@ + +#include <stdlib.h> +#include <stdio.h> + +static int state; + +struct my_struct { +union { + struct { + unsigned char a; + unsigned char b; + } c; + unsigned int d; +} e; +unsigned int f; +}; + +int main(int argc, char **argv) { + struct my_struct r; + + state = 0; + + for (int i=0;i<argc+10;i++) + { + if (state % 2 == 0) + r.e.c.a = 3; + else + printf("%d\n", r.e.c.a); + state++; + } + return 0; +} +
\ No newline at end of file diff --git a/tests/core/test_phiundef.out b/tests/core/test_phiundef.out new file mode 100644 index 00000000..3b04a039 --- /dev/null +++ b/tests/core/test_phiundef.out @@ -0,0 +1,5 @@ +3 +3 +3 +3 +3 diff --git a/tests/test_core.py b/tests/test_core.py index cb319500..47a39ba7 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4232,41 +4232,10 @@ PORT: 3979 self.do_run_from_file(src, output) def test_phiundef(self): - src = r''' -#include <stdlib.h> -#include <stdio.h> - -static int state; - -struct my_struct { -union { - struct { - unsigned char a; - unsigned char b; - } c; - unsigned int d; -} e; -unsigned int f; -}; - -int main(int argc, char **argv) { - struct my_struct r; - - state = 0; - - for (int i=0;i<argc+10;i++) - { - if (state % 2 == 0) - r.e.c.a = 3; - else - printf("%d\n", r.e.c.a); - state++; - } - return 0; -} - ''' + test_path = path_from_root('tests', 'core', 'test_phiundef') + src, output = (test_path + s for s in ('.in', '.out')) - self.do_run(src, '3\n3\n3\n3\n3\n') + self.do_run_from_file(src, output) # libc++ tests |