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

test-45.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9d50a9c9420a14cb86124411c7c61c2489640178 (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
96
97
98
99
100
101
using System;

public class Blah {

	private static int[] array = {0, 1, 2, 3};

	private static int [,] bar = { {0,1}, {4,5}, {10,20} };

	static string [] names = {
		"Miguel", "Paolo", "Dietmar", "Dick", "Ravi"
	};

	public static int Main ()
	{
		int [] i = new int [4] { 0, 1, 2, 3 };

		short [,] j = new short [4,2] { {0,1}, {2,3}, {4,5}, {6,7} };
		
		ushort [] a = { 4, 5, 6, 7 };

		long [,,] m = new long [2,3,2] {{{0,1}, {2,3}, {4,5}}, {{6,7}, {8,9}, {10,11}}};

		int foo = 1;
		int [] k = new int [] { foo, foo+1, foo+4 };

	        int [,] boo = new int [,] {{foo, foo+10}, {foo+3, foo+10}};

		float [] f_array = new float [] { 1.23F, 4.5F, 6.24F };

		double [] double_arr = new double [] { 34.4567, 90.1226, 54.9823 };

		char [] c_arr = { 'A', 'B', 'C', 'M', 'R' };

		byte [] b_arr = { 0, 3, 8, 10, 21 };

		sbyte [] s_arr = { 10, 15, 30, 123 };
		
		if (a [2] != 6)
			return 1;

		if (s_arr [3] != 123)
			return 2;
		
		if (i [2] != 2)
			return 1;
		
		if (j [1,1] != 3)
			return 1;

		for (int t = 0; t < 4; ++t) {
			if (array [t] != t)
				return 1;
			
			if (a [t] != (t + 4))
				return 1;
		}

		if (bar [2,1] != 20)
			return 1;

		if (k [2] != 5)
			return 1;

		if (m [1,1,1] != 9)
			return 1;

		if (boo [0,1] != 11)
			return 1;

		if (f_array [0] != 1.23F)
			return 1;

		if (double_arr [1] != 90.1226)
			return 1;

		foreach (string s in names)
			Console.WriteLine ("Hello, " + s);

		if (names [0] != "Miguel")
			return 1;

		if (c_arr [4] != 'R')
			return 2;

		int count = 10;

		int [] x = new int [count];

		for (int idx = 0; idx < count; idx++)
			x [idx] = idx + 1;

		for (int idx = count; idx > 0; ){
			idx--;
			if (x [idx] != idx + 1)
				return 12;
		}
		Console.WriteLine ("Array initialization test okay.");
				   
		return 0;
	}
}