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

test-499.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f885c89379a1b6d09f845a8c7610ae9700e3fc01 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System;

class A
{
	static int switch1 (ulong a)
	{
		switch (a) {
		case long.MaxValue - 1:
			return 1;
		case long.MaxValue + (ulong) 1:
			return 2;
		case long.MaxValue + (ulong) 2:
			return 3;
		case long.MaxValue + (ulong) 3:
			break;
		default:
			return 4;
		}

		return 5;
	}

	static int switch2 (sbyte a)
	{
		switch (a) {
		case 0:
			return 1;
		case -1:
			return 2;
		}

		return 0;
	}

	static int switch3 (long a)
	{
		switch (a) {
		case 0:
			return 1;
		case -1:
			return 2;
		}

		return 0;
	}

	static int switch4 (ulong a)
	{
		switch (a) {
		case long.MaxValue:
			goto case ulong.MaxValue;

		case ulong.MaxValue:
			return 4;
		}

		return 0;
	}

	static int switch5(ulong x)
	{
		switch (x) {
		case 0:
			break;
		default:
			return 1;
		}

		return 2;
	}

	public static int Main ()
	{
		if (switch1 (long.MaxValue + (ulong) 1) != 2)
			return 1;

		if (switch2 (-1) != 2)
			return 2;

		if (switch3 (-1) != 2)
			return 3;

		if (switch4 (ulong.MaxValue) != 4)
			return 4;

		if (switch4 (long.MaxValue) != 4)
			return 41;

		if (switch5 (0) != 2)
			return 5;

		Console.WriteLine ("1");
		return 0;
	}
}