package school_project;

import org.junit.jupiter.api.Test;
import school_project.Utils.Array;

import java.util.Arrays;

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

class ShapeTest {

    @Test
    void setShape() {
        boolean[][] matrix_shape1 = {
                {true, false},
                {true, true},
                {true, false}
        };
        boolean[][] matrix_shape2 = {
                {true, false, true},
                {true, true, true},
                {true, false, true},
        };
        boolean[][] matrix_shape3 = {
                {true, false, true},
                {true, true}
        };

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

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

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

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

        boolean[][] matrix_shape6_result = {
                {true},
        };

        System.out.println(Array.isRowOnlyFalse(matrix_shape1, 0));
        Shape shape1 = new Shape();
        shape1.setShape(matrix_shape1);
        assertEquals(3, shape1.getHeight());
        assertEquals(2, shape1.getWidth());

        Shape shape2 = new Shape(matrix_shape2);
        assertEquals(3, shape2.getHeight());
        assertEquals(3, shape2.getWidth());

        assertThrows(IllegalArgumentException.class, () -> new Shape(matrix_shape3));

        Shape shape4 = new Shape(matrix_shape4);
        assertEquals(3, shape4.getHeight());
        assertEquals(1, shape4.getWidth());

        Shape shape5 = new Shape(matrix_shape5);
        assertArrayEquals(matrix_shape5_result, shape5.getShape());

        Shape shape6 = new Shape(matrix_shape6);
        assertArrayEquals(matrix_shape6_result, shape6.getShape());

    }
}