aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc/execute/enumeration-1.m
blob: c380291b5a1124474229a883d93334091137149a (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
/* Contributed by Nicola Pero -  Wed Dec  5 17:12:40 GMT 2001 */
#include <stdlib.h>
#import "../../objc-obj-c++-shared/TestsuiteObject.m"

/* Test using a bitfield enumeration ivar.  */

typedef enum
{
  black,
  white
} color;

@interface TestClass: TestsuiteObject
{
  color c:2;
}
- (color)color;
- (void)setColor: (color)a;
@end

@implementation TestClass
- (color)color
{
  return c;
}
- (void)setColor: (color)a
{
  c = a;
}
@end


int main (void)
{
  TestClass *c;
  
  c = [TestClass new];
  
  [c setColor: black];
  [c setColor: white];
  [c setColor: black];
  if ([c color] != black)
    {
      abort ();
    }
  

  return 0;
}