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/] [many_args_method.m] - Blame information for rev 237

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

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

powered by: WebSVN 2.1.0

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