Ejemplo n.º 1
0
            public void RemovePieceTests()
            {
                //"r3r1k1/p2b1ppp/1p1q1n2/3p4/2P5/3BRN1P/PP1Q1PP1/R5K1 w - - 0 19";
                string expandedFEN = "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R11111K1 w - - 0 19";

                // +---+---+---+---+---+---+---+---+
                // | r |   |   |   | r |   | k |   |
                // +---+---+---+---+---+---+---+---+
                // | p |   |   | b |   | p | p | p |
                // +---+---+---+---+---+---+---+---+
                // |   | p |   | q |   | n |   |   |
                // +---+---+---+---+---+---+---+---+
                // |   |   |   | p |   |   |   |   |
                // +---+---+---+---+---+---+---+---+
                // |   |   | P |   |   |   |   |   |
                // +---+---+---+---+---+---+---+---+
                // |   |   |   | B | R | N |   | P |
                // +---+---+---+---+---+---+---+---+
                // | P | P |   | Q |   | P | P |   |
                // +---+---+---+---+---+---+---+---+
                // | R |   |   |   |   |   | K |   |
                // +---+---+---+---+---+---+---+---+

                // file, rank, expectedChar, expectedFEN
                Tuple <int, int, char, string>[] testData =
                {
                    new Tuple <int, int, char, string>(1, 1, 'R', "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/111111K1 w - - 0 19"),
                    new Tuple <int, int, char, string>(2, 1, '1', "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R11111K1 w - - 0 19"),
                    new Tuple <int, int, char, string>(4, 7, 'b', "r111r1k1/p1111ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R11111K1 w - - 0 19"),
                    new Tuple <int, int, char, string>(7, 1, 'K', "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R1111111 w - - 0 19"),
                    new Tuple <int, int, char, string>(1, 4, '1', "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R11111K1 w - - 0 19"),
                    new Tuple <int, int, char, string>(8, 8, '1', "r111r1k1/p11b1ppp/1p1q1n11/111p1111/11P11111/111BRN1P/PP1Q1PP1/R11111K1 w - - 0 19"),
                };

                foreach (Tuple <int, int, char, string> tuple in testData)
                {
                    char fenChar;
                    Trace.WriteLine(String.Format("Verifying Remove @ [{0}:{1}] is '{2}', new fen is {3}", tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4));
                    string newFEN = FenParser.RemovePiece(expandedFEN, tuple.Item1, tuple.Item2, out fenChar);
                    Assert.IsTrue(String.Compare(newFEN, tuple.Item4) == 0);
                    Assert.AreEqual(fenChar, tuple.Item3);
                }
            }