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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [class-4.m] - Blame information for rev 825

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

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

powered by: WebSVN 2.1.0

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