1 /* use 0 for NULL so no need for system header */
2
3 int test_c_assoc_0(void *my_c_ptr);
4 int test_c_assoc_1(void *my_c_ptr_1, void *my_c_ptr_2);
5 int test_c_assoc_2(void *my_c_ptr_1, void *my_c_ptr_2, int num_ptrs);
6 void verify_assoc(void *my_c_ptr_1, void *my_c_ptr_2);
7
8 extern void abort(void);
9
10 int main(int argc, char **argv)
11 {
12 int i;
13 int j;
14
15 if(test_c_assoc_0(0) != 0)
16 abort();
17
18 if(test_c_assoc_0(&i) != 1)
19 abort();
20
21 if(test_c_assoc_1(0, 0) != 0)
22 abort();
23
24 if(test_c_assoc_1(0, &i) != 0)
25 abort();
26
27 if(test_c_assoc_1(&i, &i) != 1)
28 abort();
29
30 if(test_c_assoc_1(&i, 0) != 0)
31 abort();
32
33 if(test_c_assoc_1(&i, &j) != 0)
34 abort();
35
36 /* this should be associated, cause only testing 1 ptr (i) */
37 if(test_c_assoc_2(&i, 0, 1) != 1)
38 abort();
39
40 /* this should be associated */
41 if(test_c_assoc_2(&i, &i, 2) != 1)
42 abort();
43
44 /* this should not be associated (i) */
45 if(test_c_assoc_2(&i, &j, 2) != 0)
46 abort();
47
48 /* this should be associated, cause only testing 1 ptr (i) */
49 if(test_c_assoc_2(&i, &j, 1) != 1)
50 abort();
51
52 verify_assoc(&i, &i);
53
54 return 0;
55 }/* end main() */