public void HeapHeight_OneElemArray_Test() { Beap b = new Beap(); b.Insert(8); Assert.AreEqual(0, b.Height); }
public void FindExistingElem_OneElemArray_Test() { Beap b = new Beap(); b.Insert(5); Assert.AreEqual(true, b.Find(5)); }
public void HeapSize_OneElem_Test() { Beap b = new Beap(); b.Insert(8); Assert.AreEqual(1, b.HeapSize); }
public void DeletingElem_EmptyArray_Test() { Beap b = new Beap(); b.Delete(5); Assert.AreEqual(0, b.HeapSize); }
public void Count_OneElem_Test() { Beap b = new Beap(); b.Insert(8); Assert.AreEqual(0, b.Count(8)); }
public void MaxElem_OneElemArray_Test() { Beap b = new Beap(); b.Insert(9999); Assert.AreEqual(9999, b.Max()); }
public void MinElem_OneElemArray_Test() { Beap b = new Beap(); b.Insert(8); Assert.AreEqual(8, b.Min()); }
public void HeapHeight_FullArray_Test() { Beap b = new Beap(); b.Insert(8); b.Insert(4); b.Insert(10); b.Insert(2); Assert.AreEqual(2, b.Height); }
public void HelpMethodsTestRand() { int i = rand.Next() % (int)Math.Sqrt(Int32.MaxValue); int j = rand.Next() % (i + 1); Assert.AreEqual((i, j), Beap <int> .Index2RowCol(Beap <int> .RowCol2Index(i, j))); int k = rand.Next(); Assert.AreEqual(k, Beap <int> .RowCol2Index(Beap <int> .Index2RowCol(k).Item1, Beap <int> .Index2RowCol(k).Item2)); }
public void FindExistingElem_FullArray_Test(int toFind) { Beap b = new Beap(); b.Insert(8); b.Insert(4); b.Insert(10); b.Insert(2); b.Insert(7); Assert.AreEqual(true, b.Find(toFind)); }
public void MaxElem_FullArray_Test() { Beap b = new Beap(); b.Insert(8); b.Insert(4); b.Insert(10); b.Insert(2); b.Insert(7); Assert.AreEqual(10, b.Max()); }
public void FindAbsentElem_FullArray_Test(int toFind) { Beap b = new Beap(); b.Insert(8); b.Insert(4); b.Insert(10); b.Insert(2); b.Insert(7); Assert.AreEqual(false, b.Find(toFind)); }
public void DeletingElem_LowerRow_Test(int a) { Beap b = new Beap(); b.Insert(0); b.Insert(-1); b.Insert(1); b.Insert(2); b.Delete(a); Assert.AreEqual(3, b.HeapSize); }
public void HeapSize_AfterClear_Test() { Beap b = new Beap(); b.Insert(10); b.Insert(4); b.Insert(2); b.Insert(8); b.Clear(); Assert.AreEqual(0, b.HeapSize); }
public void DeletingElem_FullArray_Test(int toDelete) { Beap b = new Beap(); b.Insert(8); b.Insert(4); b.Insert(10); b.Insert(2); b.Insert(7); b.Delete(toDelete); Assert.AreEqual(4, b.HeapSize); }
public void Count_FullArray_Test() { Beap b = new Beap(); b.Insert(10); b.Insert(15); b.Insert(25); b.Insert(14); b.Insert(19); b.Insert(13); b.Insert(20); b.Insert(50); b.Insert(22); Assert.AreEqual(2, b.Count(14)); }
public void DeletingElem_ForHeightDecrease_Test(int a) { Beap b = new Beap(); b.Insert(10); b.Insert(15); b.Insert(14); b.Insert(25); b.Insert(13); b.Insert(19); b.Insert(20); b.Delete(a); Assert.AreEqual(6, b.HeapSize); }
public void HeapSize_Big_Insert_Test() { Beap b = new Beap(); b.Insert(10); b.Insert(15); b.Insert(25); b.Insert(14); b.Insert(19); b.Insert(13); b.Insert(20); b.Insert(50); b.Insert(22); Assert.AreEqual(9, b.HeapSize); }
public void SearchTest1() { var beap = new Beap <int>(); int[] values = new int[] { -5, 0, -45, 1, 15 }; for (int i = 0; i < values.Length; ++i) { beap.Insert(values[i]); } Assert.AreEqual(beap[beap.Search(15)], 15, "Index of 15 should be 0"); Assert.AreEqual(beap[beap.Search(0)], 0, "Index of 0 should be 1"); Assert.AreEqual(beap[beap.Search(1)], 1, "Index of 1 should be 2"); Assert.AreEqual(beap[beap.Search(-5)], -5, "Index of -5 should be 3"); Assert.AreEqual(beap[beap.Search(-45)], -45, "Index of -45 should be 4"); Assert.AreEqual(-1, beap.Search(-2), "Should not have find value -1 in beap"); }
public void DeletingElem_ForBranches_Test(int a, int q, int c, int d) { Beap b = new Beap(); b.Insert(10); b.Insert(15); b.Insert(14); b.Insert(25); b.Insert(13); b.Insert(19); b.Insert(20); b.Insert(50); b.Insert(22); b.Delete(a); b.Delete(q); b.Delete(c); b.Delete(d); Assert.AreEqual(5, b.HeapSize); }
public void MaxElem_EmptyArray_Test() { Beap b = new Beap(); Assert.AreEqual(0, b.Max()); }
public void HelpMethodsTest3() { Assert.AreEqual(3, Beap <int> .RowCol2Index(2, 0)); Assert.AreEqual((2, 0), Beap <int> .Index2RowCol(3)); }
public void HelpMethodsTest2() { Assert.AreEqual(4, Beap <int> .RowCol2Index(2, 1)); Assert.AreEqual((2, 1), Beap <int> .Index2RowCol(4)); }
public void HelpMethodsTest1() { Assert.AreEqual(5, Beap <int> .RowCol2Index(2, 2)); Assert.AreEqual((2, 2), Beap <int> .Index2RowCol(5)); }
public void HeapSize_EmptyArray_Test() { Beap b = new Beap(); Assert.AreEqual(0, b.HeapSize); }
public void Count_EmptyArray_Test() { Beap b = new Beap(); Assert.AreEqual(0, b.Count(0)); }