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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc/] [execute/] [class-4.m] - Blame information for rev 702

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 702 jeremybenn
/* Contributed by Nicola Pero - Tue Mar  6 23:05:53 CET 2001 */
2
 
3
#include <objc/objc.h>
4
 
5
/* Tests creating a root class and a subclass with an ivar and
6
   accessor methods */
7
 
8
@interface RootClass
9
{
10
  Class isa;
11
}
12
@end
13
 
14
@implementation RootClass
15
+ initialize { return self; }
16
@end
17
 
18
@interface SubClass : RootClass
19
{
20
  int state;
21
}
22
- (void) setState: (int)number;
23
- (int) state;
24
@end
25
 
26
@implementation SubClass
27
- (void) setState: (int)number
28
{
29
  state = number;
30
}
31
- (int) state
32
{
33
  return state;
34
}
35
@end
36
 
37
#include "class-tests-1.h"
38
#define TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD SubClass *
39
#include "class-tests-2.h"
40
 
41
int main (void)
42
{
43
  SubClass *object;
44
 
45
  test_class_with_superclass ("SubClass", "RootClass");
46
  test_that_class_has_instance_method ("SubClass", @selector (setState:));
47
  test_that_class_has_instance_method ("SubClass", @selector (state));
48
 
49
  object = class_createInstance (objc_getClass ("SubClass"), 0);
50
  test_accessor_method (object, 0, 1, 1, -3, -3);
51
 
52
  return 0;
53
}

powered by: WebSVN 2.1.0

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