dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/tests/runtime/System/Collections Test


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/tests/runtime/System/Collections TestArrayList.cs,1.1,1.2
Date: Tue, 19 Nov 2002 00:48:16 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/Collections
In directory subversions:/tmp/cvs-serv6317/tests/runtime/System/Collections

Modified Files:
        TestArrayList.cs 
Log Message:


Add test cases for ArrayList to the test suite, fix the "ArrayList.Add"
bug, and fix up a few other test suite issues.


Index: TestArrayList.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/tests/runtime/System/Collections/TestArrayList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** TestArrayList.cs    2 Oct 2002 08:47:35 -0000       1.1
--- TestArrayList.cs    19 Nov 2002 05:48:13 -0000      1.2
***************
*** 44,57 ****
                        }
  
!       // Test running a foreach loop across a simple String array
!       public void TestIterator()
!       {
!               int i;
!               ArrayList l = new ArrayList();
! 
!               for (i=0;i<100;i++)
!               {
!                       l.Insert(i,i.ToString());
!               }
!       }
  }; // class TestArrayList
--- 44,117 ----
                        }
  
!       // Test insertion into an array list.
!       public void TestInsert()
!                       {
!                               int posn;
!                               ArrayList list = new ArrayList();
!               
!                               for(posn = 0; posn < 100; ++posn)
!                               {
!                                       AssertEquals(list.Count, posn);
!                                       list.Insert(posn / 2, posn.ToString());
!                                       AssertEquals(list.Count, posn + 1);
!                                       AssertEquals(((String)(list[posn / 
2])), posn.ToString());
!                               }
!                       }
! 
!       // Test adding to an array list.
!       public void TestAdd()
!                       {
!                               int posn;
!                               ArrayList list = new ArrayList();
!               
!                               for(posn = 0; posn < 100; ++posn)
!                               {
!                                       AssertEquals(list.Count, posn);
!                                       list.Add(posn.ToString());
!                                       AssertEquals(list.Count, posn + 1);
!                                       AssertEquals(((String)(list[posn])), 
posn.ToString());
!                               }
!                       }
! 
!       // Test clearing an array list.
!       public void TestClear()
!                       {
!                               ArrayList list = new ArrayList();
!                               int posn;
! 
!                               // Clear an empty list.
!                               AssertEquals(list.Count, 0);
!                               list.Clear();
!                               AssertEquals(list.Count, 0);
! 
!                               // Clear a list with 1 element.
!                               list.Add("element");
!                               AssertEquals(list.Count, 1);
!                               list.Clear();
!                               AssertEquals(list.Count, 0);
! 
!                               // Clear a list with 10 elements.
!                               for(posn = 0; posn < 10; ++posn)
!                               {
!                                       list.Add(posn);
!                               }
!                               AssertEquals(list.Count, 10);
!                               list.Clear();
!                               AssertEquals(list.Count, 0);
! 
!                               // Attempt to clear a read-only list.
!                               list = ArrayList.ReadOnly(list);
!                               try
!                               {
!                                       list.Clear();
! 
!                                       // We should never get here!
!                                       Fail();
!                               }
!                               catch(NotSupportedException)
!                               {
!                                       // The test was successfull if we get 
here.
!                               }
!                       }
! 
  }; // class TestArrayList





reply via email to

[Prev in Thread] Current Thread [Next in Thread]