Skip to content

Commit 15241f6

Browse files
committed
Add test
1 parent ee62a16 commit 15241f6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Bridges/set_map.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ function MOI.Bridges.inverse_map_set(
9898
return bridge.set
9999
end
100100

101+
# Otherwise, it fails Bridges.runtests for `NOT_INVERTIBLE`
102+
function MOI.supports(
103+
::MOI.ModelLike,
104+
::MOI.ConstraintDualStart,
105+
::Type{<:ConstraintSwapBridge},
106+
)
107+
return false
108+
end
109+
101110
const SwapBridge{T} = Union{VariableSwapBridge{T},ConstraintSwapBridge{T}}
102111

103112
function MOI.Bridges.map_function(bridge::SwapBridge, func)
@@ -214,6 +223,22 @@ function test_runtests()
214223
MOI.add_constraint(model, func, set)
215224
end,
216225
)
226+
MOI.Bridges.runtests(
227+
ConstraintSwapBridge,
228+
model -> begin
229+
x = MOI.add_variables(model, 2)
230+
func = MOI.VectorOfVariables(x)
231+
set = SwapSet(do_swap, NOT_INVERTIBLE)
232+
MOI.add_constraint(model, func, set)
233+
end,
234+
model -> begin
235+
x = MOI.add_variables(model, 2)
236+
func = MOI.VectorOfVariables(swap(x, do_swap))
237+
set = MOI.Nonnegatives(2)
238+
MOI.add_constraint(model, func, set)
239+
end,
240+
cannot_unbridge = true,
241+
)
217242
MOI.Bridges.runtests(
218243
VariableSwapBridge,
219244
model -> begin

0 commit comments

Comments
 (0)