diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 17:33:37 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:02 +0200 |
commit | e01c9f0a85798f35684fa1b7e4473ecd68238535 (patch) | |
tree | 1706a8755196a6235a43ace97129aa84c9500ebc /tests | |
parent | 85303af22543f32728cc2cfa55bee4c558c26631 (diff) |
Use do_run_from_file() for test_corruption_3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_corruption_3.in | 22 | ||||
-rw-r--r-- | tests/core/test_corruption_3.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 25 |
3 files changed, 26 insertions, 22 deletions
diff --git a/tests/core/test_corruption_3.in b/tests/core/test_corruption_3.in new file mode 100644 index 00000000..b951ac6b --- /dev/null +++ b/tests/core/test_corruption_3.in @@ -0,0 +1,22 @@ + + #include <stdlib.h> + #include <stdio.h> + #include <assert.h> + + void bye() { + printf("all ok\n"); + } + + int main(int argc, char **argv) { + atexit(bye); + + char *buffer = (char*)malloc(100); + for (int i = 0; i < 100; i++) buffer[i] = (i*i)%256; + buffer = (char*)realloc(buffer, argc + 50); + for (int i = 0; i < argc + 50; i++) { + //printf("%d : %d : %d : %d\n", i, (int)(buffer + i), buffer[i], (char)((i*i)%256)); + assert(buffer[i] == (char)((i*i)%256)); + } + return 1; + } +
\ No newline at end of file diff --git a/tests/core/test_corruption_3.out b/tests/core/test_corruption_3.out new file mode 100644 index 00000000..d48ce729 --- /dev/null +++ b/tests/core/test_corruption_3.out @@ -0,0 +1 @@ +all ok diff --git a/tests/test_core.py b/tests/test_core.py index 6fcff1c4..abe79230 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5121,29 +5121,10 @@ def process(filename): Settings.CORRUPTION_CHECK = 1 # realloc - src = r''' - #include <stdlib.h> - #include <stdio.h> - #include <assert.h> - - void bye() { - printf("all ok\n"); - } + test_path = path_from_root('tests', 'core', 'test_corruption_3') + src, output = (test_path + s for s in ('.in', '.out')) - int main(int argc, char **argv) { - atexit(bye); - - char *buffer = (char*)malloc(100); - for (int i = 0; i < 100; i++) buffer[i] = (i*i)%256; - buffer = (char*)realloc(buffer, argc + 50); - for (int i = 0; i < argc + 50; i++) { - //printf("%d : %d : %d : %d\n", i, (int)(buffer + i), buffer[i], (char)((i*i)%256)); - assert(buffer[i] == (char)((i*i)%256)); - } - return 1; - } - ''' - self.do_run(src, 'all ok\n') + self.do_run_from_file(src, output) ### Integration tests |