| 1 | #include <assert.h> |
| 2 | #include <complex.h> |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | typedef struct { |
| 7 | int val; |
| 8 | } STest; |
| 9 | |
| 10 | int getVal(STest* data) { return data->val; } |
| 11 | |
| 12 | int main (int argc, char *argv[]) |
| 13 | { |
| 14 | STest* data = (STest*)malloc(sizeof(STest)); |
| 15 | data->val = 123; |
| 16 | |
| 17 | assert(getVal(data) != 456); |
| 18 | int ok = (getVal(data) == 123); |
| 19 | |
| 20 | if (argc > 1) { |
| 21 | fprintf(stdout, "val=%d\n", data->val); |
| 22 | } |
| 23 | |
| 24 | free(data); |
| 25 | |
| 26 | if (!ok) abort(); |
| 27 | |
| 28 | return EXIT_SUCCESS; |
| 29 | } |