2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / objc / execute / enumeration-1.m
blobe0b784f98879b3efd83c68de7032c430be99b198
1 /* Contributed by Nicola Pero -  Wed Dec  5 17:12:40 GMT 2001 */
2 #include <objc/objc.h>
3 #include <objc/Object.h>
5 /* Test using a bitfield enumeration ivar.  */
7 typedef enum
9   black,
10   white
11 } color;
13 @interface TestClass: Object
15   color c:2;
17 - (color)color;
18 - (void)setColor: (color)a;
19 @end
21 @implementation TestClass
22 - (color)color
24   return c;
26 - (void)setColor: (color)a
28   c = a;
30 @end
33 int main (void)
35   TestClass *c;
36   
37   c = [TestClass new];
38   
39   [c setColor: black];
40   [c setColor: white];
41   [c setColor: black];
42   if ([c color] != black)
43     {
44       abort ();
45     }
46   
48   return 0;