aboutsummaryrefslogtreecommitdiff
path: root/tests/core/test_corruption_3.in
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 17:33:37 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:36:02 +0200
commite01c9f0a85798f35684fa1b7e4473ecd68238535 (patch)
tree1706a8755196a6235a43ace97129aa84c9500ebc /tests/core/test_corruption_3.in
parent85303af22543f32728cc2cfa55bee4c558c26631 (diff)
Use do_run_from_file() for test_corruption_3
Diffstat (limited to 'tests/core/test_corruption_3.in')
-rw-r--r--tests/core/test_corruption_3.in22
1 files changed, 22 insertions, 0 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