Release 0.41.92
[vala-gnome.git] / tests / enums / enums.vala
blob87bb127d03178600e6b1e80e615c8cfecb506fd1
1 using GLib;
3 enum Maman.Foo {
4 VAL2 = 2,
5 VAL3,
6 VAL5 = 5
9 enum Maman.Fooish {
10 VAL1,
11 VAL2;
13 public int something () {
14 return (int) this;
17 public const int FOO = 2;
20 class Maman.Bar : Object {
21 public void run () {
22 stdout.printf (" %d", Foo.VAL2);
24 stdout.printf (" %d", Foo.VAL3);
26 stdout.printf (" 4");
28 stdout.printf (" %d", Foo.VAL5);
31 static void test_enums_0_conversion () {
32 Foo foo = 0;
35 static void test_enum_methods_constants () {
36 Fooish x = Fooish.VAL1;
37 stdout.printf ("%d", x.something ());
38 stdout.printf ("%d", Fooish.FOO);
41 public static int main () {
42 stdout.printf ("Enum Test: 1");
44 var bar = new Bar ();
45 bar.run ();
47 stdout.printf (" 6\n");
49 test_enums_0_conversion ();
50 test_enum_methods_constants ();
52 return 0;
56 void main () {
57 Maman.Bar.main ();