Add new test
authorMiguel de Icaza <miguel@gnome.org>
Tue, 14 Dec 2004 20:42:04 +0000 (20:42 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 14 Dec 2004 20:42:04 +0000 (20:42 -0000)
svn path=/trunk/mcs/; revision=37757

mcs/tests/2test-16.cs [new file with mode: 0644]
mcs/tests/Makefile

diff --git a/mcs/tests/2test-16.cs b/mcs/tests/2test-16.cs
new file mode 100644 (file)
index 0000000..32312cb
--- /dev/null
@@ -0,0 +1,69 @@
+using System;
+using System.Collections;
+
+public class Tester
+{
+       string[] ABC = { "A", "B", "C" };
+       // D
+       string [,] EFGH = { { "E", "F" }, { "G", "H"}};
+       // I
+       ArrayList al = new ArrayList ();
+       
+       public Tester ()
+       {
+               al.Add ("J");
+               al.Add ("K");
+       }
+       
+       public System.Collections.IEnumerator GetEnumerator()
+       {
+               foreach (string s in ABC){
+                       if (s == null)
+                               throw new Exception ();
+                       else
+                               yield return s;
+               }
+               
+               yield return "D";
+               foreach (string s in EFGH){
+                       if(s == null)
+                               throw new Exception ();
+                       else
+                               yield return s;
+               }
+               
+               yield return "I";
+               foreach (string s in al){
+                       if (s == null)
+                               throw new Exception ();
+                       else
+                               yield return s;
+               }
+               
+               yield return "L";
+       }
+}
+
+
+class Test
+{
+       public static int Main()
+       {
+               Tester tester = new Tester();
+               string [] list = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" };
+               int top = 0;
+                       
+               foreach (string s in tester){
+                       if (s != list [top]){
+                               Console.WriteLine ("Failure, got {0} expected {1}", s, list [top]);
+                               return 1;
+                       }
+                       top++;
+               }
+               if (top != list.Length){
+                       Console.WriteLine ("Failure, expected {0} got {1}", list.Length, top);
+               }
+               Console.WriteLine ("Success");
+               return 0;
+       }
+}
index 81451ac315ddf5a7a8b47ac5846a36970d949efd..cc3bb4a59bc7bdff89e7316880eba4a4202b3dd9 100644 (file)
@@ -27,7 +27,7 @@ USE_MCS_FLAGS :=
 # Martin Baulig will manually move them into TEST_SOURCES_common after merging the code into GMCS.
 # He may also move some to TEST_EXCLUDE_net_2_0 if some of the merges are inappropriate for GMCS.
 #
-NEW_TEST_SOURCES_common = xml-033 test-329
+NEW_TEST_SOURCES_common = xml-033 test-329 2test-16
 
 #
 # Please do _not_ add any tests here - all new tests should go into NEW_TEST_SOURCES_common