package school_project;

import org.junit.jupiter.api.Test;

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

class PieceTest {

    @Test
    void rotateRight() {
        boolean[][] piece1_matrix = {
            {true, false, false},
            {false, true, false},
            {true, true, false},
        };

        boolean[][] piece1_matrix_result = {
                {true, false, true},
                {true, true, false},
                {false, false, false},
        };

        boolean[][] piece2_matrix = {
                {true},
                {false},
                {true},
        };

        boolean[][] piece2_matrix_result = {
                {true, false, true},
        };

        boolean[][] piece3_matrix_result = {
                {false, false, false},
                {false, true, true},
                {true, false, true},
        };

        Piece piece1 = new Piece(piece2_matrix);
        piece1.setShape(piece1_matrix);

        Piece piece2 = new Piece(piece2_matrix);

        Piece piece3 = new Piece(piece1_matrix);

        Piece piece4 = new Piece(piece1_matrix);

        piece1.RotateRight(1);
        assertArrayEquals(piece1_matrix_result, piece1.getShape());

        piece2.RotateRight(1);
        assertArrayEquals(piece2_matrix_result, piece2.getShape());

        piece3.RotateRight(3);
        assertArrayEquals(piece3_matrix_result, piece3.getShape());

        piece4.RotateRight(3);
        assertNotEquals(piece1_matrix_result, piece4.getShape());
    }
}