Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / objc / execute / class-tests-2.h
blobcc14abb4343d54a2a3d6c975564b70e883c429a6
1 /* Contributed by Nicola Pero on Tue Mar 6 23:05:53 CET 2001 */
2 #include <objc/objc.h>
3 #include <objc/objc-api.h>
4 #include <stdlib.h>
6 /*
7 * Standard Tests For Methods of Classes and Objects - abort upon
8 * failing; return normally if all is well.
9 */
11 /* Test that `class' has an instance method for the selector `selector' */
12 void test_that_class_has_instance_method (const char *class_name,
13 SEL selector)
15 Class class = objc_lookup_class (class_name);
17 if (class_get_instance_method (class, selector) == NULL)
19 printf ("test_class_has_instance_method failed\n");
20 abort ();
24 /* Test that `class' has a class method for the selector `selector' */
25 void test_that_class_has_class_method (const char *class_name,
26 SEL selector)
28 Class meta_class = objc_get_meta_class (class_name);
30 if (class_get_class_method (meta_class, selector) == NULL)
32 printf ("test_class_has_class_method failed\n");
33 abort ();
37 /* Test the accessor methods (called -state and -setState:) on the
38 object `object'. */
39 #ifdef TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD
40 void test_accessor_method (TYPE_OF_OBJECT_WITH_ACCESSOR_METHOD object,
41 int initial_state,
42 int new_state_0, int expected_result_0,
43 int new_state_1, int expected_result_1)
45 if ([object state] != initial_state)
47 printf ("test_accessor_method (initial state) failed\n");
48 abort ();
51 [object setState: new_state_0];
52 if ([object state] != expected_result_0)
54 printf ("test_accessor_method (new_state_0) failed\n");
55 abort ();
58 [object setState: new_state_1];
59 if ([object state] != expected_result_1)
61 printf ("test_accessor_method (new_state_1) failed\n");
62 abort ();
65 #endif /* CLASS_WITH_ACCESSOR_METHOD */