public void LargestSquareTest()
        {
            var p0 = new Tile {
                X = 5, Y = 10, Z = 10
            };
            var p1 = new Tile {
                X = 6, Y = 10, Z = 10
            };
            var p2 = new Tile {
                X = 5, Y = 11, Z = 10
            };
            var p3 = new Tile {
                X = 6, Y = 11, Z = 10
            };
            var p4 = new Tile {
                X = 5, Y = 12, Z = 10
            };
            var p5 = new Tile {
                X = 6, Y = 12, Z = 10
            };

            tiles = new List <Tile> {
                p1, p2, p3, p0, p4, p5
            };
            var res = LargestSquareCalculator.Calculate(tiles);

            Assert.IsTrue(res.Count == 2);
            Assert.IsTrue(res[0].StartTile.Equals(p2));
            Assert.IsTrue(res[1].StartTile.Equals(p0));
        }
        public void Test1()
        {
            var res = LargestSquareCalculator.Calculate(tiles);

            Assert.IsTrue(res.Count == 1);
            Assert.IsTrue(res[0].StartTile.Equals(tiles[0]));
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var p0 = new Tile {
                X = 0, Y = 0, Z = 10
            };
            var p1 = new Tile {
                X = 1, Y = 0, Z = 10
            };
            var p2 = new Tile {
                X = 1, Y = 1, Z = 10
            };
            var p3 = new Tile {
                X = 0, Y = 1, Z = 10
            };

            var tiles = new List <Tile> {
                p0, p1, p2, p3
            };

            var res = LargestSquareCalculator.Calculate(tiles);

            Console.WriteLine("Number of max squares: " + res.Count);

            Console.ReadKey();
        }
        public void LargestSquareTestMultipleValues()
        {
            var p0 = new Tile {
                X = 5, Y = 10, Z = 10
            };
            var p1 = new Tile {
                X = 6, Y = 10, Z = 10
            };
            var p2 = new Tile {
                X = 5, Y = 11, Z = 10
            };
            var p3 = new Tile {
                X = 6, Y = 11, Z = 10
            };
            var p4 = new Tile {
                X = 5, Y = 12, Z = 11
            };
            var p5 = new Tile {
                X = 6, Y = 12, Z = 11
            };
            var p6 = new Tile {
                X = 5, Y = 13, Z = 11
            };
            var p7 = new Tile {
                X = 6, Y = 13, Z = 11
            };

            tiles = new List <Tile> {
                p0, p1, p2, p3, p4, p5, p6, p7
            };
            var res = LargestSquareCalculator.Calculate(tiles);

            Assert.IsTrue(res.Count == 2);
            Assert.IsTrue(res[0].Size == 2);
            Assert.IsTrue(res[0].StartTile.Equals(p0));
        }
        public void Test3()
        {
            var res = LargestSquareCalculator.Calculate(new List <Tile>());

            Assert.IsTrue(res.Count == 0);
        }