Beispiel #1
0
        public void PosicionMatriz()
        {
            var mat = MatrizFactory.MatrizString4x4();

            Assert.IsNotNull(mat.GetPosicion(1, 1));
            Assert.IsNotNull(mat.GetPosicion(1, 1).elem);
        }
Beispiel #2
0
        public void TamanioMatrizCorrecto()
        {
            var mat = MatrizFactory.MatrizObjeto1x2();

            Assert.AreEqual(2, mat.alto);
            Assert.AreEqual(1, mat.ancho);
        }
Beispiel #3
0
        public void PalabraNoEncontrada()
        {
            var mat = MatrizFactory.MatrizString();

            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "Z", "Z", "Z" });

            Assert.IsNull(res);
        }
Beispiel #4
0
        public void PrimerAparicionPalabra()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "H" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 1);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(2, 3, "H")));
        }
Beispiel #5
0
        public void ContenidoCorrectoEnMatriz()
        {
            var listado = MatrizFactory.ListaObjeto2x2();
            var mat     = new Matriz <ObjetoPrueba>(listado);

            Assert.AreEqual(mat.GetPosicion(1, 1).elem, listado[0][0]);
            Assert.AreEqual(mat.GetPosicion(1, 2).elem, listado[1][0]);
            Assert.AreEqual(mat.GetPosicion(2, 1).elem, listado[0][1]);
            Assert.AreEqual(mat.GetPosicion(2, 2).elem, listado[1][1]);
        }
Beispiel #6
0
        public void BuscarPalabraSentidoSurEste()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "I", "O", "T" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 3);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(3, 2, "I")));
            Assert.IsTrue(res.posiciones[1].Equals(new Posicion(4, 3, "O")));
            Assert.IsTrue(res.posiciones[2].Equals(new Posicion(5, 4, "T")));
        }
Beispiel #7
0
        public void PalabraEncontrada()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "J", "A", "V", "A" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 4);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(2, 2, "J")));
            Assert.IsTrue(res.posiciones[1].Equals(new Posicion(3, 3, "A")));
            Assert.IsTrue(res.posiciones[2].Equals(new Posicion(4, 4, "V")));
            Assert.IsTrue(res.posiciones[3].Equals(new Posicion(5, 5, "A")));
        }
Beispiel #8
0
        public void BuscarPalabraSentidoSurOeste()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "F", "L", "A", "R" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 4);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(5, 1, "F")));
            Assert.IsTrue(res.posiciones[1].Equals(new Posicion(4, 2, "L")));
            Assert.IsTrue(res.posiciones[2].Equals(new Posicion(3, 3, "A")));
            Assert.IsTrue(res.posiciones[3].Equals(new Posicion(2, 4, "R")));
        }
Beispiel #9
0
        public void BuscarPalabraSentidoOeste()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "E", "F", "E", "L", "E", "T" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 6);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(6, 7, "E")));
            Assert.IsTrue(res.posiciones[1].Equals(new Posicion(5, 7, "F")));
            Assert.IsTrue(res.posiciones[2].Equals(new Posicion(4, 7, "E")));
            Assert.IsTrue(res.posiciones[3].Equals(new Posicion(3, 7, "L")));
            Assert.IsTrue(res.posiciones[4].Equals(new Posicion(2, 7, "E")));
            Assert.IsTrue(res.posiciones[5].Equals(new Posicion(1, 7, "T")));
        }
Beispiel #10
0
        public void BuscarPalabraSentidoNorte()
        {
            var mat      = MatrizFactory.MatrizString();
            var buscador = new BuscadorDeObjetos <string>(mat);
            var res      = buscador.Buscar(new string[] { "M", "O", "C", "A", "I", "V" });

            Assert.IsTrue(res.encontrados);
            Assert.IsTrue(res.posiciones.Length == 6);
            Assert.IsTrue(res.posiciones[0].Equals(new Posicion(3, 6, "M")));
            Assert.IsTrue(res.posiciones[1].Equals(new Posicion(3, 5, "O")));
            Assert.IsTrue(res.posiciones[2].Equals(new Posicion(3, 4, "C")));
            Assert.IsTrue(res.posiciones[3].Equals(new Posicion(3, 3, "A")));
            Assert.IsTrue(res.posiciones[4].Equals(new Posicion(3, 2, "I")));
            Assert.IsTrue(res.posiciones[5].Equals(new Posicion(3, 1, "V")));
        }
Beispiel #11
0
        public void SiPosicionInvalidaElementoNulo()
        {
            var mat = MatrizFactory.MatrizObjeto2x2();

            Assert.IsNull(mat.GetPosicion(3, 1).elem);
        }