Skip to content

[Test] improve test coverage #2666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/Bridges/Bridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,10 @@
Test.@test (F, S) in b_constraint_types || MOI.get(a, attr) == 0
end
for (F, S) in b_constraint_types
Test.@test haskey(constraints, (F, S))
# Check that the same number of constraints are present
attr = MOI.NumberOfConstraints{F,S}()
if !haskey(constraints, (F, S))
# Constraint is reported in `b`, but not in `a`. Check that there
# are no actual constraints in `b`.
Test.@test MOI.get(b, attr) == 0
continue
else
Test.@test MOI.get(a, attr) == MOI.get(b, attr)
end
Test.@test MOI.get(a, attr) == MOI.get(b, attr)
# Check that supports_constraint is implemented
Test.@test MOI.supports_constraint(b, F, S)
# Check that each function in `b` matches a function in `a`
Expand Down Expand Up @@ -402,9 +396,7 @@
MOI.delete.(model, MOI.get(model, MOI.ListOfConstraintIndices{F,S}()))
end
# * So now there should be no constraints in the problem
for (F, S) in MOI.get(inner, MOI.ListOfConstraintTypesPresent())
Test.@test MOI.get(inner, MOI.NumberOfConstraints{F,S}()) == 0
end
Test.@test isempty(MOI.get(inner, MOI.ListOfConstraintTypesPresent()))

Check warning on line 399 in src/Bridges/Bridges.jl

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L399

Added line #L399 was not covered by tests
# * And there should be the same number of variables
attr = MOI.NumberOfVariables()
Test.@test MOI.get(inner, attr) == MOI.get(model, attr)
Expand Down
3 changes: 2 additions & 1 deletion test/Bridges/Constraint/AllDifferentToCountDistinctBridge.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function test_runtests_VectorOfVariables()
y <= 3.0
z == 2.0
n == 3.0
""",
""";
print_inner_model = true,
)
return
end
Expand Down
Loading