/// <summary> /// Test finding the index of an item in an empty array /// </summary> static void TestIndexOfEmptyDynamicArray() { OrderedIntDynamicArray array = new OrderedIntDynamicArray(); System.Console.Write("TestIndexOfEmptyDynamicArray: "); int actualIndex = array.IndexOf(42); if (actualIndex == -1) { System.Console.WriteLine("Passed"); } else { System.Console.WriteLine("FAILED!!! Expected: -1 Actual: " + actualIndex); } }
/// <summary> /// Test finding the index of an item at the back of the array /// </summary> static void TestIndexOfBackOfDynamicArray() { OrderedIntDynamicArray array = new OrderedIntDynamicArray(); array.Add(40); array.Add(41); array.Add(42); System.Console.Write("TestIndexOfBackOfDynamicArray: "); int actualIndex = array.IndexOf(42); if (actualIndex == 2) { System.Console.WriteLine("Passed"); } else { System.Console.WriteLine("FAILED!!! Expected: 2 Actual: " + actualIndex); } }