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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [special/] [unclaimed-category-1.m] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */
2
/* { dg-do run } */
3
#include <objc/objc.h>
4
#include <objc/objc-api.h>
5
#include <objc/Object.h>
6
 
7
extern void abort (void);
8
 
9
/* Test loading unclaimed categories - categories of a class defined
10
   separately from the class itself.  */
11
 
12
 
13
/* unclaimed-category-1.m contains only the class definition but not
14
   the categories.  unclaimed-category-1a.m contains only the
15
   categories of the class, but not the class itself.  We want to
16
   check that the runtime can load the class from one module (file)
17
   and the categories from another module (file).  */
18
 
19
#include "unclaimed-category-1.h"
20
 
21
@implementation TestClass
22
- (int)D
23
{
24
  return 4;
25
}
26
#ifdef __NEXT_RUNTIME__                                   
27
+ initialize { return self; }
28
#endif
29
@end
30
 
31
 
32
int main (void)
33
{
34
  TestClass *test;
35
  Class testClass;
36
 
37
  testClass = objc_get_class ("TestClass");
38
  if (testClass == Nil)
39
    {
40
      abort ();
41
    }
42
 
43
  test = (TestClass *)(class_create_instance (testClass));
44
  if (test == nil)
45
    {
46
      abort ();
47
    }
48
 
49
  if ([test A] != 1)
50
    {
51
      abort ();
52
    }
53
 
54
  if ([test B] != 2)
55
    {
56
      abort ();
57
    }
58
 
59
  if ([test C] != 3)
60
    {
61
      abort ();
62
    }
63
 
64
 
65
  if ([test D] != 4)
66
    {
67
      abort ();
68
    }
69
 
70
  return 0;
71
}

powered by: WebSVN 2.1.0

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