Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-anon-96.cs
1 using System;
2
3 class P
4 {
5         public int A;
6 }
7
8 static class Program
9 {
10         static int Extra () { return 36; }
11
12         delegate int D ();
13
14         static D Get (int dummy)
15         {
16                 var p = new P { A = 6 };
17                 switch (dummy) {
18                 case 0:
19                         int extra = Extra ();
20                         return () => p.A + extra;
21                 case 1:
22                         extra = 9;
23                         return () => p.A * extra;
24                 case 2:
25                         return () => p.A * 2;
26                 }
27                 throw new NotSupportedException ();
28         }
29
30         static int Run (int i)
31         {
32                 return Get (i) ();
33         }
34
35         public static int Main ()
36         {
37                 if (Run (0) != 42)
38                         return 1;
39
40                 if (Run (1) != 54)
41                         return 2;
42
43                 if (Run (2) != 12)
44                         return 3;
45
46                 if (Run (1) != 54)
47                         return 4;
48
49                 if (Run (0) != 42)
50                         return 5;
51
52                 return 0;
53         }
54 }