Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / scott-pointer1.c
1 /*
2   Pointer tests
3 */
4 #include <testfwk.h>
5
6 unsigned int aint0 = 0;
7 unsigned int aint1 = 0;
8 unsigned char achar0 = 0;
9 unsigned char achar1 = 0;
10 unsigned char *acharP = 0;
11
12 void
13 f1 (unsigned char *ucP)
14 {
15
16   if (ucP == 0)
17     {
18       ASSERT(0);
19       return;
20     }
21
22   ASSERT (!(*ucP));
23 }
24
25 void
26 f2 (unsigned int *uiP)
27 {
28
29   if (uiP == 0)
30     {
31       ASSERT(0);
32       return;
33     }
34
35   ASSERT (!(*uiP));
36
37 }
38
39 unsigned char *
40 f3 (void)
41 {
42
43   return &achar0;
44 }
45
46 void
47 testPointer1 (void)
48 {
49   f1 (&achar0);
50   f2 (&aint0);
51
52   acharP = f3 ();
53   ASSERT (!((acharP == 0) || (*acharP)));
54 }