]> git.sur5r.net Git - cc65/blob - test/val/bool3.c
All regression-tests subdirectories are cleaned before the first test starts, so...
[cc65] / test / val / bool3.c
1 /*
2   !!DESCRIPTION!! Compound comparisons
3   !!ORIGIN!!      SDCC regression tests
4   !!LICENCE!!     GPL, read COPYING.GPL
5 */
6
7 #include <stdio.h>
8 #include <limits.h>
9
10 unsigned char success=0;
11 unsigned char failures=0;
12 unsigned char dummy=0;
13
14 #ifdef SUPPORT_BIT_TYPES
15 bit bit0 = 0;
16 bit bit1 = 0;
17 #endif
18 unsigned int ui0 = 0;
19 unsigned int ui1 = 0;
20 unsigned char uc0 = 0;
21 unsigned char uc1 = 0;
22 unsigned long uL0 = 0;
23 unsigned long uL1 = 0;
24
25 void done()
26 {
27   dummy++;
28 }
29
30 void compound_compare_uc(void)
31 {
32   failures += (uc0 != uc1);
33 }
34
35 void compound_compare_ui(void)
36 {
37   failures += (ui0 != ui1);
38 }
39
40 void compound_compare_ul(void)
41 {
42   failures += (uL0 != uL1);
43 }
44
45 void compound_compare_uc_lit(void)
46 {
47   failures += (uc0 != 0xff);
48   failures += (uc0 != 0xff);
49   failures += (uc0 == 0);
50 }
51
52 int  main(void)
53 {
54   compound_compare_uc();
55   compound_compare_ui();
56   compound_compare_ul();
57
58   uc0 = 0xff;
59   compound_compare_uc_lit();
60
61   success = failures;
62   done();
63   printf("failures: %d\n",failures);
64
65   return failures;
66 }