[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / test-35.cs
1 //
2 // This test checks the !x optimization for if/while/for/do
3 //
4 class X {
5
6         static bool t = true;
7         static bool f = false;
8         static int j = 0;
9         
10         static void a ()
11         {
12                 if (!t)
13                         j = 1;
14         }
15
16         static void w (int x)
17         {
18                 System.Console.WriteLine (" " + x);
19         }
20         
21         public static int Main ()
22         {
23                 int ok = 0, error = 0;
24                 
25                 if (!f)
26                         ok = 1;
27                 else
28                         error++;
29
30                 w (1);
31                 if (f)
32                         error++;
33                 else
34                         ok |= 2;
35
36                 w(2);
37                 if (t)
38                         ok |= 4;
39                 else
40                         error++;
41
42                 if (!t)
43                         error++;
44                 else
45                         ok |= 8;
46
47                 if (!(t && f == false))
48                         error++;
49                 else
50                         ok |= 16;
51
52                 int i = 0;
53                 w(3);
54                 do {
55                         i++;
56                 } while (!(i > 5));
57                 if (i != 6)
58                         error ++;
59                 else
60                         ok |= 32;
61                 
62                 w(100);
63                 System.Console.WriteLine ("Value: " + t);
64                 do {
65                         i++;
66                 } while (!t);
67                 
68                 System.Console.WriteLine ("Ok=" + ok + " Errors=" + error);
69                 return ((ok == 63) && (error == 0)) ? 0 : 1;
70         }
71 }