Add mote tests, bug #82563
[mono.git] / mcs / tests / test-580.cs
1 using System;
2
3 public class Bla {
4         
5         public static void BuildNode (ref string label)
6         {
7                 string s = "a";
8                 label += s + s + s + s;
9         }
10         
11         public static void BuildNode (ref string[] label)
12         {
13                 string s = "a";
14                 int idx = 0;
15                 label[idx++] += s + s + s + s;
16         }
17         
18         public static void BuildNode_B (ref object label)
19         {
20                 string s = "b";
21                 label += s + s;
22         }
23         
24         public static string BuildNode_C (ref string label)
25         {
26                 string[] a = new string [2];
27                 int i = 0;
28                 a [0] = "a";
29                 string s = "b";
30
31                 a [i++] += label + s + s + s;
32                 return a [i - 1];
33         }
34         
35         public static string BuildNode_D ()
36         {
37                 System.Collections.ArrayList values = new System.Collections.ArrayList ();
38                 for (int i = 0; i < 6; i++)
39                         values.Add (i);
40                 string[] strs = new string [values.Count];
41                 int idx = 0;
42                 foreach (int val in values) {
43                         strs [idx] = "Value:";
44                         strs [idx++] += val.ToString ();
45                 }
46                 
47                 return strs [5];
48         }
49         
50         public static void BuildNode_E (ref string[,] label)
51         {
52                 string s = "a";
53                 int idx = 0;
54                 label = new string [1, 1];
55                 label[idx++, idx - 1] += s + s + s + s;
56         }
57         
58         public static int Main ()
59         {
60                 String str = "test";
61                 
62                 BuildNode (ref str);
63                 Console.WriteLine (str);
64                 if (str != "testaaaa")
65                         return 1;
66                 
67                 object ostr = "test";
68                 BuildNode_B (ref ostr);
69                 Console.WriteLine (ostr);
70                 if (ostr.ToString () != "testbb")
71                         return 2;
72                 
73                 str = "test";
74                 string res = BuildNode_C (ref str);
75                 Console.WriteLine (str);
76                 if (str != "test")
77                         return 3;
78                 
79                 Console.WriteLine (res);
80                 if (res != "atestbbb")
81                         return 4;
82                 
83                 string[] sa = new string [1];
84                 BuildNode (ref sa);
85                 Console.WriteLine (sa [0]);
86                 if (sa [0] != "aaaa")
87                         return 5;
88                 
89                 str = BuildNode_D ();
90                 Console.WriteLine (str);
91                 if (str != "Value:5")
92                         return 6;
93                 
94                 string[,] sa2 = null;
95                 BuildNode_E (ref sa2);
96                 Console.WriteLine (sa2 [0, 0]);
97                 if (sa2 [0,0] != "aaaa")
98                         return 7;
99                 
100                 return 0;
101         }
102 }