Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-35.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c6ed09797de6717ee5ce3947645b1ad48d470ae0 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// This test checks the !x optimization for if/while/for/do
//
class X {

	static bool t = true;
	static bool f = false;
	static int j = 0;
	
	static void a ()
	{
		if (!t)
			j = 1;
	}

	static void w (int x)
	{
		System.Console.WriteLine (" " + x);
	}
	
	public static int Main ()
	{
		int ok = 0, error = 0;
		
		if (!f)
			ok = 1;
		else
			error++;

		w (1);
		if (f)
			error++;
		else
			ok |= 2;

		w(2);
		if (t)
			ok |= 4;
		else
			error++;

		if (!t)
			error++;
		else
			ok |= 8;

		if (!(t && f == false))
			error++;
		else
			ok |= 16;

		int i = 0;
		w(3);
		do {
			i++;
		} while (!(i > 5));
		if (i != 6)
			error ++;
		else
			ok |= 32;
		
		w(100);
		System.Console.WriteLine ("Value: " + t);
		do {
			i++;
		} while (!t);
		
		System.Console.WriteLine ("Ok=" + ok + " Errors=" + error);
		return ((ok == 63) && (error == 0)) ? 0 : 1;
	}
}