Exemple #1
0
        public void TestRemoveAll()
        {
            IntList list = new IntList();

            for (int j = 0; j < 1000; j++)
            {
                list.Add(j);
            }
            IntList listCopy = new IntList(list);
            IntList listOdd  = new IntList();
            IntList listEven = new IntList();

            for (int j = 0; j < 1000; j++)
            {
                if (j % 2 == 0)
                {
                    listEven.Add(j);
                }
                else
                {
                    listOdd.Add(j);
                }
            }
            list.RemoveAll(listEven);
            //Assert.AreEqual(list, listOdd);
            Assert.IsTrue(list.Equals(listOdd));
            list.RemoveAll(listOdd);
            Assert.IsTrue(list.IsEmpty());
            listCopy.RemoveAll(listOdd);
            //Assert.AreEqual(listCopy, listEven);
            Assert.IsTrue(listCopy.Equals(listEven));
            listCopy.RemoveAll(listEven);
            Assert.IsTrue(listCopy.IsEmpty());
        }
Exemple #2
0
 static public int RemoveAll(IntPtr l)
 {
     try {
         IntList self = (IntList)checkSelf(l);
         System.Predicate <System.Int32> a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         var ret = self.RemoveAll(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }