This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / tests / 2test-1.cs
1 using System;
2 using System.Collections;
3
4 class X {
5         static IEnumerator GetIt ()
6         {
7                 yield return 1;
8                 yield return 2;
9                 yield return 3;
10         }
11         
12         static IEnumerable GetIt2 ()
13         {
14                 yield return 1;
15                 yield return 2;
16                 yield return 3;
17         }
18
19         static int Main ()
20         {
21                 IEnumerator e = GetIt ();
22                 int total = 0;
23                 
24                 while (e.MoveNext ()){
25                         Console.WriteLine ("Value=" + e.Current);
26                         total += (int) e.Current;
27                 }
28
29                 if (total != 6)
30                         return 1;
31
32                 total = 0;
33                 foreach (int i in GetIt2 ()){
34                         Console.WriteLine ("Value=" + i);
35                         total += i;
36                 }
37                 if (total != 6)
38                         return 2;
39                 
40                 return 0;
41         }
42 }