Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / not.c
1 /** not.c test ! operator
2
3   ANSI: return type is int
4
5   attr: volatile,
6 */
7 #include <testfwk.h>
8
9 void
10 testNot(void)
11 {
12     signed char  {attr} sc;
13   unsigned char  {attr} uc;
14   unsigned int   {attr} ui;
15   unsigned long  {attr} ul;
16
17   sc = 0;
18   uc = 0;
19   ui = 0;
20   ul = 0;
21   /* remember: unsigned * signed -> unsigned */
22   /*             signed * signed ->   signed */
23   ASSERT(!(  signed char) 0 * -1 < 0);
24   ASSERT(!(unsigned char) 0 * -1 < 0);
25   ASSERT(!sc   * -1 < 0);
26   ASSERT(!uc   * -1 < 0);
27   ASSERT(! 0   * -1 < 0);
28   ASSERT(! 0u  * -1 < 0);
29   ASSERT(!ui   * -1 < 0);
30   ASSERT(! 0l  * -1 < 0);
31   ASSERT(! 0ul * -1 < 0);
32   ASSERT(!ul   * -1 < 0);
33
34   ASSERT(!(char) 0 <<  8 == 0x100);
35   ASSERT(!sc       <<  8 == 0x100);
36 #if !defined(PORT_HOST)
37   ASSERT(!0  << 16 == 0);
38   ASSERT(!0l << 16 == 0);
39   ASSERT(!ui << 16 == 0);
40   ASSERT(!ul << 16 == 0);
41 #endif
42 }