OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [nil_method-1.m] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Contributed by Nicola Pero - Fri Aug 30 12:55:37 2002 */
2
#include <objc/objc.h>
3
#include <objc/Object.h>
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 : Object
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.