Skip to content

Commit a1d39de

Browse files
increase tests
1 parent ce31344 commit a1d39de

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/test_lulinv.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ using LinearAlgebra, MatrixFactorizations, Random, Test
6969
L, U = lulinv(A)
7070
@test A L*U/L
7171
@test A*L L*U
72+
end
73+
@testset "size, det, logdet, logabsdet" begin
74+
A = [4.0 3; 6 3]
7275
F = lulinv(A)
76+
@test size(A) == size(F)
77+
@test size(F, 1) == size(F, 2)
7378
@test F\A I
7479
@test A/F I
7580
@test det(A) det(F)
@@ -79,4 +84,31 @@ using LinearAlgebra, MatrixFactorizations, Random, Test
7984
@test lad lad1
8085
@test sd sd1
8186
end
87+
@testset "REPL printing" begin
88+
bf = IOBuffer()
89+
show(bf, "text/plain", lulinv([2 1; 1 2]))
90+
seekstart(bf)
91+
@test String(take!(bf)) ==
92+
"""
93+
LULinv{Float64, Matrix{Float64}}
94+
L factor:
95+
2×2 Matrix{Float64}:
96+
1.0 0.0
97+
-1.0 1.0
98+
U factor:
99+
2×2 Matrix{Float64}:
100+
1.0 1.0
101+
0.0 3.0"""
102+
end
103+
@testset "propertynames" begin
104+
names = sort!(collect(string.(Base.propertynames(lulinv([2 1; 1 2])))))
105+
@test names == ["L", "U"]
106+
allnames = sort!(collect(string.(Base.propertynames(lulinv([2 1; 1 2]), true))))
107+
@test allnames == ["L", "U", "factors"]
108+
end
109+
@testset "A::Matrix{Int64}, λ::Vector{Rational{Int64}}" begin
110+
A = [-150 334 778; -89 195 464; 5 -10 -27]
111+
F = lulinv(A, [17, -2, 3//1])
112+
@test A * F.L == F.L * F.U
113+
end
82114
end

0 commit comments

Comments
 (0)