Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / objc / execute / nil_method-1.m
blob137d2072e4408750bc14e17707f294bd1b74c8bb
1 /* Contributed by Nicola Pero - Fri Aug 30 12:55:37 2002 */ 
2 #include <objc/objc.h>
3 #include <objc/Object.h>
5 /* Test that calling a method of a nil object results in
6    nothing to happen (but not a crash), and nil to be
7    returned.  */
9 @interface TestClass : Object
11 - (void) testVoid;
12 - (id) testId;
14 - (void) testVoidWithA: (int)a;
15 - (id) testIdWithA: (id)a;
17 - (void) testVoidWithA: (int)a  andB: (int)b;
18 - (id) testIdWithA: (id)g  andB: (id)b;
20 - (void) voidSum: (int)firstNumber, ...;
21 - (id) sum: (int)firstNumber, ...;
23 @end
25 int main (void)
27   TestClass *t = nil;
29   [t testVoid];
31   if ([t testId] != nil)
32     {
33       abort ();
34     }
36   [t testVoidWithA: 234];
38   if ([t testIdWithA: t] != nil)
39     {
40       abort ();
41     }
43   [t testVoidWithA: 12004  andB: -123];
45   if ([t testIdWithA: t  andB: nil] != nil)
46     {
47       abort ();
48     }
51   [t voidSum: 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 
52      11, -12, 13, -14, 15, -16, 17, -18, 19, -20];
54   if ([t sum: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
55          11, 12, 13, 14, 15, 16, 17, 18, 19, 20] != nil)
56     {
57       abort ();
58     }
60   return 0;