2010-05-25 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-162.cs
blob7ccb720e40c84985ef0e7b430b01cc313977c3a7
1 using System;
3 struct A
5 public int a;
6 private long b;
7 private float c;
9 public A (int foo)
11 a = foo;
12 b = 8;
13 c = 9.0F;
17 struct B
19 public int a;
22 struct C
24 public long b;
26 public C (long foo)
28 b = foo;
31 // has `this' initializer, no need to initialize fields.
32 public C (string foo)
33 : this (500)
34 { }
37 struct D
39 public int foo;
42 struct E
44 public D d;
45 public bool e;
47 public E (int foo)
49 this.e = true;
50 this.d.foo = 9;
54 struct F
56 public E e;
57 public float f;
60 class X
62 static void test_output (A x)
63 { }
65 static void test_output (B y)
66 { }
68 static void test_output (E e)
69 { }
71 static void test_output (F f)
72 { }
74 static void test1 ()
76 A x;
78 x.a = 5;
79 Console.WriteLine (x.a);
82 static void test2 ()
84 B y;
86 y.a = 5;
87 Console.WriteLine (y.a);
88 Console.WriteLine (y);
91 static void test3 ()
93 A x = new A (85);
95 Console.WriteLine (x);
98 static void test4 (A x)
100 x.a = 5;
103 static void test5 (out A x)
105 x = new A (85);
108 static void test6 (out B y)
110 y.a = 1;
113 static void test7 ()
115 E e;
116 e.e = true;
117 e.d.foo = 5;
119 test_output (e);
122 static void test8 ()
124 F f;
125 f.e.e = true;
126 f.e.d.foo = 5;
127 f.f = 3.14F;
129 test_output (f);
132 static void test9 ()
134 E e = new E (5);
135 Console.WriteLine (e.d.foo);
138 static void test10 ()
140 F f;
141 f.e = new E (10);
142 Console.WriteLine (f.e.d.foo);
143 Console.WriteLine (f.e.d);
144 f.f = 3.14F;
145 Console.WriteLine (f);
148 public static int Main ()
150 // Compilation-only test.
151 return 0;