| 1 |
/* Contributed by Nicola Pero - Fri Aug 30 12:55:37 2002 */ |
| 2 |
#include <objc/objc.h> |
| 3 |
#include "../../objc-obj-c++-shared/TestsuiteObject.m" |
| 4 |
|
| 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. */ |
| 8 |
|
| 9 |
@interface TestClass : TestsuiteObject |
| 10 |
|
| 11 |
- (void) testVoid; |
| 12 |
- (id) testId; |
| 13 |
|
| 14 |
- (void) testVoidWithA: (int)a; |
| 15 |
- (id) testIdWithA: (id)a; |
| 16 |
|
| 17 |
- (void) testVoidWithA: (int)a andB: (int)b; |
| 18 |
- (id) testIdWithA: (id)g andB: (id)b; |
| 19 |
|
| 20 |
- (void) voidSum: (int)firstNumber, ...; |
| 21 |
- (id) sum: (int)firstNumber, ...; |
| 22 |
|
| 23 |
@end |
| 24 |
|
| 25 |
int main (void) |
| 26 |
{ |
| 27 |
TestClass *t = nil; |
| 28 |
|
| 29 |
[t testVoid]; |
| 30 |
|
| 31 |
if ([t testId] != nil) |
| 32 |
{ |
| 33 |
abort (); |
| 34 |
} |
| 35 |
|
| 36 |
[t testVoidWithA: 234]; |
| 37 |
|
| 38 |
if ([t testIdWithA: t] != nil) |
| 39 |
{ |
| 40 |
abort (); |
| 41 |
} |
| 42 |
|
| 43 |
[t testVoidWithA: 12004 andB: -123]; |
| 44 |
|
| 45 |
if ([t testIdWithA: t andB: nil] != nil) |
| 46 |
{ |
| 47 |
abort (); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
[t voidSum: 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, |
| 52 |
11, -12, 13, -14, 15, -16, 17, -18, 19, -20]; |
| 53 |
|
| 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 |
} |
| 59 |
|
| 60 |
return 0; |
| 61 |
} |