package bagaturchess.bitboard.tests.bughouse;

import static org.junit.jupiter.api.Assertions.assertEquals;

import bagaturchess.bitboard.bughouse.BughouseMoveGen;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;

import java.util.ArrayList;

public class BughouseMoveGenTests {

    @BeforeEach
    public void setUp() {
    }

    @Test
    public void testBughouseMoveGen() {
        BughouseMoveGen moveGen = new BughouseMoveGen();
        ArrayList<String> startingBoard = moveGen.generatePossibleBughouseMovesWithPiece('B', 'w',
                "rnbqkbnr/pppppppp/3r4/4q1r1/2q5/8/PPPPPPPP/RNBQKBNR w KQkq - 1 2");

        for (String s: startingBoard) {
            System.out.println(s.substring(0, s.length()-1).trim());
        }
        assertEquals(28, startingBoard.size());


        ArrayList<String> testFilledBoard = moveGen.generatePossibleBughouseMovesWithPiece('B', 'w',
                "rnbqkbnr/pppppppp/1n1r4/4q1r1/q1q5/3b2r1/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
        assertEquals(testFilledBoard.size(), 24);

        ArrayList<String> wrongSideToMove = moveGen.generatePossibleBughouseMovesWithPiece('b', 'w',
                "rnbqkbnr/pppppppp/3r4/4q1r1/2q5/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
        assertEquals(wrongSideToMove.size(), 0);

        ArrayList<String> wrongPieceToPut = moveGen.generatePossibleBughouseMovesWithPiece('B', 'b',
                "rnbqkbnr/pppppppp/1n1r4/4q1r1/q1q5/3b2r1/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
        assertEquals(wrongPieceToPut.size(), 0);



        ArrayList<String> anotherTest = moveGen.generatePossibleBughouseMovesWithPiece('p', 'b',
                "rnbqkbnr/ppp2ppp/4p3/1B1p4/3PP3/8/PPP2PPP/RNBQK1NR b KQkq - 1 3");
        System.out.println(anotherTest);

    }
}
