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)
71 #define TU(t,a,s) printf("%s(%d) = %d (should be %d)\n", \
75 #define TB(t,a,b,s) printf("%s(%d,%d) = %d (should be %d)\n", \
76 #t, a, b, t(a,b), s); \
79 #define TT(t,a,b,c,s) printf("%s(%d,%d,%d) = %d (should be %d)\n", \
80 #t, a, b, c, t(a,b,c), s); \
81 assert(t(a,b,c) == s);
88 TB(test2, -23, -23, 1);
93 TB(test2a, -23, -23, 0);
98 TB(test3, 0, -200, 1);
101 TB(test3, -1, -200, 0);
102 TB(test3, -1, 10, 0);
105 TB(test4, 0, -200, 1);
108 TB(test4, -1, -200, 1);
109 TB(test4, -1, 10, 0);
111 TB(test5, 42, -1, 42);
114 TB(test5, -1, 42, 41);
116 TB(test6, -5, 42, -1);
117 TB(test6, -20, -1, -1);
118 TB(test6, 20, -1, 1);
119 TB(test6a, 42, -1, 0);
123 TT(test8, 0, 2, 3, 0);
124 TT(test8, 0, 2, 1, 0);
125 TT(test8, -1, 42, 5, -1);
126 TT(test8, -7, 4, -42, -42);
127 TT(test8, 0, 2, -1, -1);
128 TT(test8, 24, 123, 7, 7);
131 TB(test9, -42, -42, -42);