xref: /freebsd/contrib/unifdef/tests/if5.c (revision e1e636193db45630c7881246d25902e57c43d24e)
1 /* Copyright 2004 Bob Proulx <bob@proulx.com>
2 Distributed under the two-clause BSD licence;
3 see the COPYING file for details. */
4 
5 #include <stdio.h>
6 #include <stdlib.h>
7 
8 #if FOOB == 42
9 int foo1() { return 0; }
10 #else
11 #error FOOB not 42
12 #endif
13 
14 #if FOOB != 42
15 #error FOO is 2
16 #else
17 int foo2() { return 0; }
18 #endif
19 
20 #if FOOB == 42 || FOO == 1
21 int foo3() { return 0; }
22 #else
23 #error FOO not 1 or BAR not 1
24 #endif
25 
26 #if FOOB != 42 && FOO != 1
27 #error FOOB not 42 and FOO not 1
28 #else
29 int foo4() { return 0; }
30 #endif
31 
32 #if FOOB == 42 || FOO != 1
33 int foo5() { return 0; }
34 #else
35 #error FOOB is 42 or FOO is not 1
36 #endif
37 
38 #if FOO != 1 || FOOB != 42
39 #error FOO is 1 or FOOB is 42
40 #else
41 int foo6() { return 0; }
42 #endif
43 
44 #if FOO > FOOB
45 #error FOO is greater than FOOB
46 #else
47 int foo7() { return 0; }
48 #endif
49 
50 #if FOOB < FOO
51 #error FOOB is less than FOO
52 #else
53 int foo8() { return 0; }
54 #endif
55 
56 #if FOO >= FOOB
57 #error FOO is greater than or equal FOOB
58 #else
59 int foo9() { return 0; }
60 #endif
61 
62 #if FOOB <= FOO
63 #error FOOB is less than or equal FOO
64 #else
65 int foo10() { return 0; }
66 #endif
67 
68 int main()
69 {
70   foo1();
71   foo2();
72   foo3();
73   foo4();
74   foo5();
75   foo6();
76   foo7();
77   foo8();
78   foo9();
79   foo10();
80 }
81