Esempio n. 1
0
        /// <summary>
        /// Test removing an item from an empty array
        /// </summary>
        static void TestRemoveEmptyDynamicArray()
        {
            UnorderedIntDynamicArray array = new UnorderedIntDynamicArray();

            System.Console.Write("TestRemoveEmptyDynamicArray: ");
            if (!array.Remove(42))
            {
                System.Console.WriteLine("Passed");
            }
            else
            {
                System.Console.WriteLine("FAILED!!! Expected: false Actual: true");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Test removing an item in the interior of the array
        /// </summary>
        static void TestRemoveItemInteriorOfDynamicArray()
        {
            UnorderedIntDynamicArray array = new UnorderedIntDynamicArray();

            array.Add(42);
            array.Add(41);
            array.Add(40);
            System.Console.Write("TestRemoveItemInteriorOfDynamicArray: ");
            bool   removed     = array.Remove(41);
            String arrayString = array.ToString();

            if (removed &&
                arrayString.Equals("42,40") &&
                array.Count == 2)
            {
                System.Console.WriteLine("Passed");
            }
            else
            {
                System.Console.WriteLine("FAILED!!! Expected: 42,40 Actual: " + arrayString);
            }
        }