blob: 6cc2e2535edc9e454074ffe4eb503b415e67e21d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/* Contributed by Nicola Pero - Fri Mar 9 19:39:15 CET 2001 */
#include <objc/objc.h>
/* Test the syntax of methods with many arguments */
@interface TestClass
{
Class isa;
}
+ (int) sumInteger: (int)a withInteger: (int)b;
+ (int) sum: (int)a : (int)b;
+ (int) sumInteger: (int)a withInteger: (int)b withInteger: (int)c;
+ (int) sum: (int)a : (int)b : (int)c;
@end
@implementation TestClass
+ (int) sumInteger: (int)a withInteger: (int)b
{
return a + b;
}
+ (int) sum: (int)a : (int)b
{
return [self sumInteger: a withInteger: b];
}
+ (int) sumInteger: (int)a withInteger: (int)b withInteger: (int)c
{
return a + b + c;
}
+ (int) sum: (int)a : (int)b : (int)c
{
return [self sumInteger: a withInteger: b withInteger: c];
}
#ifdef __NEXT_RUNTIME__
+ initialize { return self; }
#endif
@end
int main (void)
{
if ([TestClass sumInteger: 1 withInteger: 1] != 2)
{
abort ();
}
if ([TestClass sum: 1 : 1] != 2)
{
abort ();
}
if ([TestClass sumInteger: 1 withInteger: 1 withInteger: 1] != 3)
{
abort ();
}
if ([TestClass sum: 1 : 1 : 1] != 3)
{
abort ();
}
return 0;
}
|