9 int test2(int a, int b)
14 int test2a(int a, int b)
19 int test3(int a, int b)
21 return a == 0 && b + 1 < 10;
24 int test4(int a, int b)
26 return a == 0 || b + 1 < 10;
29 int test5(int a, int b)
31 return a > b ? a : b - 1;
34 int test6(int a, int b)
36 return a < 0 ? -1 : (a > 0 ? 1 : 0);
39 int test6a(int a, int b)
49 int test7(int a, int b)
53 for(i = 0; i < a; ++i)
59 int test8(int a, int b, int c)
61 return a < b ? (a < c ? a : c) : (b < c ? b : c);
64 int test9(int a, int b)
69 int testam(int a, int b, int c)
79 #define TU(t,a,s) printf("%s(%d) = %d (should be %d)\n", \
83 #define TB(t,a,b,s) printf("%s(%d,%d) = %d (should be %d)\n", \
84 #t, a, b, t(a,b), s); \
87 #define TT(t,a,b,c,s) printf("%s(%d,%d,%d) = %d (should be %d)\n", \
88 #t, a, b, c, t(a,b,c), s); \
89 assert(t(a,b,c) == s);
96 TB(test2, -23, -23, 1);
101 TB(test2a, -23, -23, 0);
102 TB(test2a, 0, 42, 1);
103 TB(test2a, -1, 0, 1);
106 TB(test3, 0, -200, 1);
109 TB(test3, -1, -200, 0);
110 TB(test3, -1, 10, 0);
113 TB(test4, 0, -200, 1);
116 TB(test4, -1, -200, 1);
117 TB(test4, -1, 10, 0);
119 TB(test5, 42, -1, 42);
122 TB(test5, -1, 42, 41);
124 TB(test6, -5, 42, -1);
125 TB(test6, -20, -1, -1);
126 TB(test6, 20, -1, 1);
127 TB(test6a, 42, -1, 0);
131 TT(test8, 0, 2, 3, 0);
132 TT(test8, 0, 2, 1, 0);
133 TT(test8, -1, 42, 5, -1);
134 TT(test8, -7, 4, -42, -42);
135 TT(test8, 0, 2, -1, -1);
136 TT(test8, 24, 123, 7, 7);
138 TT(testam, -24, 13, 7, 13);
139 TT(testam, 102, 13, 7, 7);
142 TB(test9, -42, -42, -42);