Skip to content

Commit 6042ed5

Browse files
committed
Add testset to Bridges.runtests
1 parent c611a46 commit 6042ed5

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/Bridges/Bridges.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function _test_structural_identical(
161161
# To check that the constraints, we need to first cache all of the
162162
# constraints in `a`.
163163
constraints = Dict{Any,Any}()
164-
for (F, S) in MOI.get(a, MOI.ListOfConstraintTypesPresent())
164+
Test.@testset "$F-in-$S" for (F, S) in MOI.get(a, MOI.ListOfConstraintTypesPresent())
165165
Test.@test MOI.supports_constraint(a, F, S)
166166
constraints[(F, S)] =
167167
map(MOI.get(a, MOI.ListOfConstraintIndices{F,S}())) do ci
@@ -175,11 +175,11 @@ function _test_structural_identical(
175175
b_constraint_types = MOI.get(b, MOI.ListOfConstraintTypesPresent())
176176
# There may be constraint types reported in `a` that are not in `b`, but
177177
# have zero constraints in `a`.
178-
for (F, S) in keys(constraints)
178+
Test.@testset "$F-in-$S" for (F, S) in keys(constraints)
179179
attr = MOI.NumberOfConstraints{F,S}()
180180
Test.@test (F, S) in b_constraint_types || MOI.get(a, attr) == 0
181181
end
182-
for (F, S) in b_constraint_types
182+
Test.@testset "$F-in-$S" for (F, S) in b_constraint_types
183183
Test.@test haskey(constraints, (F, S))
184184
# Check that the same number of constraints are present
185185
attr = MOI.NumberOfConstraints{F,S}()
@@ -207,7 +207,7 @@ function _test_structural_identical(
207207
a_attrs = MOI.get(a, MOI.ListOfModelAttributesSet())
208208
b_attrs = MOI.get(b, MOI.ListOfModelAttributesSet())
209209
Test.@test length(a_attrs) == length(b_attrs)
210-
for attr in b_attrs
210+
Test.@testset "$attr" for attr in b_attrs
211211
Test.@test attr in a_attrs
212212
if attr == MOI.ObjectiveSense()
213213
# map_indices isn't defined for `OptimizationSense`
@@ -293,11 +293,19 @@ function runtests(
293293
# Load a non-bridged input model, and check that getters are the same.
294294
test = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{eltype}())
295295
input_fn(test)
296-
_test_structural_identical(test, model; cannot_unbridge = cannot_unbridge)
296+
Test.@testset "Outer model" begin
297+
_test_structural_identical(
298+
test,
299+
model;
300+
cannot_unbridge = cannot_unbridge,
301+
)
302+
end
297303
# Load a bridged target model, and check that getters are the same.
298304
target = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{eltype}())
299305
output_fn(target)
300-
_test_structural_identical(target, inner)
306+
Test.@testset "Inner model" begin
307+
_test_structural_identical(target, inner)
308+
end
301309
# Test VariablePrimalStart
302310
attr = MOI.VariablePrimalStart()
303311
bridge_supported = all(values(Variable.bridges(model))) do bridge

0 commit comments

Comments
 (0)