Skip to content

Commit

Permalink
Update Bridges.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored May 9, 2024
1 parent 9c259a6 commit 7bb5361
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Bridges/Bridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@ end
"""
runtests(
Bridge::Type{<:AbstractBridge},
input::Function,
output::Function;
input_fn::Function,
output_fn::Function;
variable_start = 1.2,
constraint_start = 1.2,
eltype = Float64,
)
Run a series of tests that check the correctness of `Bridge`.
`input` and `output` are functions such that `input(model)` and `output(model)`
loads the corresponding model into `model`.
`input_fn` and `output_fn` are functions such that `input_fn(model)`
and `output_fn(model)` load the corresponding model into `model`.
## Example
Expand All @@ -247,8 +247,8 @@ julia> MOI.Bridges.runtests(
"""
function runtests(
Bridge::Type{<:AbstractBridge},
input::Function,
output::Function;
input_fn::Function,
output_fn::Function;
variable_start = 1.2,
constraint_start = 1.2,
eltype = Float64,
Expand All @@ -257,7 +257,7 @@ function runtests(
# Load model and bridge it
inner = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{eltype}())
model = _bridged_model(Bridge{eltype}, inner)
input(model)
input_fn(model)

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L260

Added line #L260 was not covered by tests
final_touch(model)
# Should be able to call final_touch multiple times.
final_touch(model)
Expand All @@ -266,11 +266,11 @@ function runtests(
end
# Load a non-bridged input model, and check that getters are the same.
test = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{eltype}())
input(test)
input_fn(test)

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L269

Added line #L269 was not covered by tests
_test_structural_identical(test, model)
# Load a bridged target model, and check that getters are the same.
target = MOI.Utilities.UniversalFallback(MOI.Utilities.Model{eltype}())
output(target)
output_fn(target)

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L273

Added line #L273 was not covered by tests
_test_structural_identical(target, inner)
# Test VariablePrimalStart
attr = MOI.VariablePrimalStart()
Expand Down Expand Up @@ -350,13 +350,13 @@ function runtests(
Bridge::Type{<:AbstractBridge},
input::String,
output::String;
kws...,
kwargs...,
)
runtests(

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L355

Added line #L355 was not covered by tests
Bridge,
model -> MOI.Utilities.loadfromstring!(model, input),
model -> MOI.Utilities.loadfromstring!(model, output);

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L357-L358

Added lines #L357 - L358 were not covered by tests
kws...,
kwargs...,
)
return

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

View check run for this annotation

Codecov / codecov/patch

src/Bridges/Bridges.jl#L361

Added line #L361 was not covered by tests
end
Expand Down

0 comments on commit 7bb5361

Please sign in to comment.