Skip to content

Commit

Permalink
Merge pull request #46 from JuliaManifolds/mbaran/julia-1.6-fixes
Browse files Browse the repository at this point in the history
Fixing printing tests for Julia 1.6
  • Loading branch information
mateuszbaran authored Jul 13, 2020
2 parents 80459c9 + 6603013 commit b49d40d
Showing 1 changed file with 156 additions and 70 deletions.
226 changes: 156 additions & 70 deletions test/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,69 +339,139 @@ end
@test sprint(show, ProjectedOrthonormalBasis(:gram_schmidt, ℂ)) ==
"ProjectedOrthonormalBasis(:gram_schmidt, ℂ)"

@test sprint(show, "text/plain", DiagonalizingOrthonormalBasis(Float64[1, 2, 3])) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
3-element Array{Float64,1}:
1.0
2.0
3.0"""
if VERSION >= v"1.6.0-DEV.430"
@test sprint(show, "text/plain", DiagonalizingOrthonormalBasis(Float64[1, 2, 3])) ==
"""
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
3-element Vector{Float64}:
1.0
2.0
3.0"""
else
@test sprint(show, "text/plain", DiagonalizingOrthonormalBasis(Float64[1, 2, 3])) ==
"""
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
3-element Array{Float64,1}:
1.0
2.0
3.0"""
end

M = DefaultManifold(2, 3)
x = collect(reshape(1.0:6.0, (2, 3)))
pb = get_basis(M, x, DefaultOrthonormalBasis())
@test sprint(show, "text/plain", pb) == """
DefaultOrthonormalBasis(ℝ) with 6 basis vectors:
E1 =
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Array{Float64,2}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
0.0 0.0 1.0"""
if VERSION >= v"1.6.0-DEV.430"
@test sprint(show, "text/plain", pb) == """
DefaultOrthonormalBasis(ℝ) with 6 basis vectors:
E1 =
2×3 Matrix{Float64}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Matrix{Float64}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Matrix{Float64}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Matrix{Float64}:
0.0 0.0 0.0
0.0 0.0 1.0"""
else
@test sprint(show, "text/plain", pb) == """
DefaultOrthonormalBasis(ℝ) with 6 basis vectors:
E1 =
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Array{Float64,2}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
0.0 0.0 1.0"""
end

b = DiagonalizingOrthonormalBasis(get_vectors(M, x, pb)[1])
dpb = CachedBasis(b, Float64[1, 2, 3, 4, 5, 6], get_vectors(M, x, pb))
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
and 6 basis vectors.
Basis vectors:
E1 =
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Array{Float64,2}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
0.0 0.0 1.0
Eigenvalues:
6-element Array{Float64,1}:
1.0
2.0
3.0
4.0
5.0
6.0"""
if VERSION >= v"1.6.0-DEV.430"
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
2×3 Matrix{Float64}:
1.0 0.0 0.0
0.0 0.0 0.0
and 6 basis vectors.
Basis vectors:
E1 =
2×3 Matrix{Float64}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Matrix{Float64}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Matrix{Float64}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Matrix{Float64}:
0.0 0.0 0.0
0.0 0.0 1.0
Eigenvalues:
6-element Vector{Float64}:
1.0
2.0
3.0
4.0
5.0
6.0"""
else
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
and 6 basis vectors.
Basis vectors:
E1 =
2×3 Array{Float64,2}:
1.0 0.0 0.0
0.0 0.0 0.0
E2 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
1.0 0.0 0.0
E5 =
2×3 Array{Float64,2}:
0.0 0.0 1.0
0.0 0.0 0.0
E6 =
2×3 Array{Float64,2}:
0.0 0.0 0.0
0.0 0.0 1.0
Eigenvalues:
6-element Array{Float64,1}:
1.0
2.0
3.0
4.0
5.0
6.0"""
end


M = DefaultManifold(1, 1, 1)
x = reshape(Float64[1], (1, 1, 1))
Expand All @@ -418,17 +488,33 @@ end
Float64[1],
get_vectors(M, x, pb),
)
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
1-element Array{Array{Float64,3},1}:
[1.0]
and 1 basis vector.
Basis vectors:
E1 =
1×1×1 Array{Float64,3}:
[:, :, 1] =
1.0
Eigenvalues:
1-element Array{Float64,1}:
1.0"""
if VERSION >= v"1.6.0-DEV.430"
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
1-element Vector{Array{Float64,3}}:
[1.0]
and 1 basis vector.
Basis vectors:
E1 =
1×1×1 Array{Float64,3}:
[:, :, 1] =
1.0
Eigenvalues:
1-element Vector{Float64}:
1.0"""
else
@test sprint(show, "text/plain", dpb) == """
DiagonalizingOrthonormalBasis(ℝ) with eigenvalue 0 in direction:
1-element Array{Array{Float64,3},1}:
[1.0]
and 1 basis vector.
Basis vectors:
E1 =
1×1×1 Array{Float64,3}:
[:, :, 1] =
1.0
Eigenvalues:
1-element Array{Float64,1}:
1.0"""
end
end

0 comments on commit b49d40d

Please sign in to comment.