def test_mat_inv_1():
    a = [[0, 1, 1, 1, 1], [1, 0, 1, 1, 1], [1, 1, 2, 1, 0], [1, 1, 1, 1, 0],
         [0, 1, 0, 1, 2]]
    assert calc.mat_inverse(a) == [[-2, 0, 1, 0, 1], [-1, -1, 1, 0, 1],
                                   [0, 0, 1, -1, 0], [3, 1, -3, 2, -2],
                                   [-1, 0, 1, -1, 1]]
def test_mat_adj_1():
    a = [[-3, 2, 0], [1, -1, 2], [-2, 1, 3]]
    assert calc.mat_adjugate(a) == [[-5, -6, 4], [-7, -9, 6], [-1, -1, 1]]
def test_mat_adj_2():
    a = [[1, -3, 0, -2], [3, -12, -2, -6], [-2, 10, 2, 5], [-1, 6, 1, 3]]
    assert calc.mat_adjugate(a) == [[0, -1, 0, -2], [-1, 1, 2, -2],
                                    [0, -1, -3, 3], [2, -2, -3, 2]]
def test_mat_det_1():
    a = [[3, 76, 5], [8, 105, 5], [-2, 3, 3]]
    assert calc.mat_determinant(a) == -514
def test_mat_det_2():
    a = [[9, 1, 2, 7, 1], [1, 2, 5, 6, 2], [0, 8, 0, 9, 3], [2, -3, 4, 2, -2],
         [4, 3, 2, 0, 5]]
    assert calc.mat_determinant(a) == 2349
def test_mat_sum_2():
    a = [[0, 0, 0], [-1, -1, -1]]
    b = [[3, 4, 5], [-1, -1, -1]]
    assert calc.mat_sum(a, b) == [[3, 4, 5], [-2, -2, -2]]
def test_mat_cols_2():
    a = [[0, 1, 1, 1, 1], [1, 0, 1, 1, 1], [1, 1, 2, 1, 0], [1, 1, 1, 1, 0],
         [1, 1, 1, 1, 0]]
    assert calc.get_cols(a, [3, 4]) == [[1, 1, 1, 1, 1], [1, 1, 0, 0, 0]]
def test_mat_sum_1():
    a = [[-5, 8], [-0.5, 8]]
    b = [[5, 8], [15, 2.4]]
    assert calc.mat_sum(a, b) == [[0, 16], [14.5, 10.4]]
def test_mat_mult_2():
    a = [[5, 3, -4, -2], [8, -1, 0, -3]]
    b = [[1, 4, 0], [-5, 3, 7], [0, -9, 5], [5, 1, 4]]
    assert calc.mat_mult(a, b) == [[-20, 63, -7], [-2, 26, -19]]
def test_mat_scalar_mult_2():
    a = 4
    b = [[25, 18, -95, 2.4, -10.7]]
    assert calc.mat_scalar_mult(a, b) == [[100, 72, -380, 9.6, -42.8]]
def test_mat_mult_1():
    a = [[3, 2, 3, 2], [11, 10, -5, 7], [-2, 2, 8, 8], [1, 3, 3, 5]]
    b = [[9, 1, 2, 7], [1, 2, 5, 6], [0, 8, 0, 9], [2, -3, 4, 2]]
    assert calc.mat_mult(a, b) == [[33, 25, 24, 64], [123, -30, 100, 106],
                                   [0, 42, 38, 86], [22, 16, 37, 62]]
def test_mat_scalar_mult_1():
    a = -0.8
    b = [[5, 8, -9], [15, 2.4, 10]]
    assert calc.mat_scalar_mult(a, b) == [[-4, -6.4, 7.2], [-12, -1.92, -8]]
def test_cut_mat_2():
    a = [[0, 1, 1, 1, 1], [1, 0, 1, 1, 1], [1, 1, 2, 1, 0], [1, 1, 1, 1, 0],
         [1, 1, 1, 1, 0]]
    assert calc.cut_matrix(a, 0, 1) == [[0], [1], [1], [1], [1]]
def test_cut_mat_1():
    a = [[1, 2, 1, 1, 0, 4, 8, 3, -2], [1, -1, 2, 2, 1, 7, 5, 2, 3],
         [0, 1, 0, 1, 2, 4, 4, 5, 4], [3, 4, 5, 2, 5, 6, 2, 1, 2]]
    assert calc.cut_matrix(a, 3, 4) == [[1, 0, 4, 8], [2, 1, 7, 5],
                                        [1, 2, 4, 4], [2, 5, 6, 2]]
def test_mat_inv_2():
    a = [[1, 2, 1], [1, -1, 2], [0, 1, 0]]
    assert calc.mat_inverse(a) == [[2, -1, -5], [0, 0, 1], [-1, 1, 3]]
def test_mat_transp_1():
    a = [[3, 76, 5, 3], [8, 105, 5, 4], [-2, 3, 3, 5], [5, 2.5, 3, 6]]
    assert calc.mat_transpose(a) == [[3, 8, -2, 5], [76, 105, 3, 2.5],
                                     [5, 5, 3, 3], [3, 4, 5, 6]]
def test_mat_rows_1():
    a = [[1, 2, 1], [1, -1, 2], [0, 1, 0]]
    assert calc.get_rows(a, [1, 0]) == [[1, -1, 2], [1, 2, 1]]
def test_mat_transp_2():
    a = [[3, 76, 5], [8, 105, 5], [-2, 3, 3], [59, 7, 5], [5, 1, -1],
         [0, 2, 0]]
    assert calc.mat_transpose(a) == [[3, 8, -2, 59, 5,
                                      0], [76, 105, 3, 7, 1, 2],
                                     [5, 5, 3, 5, -1, 0]]
def test_mat_rows_2():
    a = [[0, 1, 1, 1, 1], [1, 0, 1, 1, 1], [1, 1, 2, 1, 0], [1, 1, 1, 1, 0],
         [1, 1, 1, 1, 0]]
    assert calc.get_rows(a, [0, 3, 4]) == [[0, 1, 1, 1, 1], [1, 1, 1, 1, 0]]
def test_mat_cols_1():
    a = [[1, 2, 1], [1, -1, 2], [0, 1, 0]]
    assert calc.get_cols(a, [1, 0]) == [[2, -1, 1], [1, 1, 0]]