@testset "Matrix algebras" begin

  @testset "Construction" begin

    M1 = matrix(FlintQQ, [ 1 1; 0 1])
    M2 = matrix(FlintQQ, [ 1 0; 1 1])
    A = matrix_algebra(FlintQQ, [ M1, M2 ])
    @test dim(A) == 4
    @test basis_matrix(A) == identity_matrix(QQ, 4)

    QG = group_algebra(FlintQQ, small_group(2, 1))
    M1 = matrix(QG, [ 1 1; 0 1])
    M2 = matrix(QG, [ 1 0; 1 1])
    A = matrix_algebra(FlintQQ, QG, [ M1, M2 ])
    @test dim(A) == 4
  end

  @testset "Radical" begin

    mats = [[0 0 0 0 0 0 0 0 0 0;
             1 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [1 0 0 0 0 0 0 0 0 0;
             0 1 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 1 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             1 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 1 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 1 0 0 0 0 0 0 0;
             0 0 0 1 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             1 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 1 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0;
             0 0 0 0 0 1 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0;
             0 0 0 0 0 1 0 0 0 0;
             0 0 0 0 0 0 1 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             1 0 0 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 1 0 0 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 1 0 0 0 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0;
             0 0 0 0 0 0 0 0 1 0],
            [0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 0 0 0;
             0 0 0 0 0 0 0 1 0 0;
             0 0 0 0 0 0 0 0 1 0;
             0 0 0 0 0 0 0 0 0 1]]

    mats2 = map(v -> matrix(FlintQQ, v), mats)
    A = matrix_algebra(FlintQQ, mats2)
    J = radical(A)
    B, = quo(A, J)
    @test dim(B) == 4
  end
end
