package school_project;

import org.junit.jupiter.api.Test;

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}
        };

        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());

    }
}