summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/special/load-category-3a.m
blob: 5ce5fac652c25d2b62f8ca37be750a989ef71eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */

/* This test is identical to load-category-2, but the classes and
   categories are created in inverted order in the modules, to test
   that you can load classes first, or categories first, and it all
   still works.  */

#include <stdio.h>
#include <stdlib.h>
#include <objc/objc.h>

#include "load-category-3.h"

@implementation TestClass2
+ load
{
  printf ("[TestClass2 +load]\n");
  /* Check superclasses/subclasses +load order.  */
  check_that_load_step_was_completed (0);
  check_that_load_step_was_not_completed (1);
  check_that_load_step_was_not_completed (2);

  /* Check that the corresponding category's +load was not done.  */
  check_that_load_step_was_not_completed (4);

  complete_load_step (1);
}
@end

@implementation TestClass3
+ load
{
  printf ("[TestClass3 +load]\n");

  /* Check superclasses/subclasses +load order.  */
  check_that_load_step_was_completed (0);
  check_that_load_step_was_completed (1);
  check_that_load_step_was_not_completed (2);

  /* Check that the corresponding category's +load was not done.  */
  check_that_load_step_was_not_completed (5);

  complete_load_step (2);
}
@end

@implementation TestClass1
+ initialize { return self; }
+ load
{
  printf ("[TestClass1 +load]\n");

  /* Check superclasses/subclasses +load order.  */
  check_that_load_step_was_not_completed (0);
  check_that_load_step_was_not_completed (1);
  check_that_load_step_was_not_completed (2);

  /* Check that the corresponding category's +load was not done.  */
  check_that_load_step_was_not_completed (3);

  complete_load_step (0);
}
@end