package school_project.Utils;

import org.junit.jupiter.api.Test;

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

class ArrayTest {

    @Test
    void matrixCopyOf() {
        boolean[][] a = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        boolean[][] b = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        boolean[][] c = Array.MatrixCopyOf(a);
        assertArrayEquals(a, c);
        a[1][1] = true;
        assertArrayEquals(b, c);
    }

    @Test
    void matrixRemoveRow() {
        boolean[][] a = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        boolean[][] b = new boolean[][] {
                {true, false, true},
                {true, false, true},
        };

        boolean[][] result = Array.MatrixRemoveRow(a, 1);
        assertArrayEquals(b, result);
    }

    @Test
    void matrixRemoveColumn() {
        boolean[][] a = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        boolean[][] b = new boolean[][] {
                {true, true},
                {false, false},
                {true, true},
        };

        boolean[][] result = Array.MatrixRemoveColumn(a, 1);
        assertArrayEquals(b, result);
    }

    @Test
    void isRowOnlyFalse() {
        boolean[][] a = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        assertTrue(Array.isRowOnlyFalse(a, 1));
        assertFalse(Array.isRowOnlyFalse(a, 0));
    }

    @Test
    void isColumnOnlyFalse() {
        boolean[][] a = new boolean[][] {
                {true, false, true},
                {false, false, false},
                {true, false, true},
        };
        assertTrue(Array.isColumnOnlyFalse(a, 1));
        assertFalse(Array.isColumnOnlyFalse(a, 0));
    }
}