4 Author: Ovidiu Predescu <ovidiu@cup.hp.com>
7 Test if the +load methods are invoked, and are invoked in the
11 #include <objc/objc.h>
12 #include <objc/Object.h>
22 static a_category_load = 0;
23 static b_category_load = 0;
25 @implementation A (Category)
29 printf("+[A(Category) load]\n");
33 printf("+load for A(Category) invoked before A's!\n");
39 @implementation B(Category)
43 printf("+[B(Category) load]\n");
47 printf ("+load for B(Category) invoked before B!\n");
57 printf("+[B load]\n");
61 printf("+load for B invoked before A's!\n");
65 if (b_category_load != 0)
67 printf("+load for B invoked after B(Category)!\n");
77 printf("+[A load]\n");
79 if (a_category_load != 0)
81 printf("+load for A(Category) invoked before A!\n");
87 printf("+load for A invoked after B!\n");
91 if (b_category_load != 0)
93 printf("+load for B(Category) invoked before A and B!\n");
101 if (a_load + b_load + a_category_load + b_category_load != 4)
103 printf("Not all +load methods invoked!\n");