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

test-580.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e0c7dba68ad15edc3c2b72eb8c65d51e68b5c9da (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
102
using System;

public class Bla {
	
	public static void BuildNode (ref string label)
	{
		string s = "a";
		label += s + s + s + s;
	}
	
	public static void BuildNode (ref string[] label)
	{
		string s = "a";
		int idx = 0;
		label[idx++] += s + s + s + s;
	}
	
	public static void BuildNode_B (ref object label)
	{
		string s = "b";
		label += s + s;
	}
	
	public static string BuildNode_C (ref string label)
	{
		string[] a = new string [2];
		int i = 0;
		a [0] = "a";
		string s = "b";

		a [i++] += label + s + s + s;
		return a [i - 1];
	}
	
	public static string BuildNode_D ()
	{
		System.Collections.ArrayList values = new System.Collections.ArrayList ();
		for (int i = 0; i < 6; i++)
			values.Add (i);
		string[] strs = new string [values.Count];
		int idx = 0;
		foreach (int val in values) {
			strs [idx] = "Value:";
			strs [idx++] += val.ToString ();
		}
		
		return strs [5];
	}
	
	public static void BuildNode_E (ref string[,] label)
	{
		string s = "a";
		int idx = 0;
		label = new string [1, 1];
		label[idx++, idx - 1] += s + s + s + s;
	}
	
	public static int Main ()
	{
		String str = "test";
		
		BuildNode (ref str);
		Console.WriteLine (str);
		if (str != "testaaaa")
			return 1;
		
		object ostr = "test";
		BuildNode_B (ref ostr);
		Console.WriteLine (ostr);
		if (ostr.ToString () != "testbb")
			return 2;
		
		str = "test";
		string res = BuildNode_C (ref str);
		Console.WriteLine (str);
		if (str != "test")
			return 3;
		
		Console.WriteLine (res);
		if (res != "atestbbb")
			return 4;
		
		string[] sa = new string [1];
		BuildNode (ref sa);
		Console.WriteLine (sa [0]);
		if (sa [0] != "aaaa")
			return 5;
		
		str = BuildNode_D ();
		Console.WriteLine (str);
		if (str != "Value:5")
			return 6;
		
		string[,] sa2 = null;
		BuildNode_E (ref sa2);
		Console.WriteLine (sa2 [0, 0]);
		if (sa2 [0,0] != "aaaa")
			return 7;
		
		return 0;
	}
}