Skip to content

Commit

Permalink
Add some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 24, 2024
1 parent 8ed7e5e commit e2903d2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/flint/fmpz_mat-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ end
@test is_hadamard(hadamard(S))
end

@testset "ZZMatrix.hadamard_bound2" begin
A = matrix(ZZ, [1 2; 3 4])
@test hadamard_bound2(A) == (1^2+2^2)*(3^2+4^2)
end

@testset "ZZMatrix.fflu" begin
for iters = 1:100
m = rand(0:20)
Expand Down Expand Up @@ -873,3 +878,35 @@ end
@test prod_diagonal(A) == ZZ(12)
@test prod_diagonal(zero_matrix(ZZ, 0, 0)) == ZZ(1)
end

@testset "ZZMatrix.add_row!" begin
A = ZZ[2 3 5; 4 6 3]

add_row!(A, ZZ(0), 1, 1)
@test A == ZZ[2 3 5; 4 6 3]

add_row!(A, ZZ(-1), 1, 1)
@test Nemo.is_zero_row(A, 1)

add_row!(A, ZZ(3), 1, 2)
@test A == ZZ[12 18 9; 4 6 3]

@test A == ZZ[1 0; 0 0]
@test_throws BoundsError Generic.add_one!(A, 3, 1)
end

@testset "ZZMatrix.add_column!" begin
A = ZZ[2 3 5; 4 6 3]

add_column!(A, ZZ(0), 1, 1)
@test A == ZZ[2 3 5; 4 6 3]

add_column!(A, ZZ(-1), 1, 1)
@test Nemo.is_zero_column(A, 1)

add_column!(A, ZZ(3), 1, 2)
@test A == ZZ[9 3 5; 18 6 3]

@test A == ZZ[1 0; 0 0]
@test_throws BoundsError Generic.add_one!(A, 3, 1)
end

0 comments on commit e2903d2

Please sign in to comment.