FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / objc / execute / many_args_method.m
blobd811082cb86d2a8a0e9078d2e15ae6add24e9d5b
1 /* Contributed by Nicola Pero - Fri Mar  9 19:39:15 CET 2001 */
2 #include <objc/objc.h>
4 /* Test the syntax of methods with many arguments */
6 @interface TestClass
8   Class isa;
10 + (int) sumInteger: (int)a   withInteger: (int)b;
11 + (int) sum: (int)a   : (int)b;
12 + (int) sumInteger: (int)a   withInteger: (int)b  withInteger: (int)c;
13 + (int) sum: (int)a   : (int)b  : (int)c;
14 @end
16 @implementation TestClass
17 + (int) sumInteger: (int)a  withInteger: (int)b
19   return a + b;
21 + (int) sum: (int)a   : (int)b
23   return [self sumInteger: a  withInteger: b];
25 + (int) sumInteger: (int)a   withInteger: (int)b  withInteger: (int)c
27   return a + b + c;
29 + (int) sum: (int)a   : (int)b  : (int)c
31   return [self sumInteger: a  withInteger: b  withInteger: c];
33 @end
36 int main (void)
38   if ([TestClass sumInteger: 1  withInteger: 1] != 2)
39     {
40       abort ();
41     }
42   if ([TestClass sum: 1  : 1] != 2)
43     {
44       abort ();
45     }
46   if ([TestClass sumInteger: 1  withInteger: 1  withInteger: 1] != 3)
47     {
48       abort ();
49     }
50   if ([TestClass sum: 1  : 1  : 1] != 3)
51     {
52       abort ();
53     }
55   return 0;