1 /* 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 | FOO) == 43 foo1()9int foo1() { return 0; } 10 #else 11 #error FOOB bitwise-or FOO is not 43 12 #endif 13 14 #if (FOO ^ FOO) == 0 foo2()15int foo2() { return 0; } 16 #else 17 #error FOO bitwise-xor FOO is not 0 18 #endif 19 20 #if (FOOB & 2) == 2 foo3()21int foo3() { return 0; } 22 #else 23 #error FOOB bitwise-and 2 is not 2 24 #endif 25 26 #if (FOO << 1) == 2 foo4()27int foo4() { return 0; } 28 #else 29 #error FOO left-shift 2 is not 2 30 #endif 31 32 #if (FOOB >> 4) == 2 foo5()33int foo5() { return 0; } 34 #else 35 #error FOOB right-shift 2 is not 2 36 #endif 37 38 #if (FOOB + FOO) == 43 foo6()39int foo6() { return 0; } 40 #else 41 #error FOOB add FOO is not 43 42 #endif 43 44 #if (FOOB - FOO) == 41 foo7()45int foo7() { return 0; } 46 #else 47 #error FOOB subtract FOO is not 41 48 #endif 49 50 #if (FOOB * 2) == 84 foo8()51int foo8() { return 0; } 52 #else 53 #error FOOB multiply 2 is not 84 54 #endif 55 56 #if (FOOB / 2) == 21 foo9()57int foo9() { return 0; } 58 #else 59 #error FOOB divided 2 is not 21 60 #endif 61 62 #if (FOOB % FOO) == 0 foo10()63int foo10() { return 0; } 64 #else 65 #error FOOB modulo FOO is not 0 66 #endif 67 68 #if ~(FOOB) == -43 foo11()69int foo11() { return 0; } 70 #else 71 #error bitwise-not FOOB is not -43 72 #endif 73 74 #if -(FOOB) == -42 foo12()75int foo12() { return 0; } 76 #else 77 #error negate FOOB is not -42 78 #endif 79 main()80int main() 81 { 82 foo1(); 83 foo2(); 84 foo3(); 85 foo4(); 86 foo5(); 87 foo6(); 88 foo7(); 89 foo8(); 90 foo9(); 91 foo10(); 92 foo11(); 93 foo12(); 94 } 95