|
| 1 | +#include <stdio.h> |
| 2 | + |
| 3 | +extern void init_type(int*, void**); |
| 4 | +extern void add_one_C(int*, void**, int*, int*); |
| 5 | + |
| 6 | + |
| 7 | +int main(){ |
| 8 | + |
| 9 | + void* x3; |
| 10 | + void* x4; |
| 11 | + int xtype=3; |
| 12 | + int A, C; |
| 13 | + |
| 14 | + xtype = 3; |
| 15 | + init_type(&xtype, &x3); |
| 16 | + |
| 17 | + add_one_C(&xtype, &x3, &A, &C); |
| 18 | + if(A != 4) { |
| 19 | + fprintf(stderr, "Error: %d != 4\n", A); |
| 20 | + return 1; |
| 21 | + } |
| 22 | + printf("C:3 = %d\n", C); |
| 23 | + add_one_C(&xtype, &x3, &A, &C); |
| 24 | + printf("C:3 = %d\n", C); |
| 25 | + add_one_C(&xtype, &x3, &A, &C); |
| 26 | + printf("C:3 = %d\n", C); |
| 27 | + |
| 28 | + xtype = 4; |
| 29 | + init_type(&xtype, &x4); |
| 30 | + |
| 31 | + add_one_C(&xtype, &x4, &A, &C); |
| 32 | + if(A != 5) { |
| 33 | + fprintf(stderr, "Error: %d != 5\n", A); |
| 34 | + return 1; |
| 35 | + } |
| 36 | + printf("C:4 = %d\n", C); |
| 37 | + add_one_C(&xtype, &x4, &A, &C); |
| 38 | + printf("C:4 = %d\n", C); |
| 39 | + add_one_C(&xtype, &x4, &A, &C); |
| 40 | + printf("C:4 = %d\n", C); |
| 41 | + |
| 42 | + printf("OK: poly_type\n"); |
| 43 | + |
| 44 | + return 0; |
| 45 | +} |
0 commit comments