OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [class-12.m] - Blame information for rev 307

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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