Ejemplo n.º 1
0
        public void TestRemoveMinLeavesValidHeap()
        {
            List <Cell>    cellList = new List <Cell>(testPath);
            MinHeap <Cell> cellHeap = new MinHeap <Cell>(cellList);

            Debug.Log(cellHeap.ToString());
            cellHeap.RemoveMin();
            Debug.Log(cellHeap.ToString());
            Assert.IsTrue(ValidMinHeap(cellHeap));
        }
Ejemplo n.º 2
0
        public void TestRemoveMinMultipleTimes()
        {
            Cell           expectedMinCell = new Cell(new Vector3(9, 8, 0), new Vector3(10, 10, 0));
            List <Cell>    cellList        = new List <Cell>(testPath);
            MinHeap <Cell> cellHeap        = new MinHeap <Cell>(cellList);

            Debug.Log("Start heap: " + cellHeap.ToString());
            cellHeap.RemoveMin();
            Debug.Log("First RemoveMin: " + cellHeap.ToString());
            Cell minCell = cellHeap.RemoveMin();

            Debug.Log("Second RemoveMin: " + cellHeap.ToString());
            Assert.IsTrue(expectedMinCell.Equals(minCell));
        }
Ejemplo n.º 3
0
        public void TestConstructor2WithCells2()
        {
            MinHeap <Cell> cellHeap = new MinHeap <Cell>(testPath);

            Debug.Log(cellHeap.ToString());
            Assert.IsTrue(ValidMinHeap(cellHeap));
        }
Ejemplo n.º 4
0
        public void TestConstructor2Array()
        {
            int[]         testArray = { 5, 4, 7, 8, 4, 5 };
            MinHeap <int> intHeap   = new MinHeap <int>(testArray);

            Debug.Log(intHeap.ToString());
            Assert.IsTrue(ValidMinHeap(intHeap));
        }
Ejemplo n.º 5
0
        public void TestConstructor2WithCells()
        {
            MinHeap <Cell> cellHeap = new MinHeap <Cell>(testPath);

            Debug.Log(cellHeap.ToString());
            Cell minCell = new Cell(new Vector3(10, 10, 0), new Vector3(10, 10, 0));

            Assert.IsTrue(cellHeap.min.Equals(minCell));
        }