public void TestBinaryIntExist() { BinaryTreeSeach<int> tree = new BinaryTreeSeach<int>(); CompareInterface<int> comparator = new CompareInt(); tree.InsertElement(1, comparator); Assert.IsTrue(tree.ElementExist(1, comparator)); }
public void EnumeratorTestInt2() { BinaryTreeSeach<int> tree = new BinaryTreeSeach<int>(); CompareInterface<int> comparator = new CompareInt(); int count = 0; foreach (int i in tree) { ++count; } Assert.AreEqual(0, count); }
public void EnumeratorTestInt() { BinaryTreeSeach<int> tree = new BinaryTreeSeach<int>(); CompareInterface<int> comparator = new CompareInt(); tree.InsertElement(1, comparator); tree.InsertElement(2, comparator); int count = 0; foreach (int i in tree) ++count; Assert.AreEqual(2, count); }
public void TestInt() { BubbleSort<int> sortClass = new BubbleSort<int>(); CompareInterface<int> comparator = new CompareInt(); int[] array = new int[3]; for (int i = 0; i < 3; ++i) { array[i] = i; } sortClass.BubbleSortFunction(comparator, ref array, 3); Assert.AreEqual(array[0], 2); Assert.AreEqual(array[1], 1); Assert.AreEqual(array[2], 0); }
public void TestBinaryIntIsInsert() { BinaryTreeSeach<int> tree = new BinaryTreeSeach<int>(); CompareInterface<int> comparator = new CompareInt(); tree.InsertElement(1, comparator); Assert.IsFalse(tree.IsEmpty()); }
public void TestCompareInt(SortType sortDirection, int[] intArray) { Console.WriteLine("Testing Compare Int"); CompareInt ci; if (sortDirection == SortType.Ascending) { ci = new CompareInt(AscendOrder); } else { ci = new CompareInt(DescendOrder); } ci(intArray[0], intArray[1]); Console.ReadKey(); }