Skip to content

Commit

Permalink
add tests for Base.show
Browse files Browse the repository at this point in the history
  • Loading branch information
alefcastelli committed Aug 24, 2023
1 parent 045cbe7 commit 7a33ec8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_BA_ABA_matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,25 @@ end
end
@test test_val
end

@testset "Test show for A, BA and ABA matrix" begin
sys = PSB.build_system(PSB.PSITestSystems, "c_sys5")

a = IncidenceMatrix(sys)
ba = BA_Matrix(sys)
aba = ABA_Matrix(sys)

for mat in [a, ba, aba]
test_value = false
try
show(@eval a);
test_value = true
catch err
if err isa Exception
test_value = false
end
end
@test test_value
end

end
15 changes: 15 additions & 0 deletions test/test_virtual_lodf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ end
@testset "Test Virtual LODF auxiliary functions" begin
sys = PSB.build_system(PSB.PSITestSystems, "c_sys5")

# test isempty when VirtualLODF is created (cache must be empty)
vlodf = VirtualLODF(sys)
@test isempty(vlodf) == true

# test eachindex and axes
@test length(eachindex(vlodf)) ==
length(axes(vlodf)[1]) * length(axes(vlodf)[2])

Expand All @@ -119,4 +121,17 @@ end
end
end
@test test_value

# test show
test_value = false
try
show(vlodf);
test_value = true
catch err
if err isa Exception
test_value = false
end
end
@test test_value

end
13 changes: 13 additions & 0 deletions test/test_virtual_ptdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,17 @@ end
@test setdiff(PNM.get_branch_ax(vptdf), PSY.get_name.(PNM.get_ac_branches(sys))) ==
String[]
@test setdiff(PNM.get_bus_ax(vptdf), PSY.get_number.(PNM.get_buses(sys))) == String[]

# test show
test_value = false
try
show(vptdf);
test_value = true
catch err
if err isa Exception
test_value = false
end
end
@test test_value

end

0 comments on commit 7a33ec8

Please sign in to comment.