File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,10 @@ struct Semicontinuous{T<:Real} <: AbstractScalarSet
394394 upper:: T
395395end
396396
397+ function Semicontinuous (lower:: Real , upper:: Real )
398+ return Semicontinuous (promote (lower, upper)... )
399+ end
400+
397401function Base.:(== )(a:: Semicontinuous{T} , b:: Semicontinuous{T} ) where {T}
398402 return a. lower == b. lower && a. upper == b. upper
399403end
@@ -426,6 +430,10 @@ struct Semiinteger{T<:Real} <: AbstractScalarSet
426430 upper:: T
427431end
428432
433+ function Semiinteger (lower:: Real , upper:: Real )
434+ return Semiinteger (promote (lower, upper)... )
435+ end
436+
429437function Base.:(== )(a:: Semiinteger{T} , b:: Semiinteger{T} ) where {T}
430438 return a. lower == b. lower && a. upper == b. upper
431439end
Original file line number Diff line number Diff line change @@ -363,6 +363,19 @@ function runtests()
363363 end
364364end
365365
366+ function test_interval_promote ()
367+ for S in [MOI. Interval, MOI. Semiinteger, MOI. Semicontinuous]
368+ set = S (1.0 , π)
369+ @test set isa S{Float64}
370+ @test set. lower == 1.0
371+ @test set. upper == π
372+ set = S (big (1 ), 2 )
373+ @test set isa S{BigInt}
374+ @test set. lower == 1
375+ @test set. upper == 2
376+ end
377+ end
378+
366379end
367380
368381TestSets. runtests ()
You can’t perform that action at this time.
0 commit comments