gtk+-4.0: Change type of Gdk.Key.* constants to uint
[vala-gnome.git] / tests / enums / flags.vala
blob52b439d24c797fde621d929cb6dcf4b7516ee548
1 using GLib;
3 [Flags]
4 enum Foo {
5 VAL1,
6 VAL2,
7 VAL3
10 void main () {
11 Foo foo, bar, baz;
13 foo = (Foo.VAL1 | Foo.VAL2 | Foo.VAL3);
14 bar = (Foo.VAL1 | Foo.VAL2);
15 baz = (bar | Foo.VAL3);
17 assert (Foo.VAL1 == 1 << 0);
18 assert (Foo.VAL2 == 1 << 1);
19 assert (Foo.VAL3 == 1 << 2);
21 assert (Foo.VAL1 in bar);
22 assert ((Foo.VAL1 | Foo.VAL2) in bar);
23 assert (!(Foo.VAL3 in bar));
25 assert (Foo.VAL1 in baz);
26 assert (Foo.VAL2 in baz);
27 assert (Foo.VAL3 in baz);
29 assert (bar in foo);