Skip to content

Commit

Permalink
[FileFormats.LP] fix reading "Integer" section (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jan 12, 2023
1 parent 31bad70 commit 8b8c616
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/FileFormats/LP/LP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ const _KEYWORDS = Dict(
"gen" => _KW_INTEGER,
"general" => _KW_INTEGER,
"generals" => _KW_INTEGER,
"integer" => _KW_INTEGER,
"integers" => _KW_INTEGER,
# _KW_BINARY
"bin" => _KW_BINARY,
"binary" => _KW_BINARY,
Expand Down
16 changes: 16 additions & 0 deletions test/FileFormats/LP/LP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,22 @@ function test_free_variables_reading()
return
end

function test_integer_variables_reading()
for case in ["general", "GeneRalS", "Integer", "InTegeRs"]
io = IOBuffer()
write(io, "Minimize\nobj: x\nsubject to\n$case\nx\nEnd")
seekstart(io)
model = MOI.FileFormats.LP.Model()
read!(io, model)
out = IOBuffer()
write(out, model)
seekstart(out)
file = read(out, String)
@test occursin("General\nx\nEnd", file)
end
return
end

function test_quadratic_objective_diag()
model = LP.Model()
MOI.Utilities.loadfromstring!(
Expand Down

0 comments on commit 8b8c616

Please sign in to comment.