4 Author: Ovidiu Predescu <ovidiu@cup.hp.com>
7 Test if the +load methods are invoked, and are invoked in the
12 #import "../../objc-obj-c++-shared/Object1.h"
13 #include <objc/objc.h>
23 static a_category_load = 0;
24 static b_category_load = 0;
26 @implementation A (Category)
30 printf("+[A(Category) load]\n");
34 printf("+load for A(Category) invoked before A's!\n");
40 @implementation B(Category)
44 printf("+[B(Category) load]\n");
48 printf ("+load for B(Category) invoked before B!\n");
58 printf("+[B load]\n");
62 printf("+load for B invoked before A's!\n");
66 if (b_category_load != 0)
68 printf("+load for B invoked after B(Category)!\n");
78 printf("+[A load]\n");
80 if (a_category_load != 0)
82 printf("+load for A(Category) invoked before A!\n");
88 printf("+load for A invoked after B!\n");
92 if (b_category_load != 0)
94 printf("+load for B(Category) invoked before A and B!\n");
102 if (a_load + b_load + a_category_load + b_category_load != 4)
104 printf("Not all +load methods invoked!\n");