Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Jun 11, 2024
1 parent e9bf29d commit aa6ac48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/FileFormats/NL/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function _expr_to_function(expr::Expr)
@assert Meta.isexpr(expr, :call)
f = _try_scalar_affine_function(expr)
if f !== nothing
return f
return convert(MOI.ScalarAffineFunction{Float64}, f)

Check warning on line 237 in src/FileFormats/NL/read.jl

View check run for this annotation

Codecov / codecov/patch

src/FileFormats/NL/read.jl#L235-L237

Added lines #L235 - L237 were not covered by tests
end
return MOI.ScalarNonlinearFunction(
expr.args[1],
Expand Down
8 changes: 4 additions & 4 deletions test/FileFormats/NL/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,10 @@ function test_hs071_free_constraint_nlexpr()
open(joinpath(@__DIR__, "data", "hs071_free_constraint.nl"), "r") do io
return read!(io, model)
end
@test MOI.get(model, MOI.ListOfConstraintTypesPresent()) == [
(MOI.ScalarNonlinearFunction, MOI.GreaterThan{Float64}),
(MOI.ScalarNonlinearFunction, MOI.Interval{Float64}),
]
types = MOI.get(model, MOI.ListOfConstraintTypesPresent())
@test length(types) == 2
@test (MOI.ScalarAffineFunction{Float64}, MOI.GreaterThan{Float64}) in types
@test (MOI.ScalarNonlinearFunction, MOI.Interval{Float64}) in types
for (F, S) in MOI.get(model, MOI.ListOfConstraintTypesPresent())
@test MOI.get(model, MOI.NumberOfConstraints{F,S}()) == 1
end
Expand Down

0 comments on commit aa6ac48

Please sign in to comment.