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

test-named-02.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 346ebe7b1f09b650c4de2b8d2c61b61352a59507 (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
// Compiler options: -langversion:future

using System;

class A
{
	public int id;
	
	public int this [int i] {
		set { Console.WriteLine ("set= " + i); id = value; }
		get { Console.WriteLine ("get= " + i); return id; }
	}
}

struct MyPoint
{
	public MyPoint (int x, int y)
	{
		X = x;
		Y = y;
	}
	
	public int X, Y;
}

class C
{
	static decimal Foo (decimal t, decimal a)
	{
		return a;
	}
	
	static string Bar (int a = 1, string s = "2", char c = '3')
	{
		return a.ToString () + s + c;
	}

	static int Test (int a, int b)
	{
		Console.WriteLine ("{0} {1}", a, b);
		return a * 3 + b * 7;
	}
	
	public static int Main ()
	{
		int h;
		if (Foo (a : h = 9, t : 3) != 9)
			return 1;
		
		if (h != 9)
			return 2;
		
		if (Bar (a : 1, s : "x", c : '2') != "1x2")
			return 3;
		
		if (Bar (s : "x") != "1x3")
			return 4;
		
		int i = 1;
		if (Test (a: i++, b: i++) != 17)
			return 5;
		
		if (i != 3)
			return 6;
		
		i = 1;
		if (Test (b: i++, a: i++) != 13)
			return 7;
		
		A a = new A ();
		i = 5;
		a [i:i++]++;
		
		if (a.id != 1)
			return 8;
		
		if (i != 6)
			return 9;
		
		MyPoint mp = new MyPoint (y : -1, x : 5);
		if (mp.Y != -1)
			return 10;
		
		Console.WriteLine ("ok");
		return 0;
	}
}