Skip to content

Commit a9d7b78

Browse files
committed
Update
1 parent a1b795d commit a9d7b78

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

test/FileFormats/MPS/MPS.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,39 @@ function test_qcmatrix_read_cplex()
14511451
return
14521452
end
14531453

1454+
function test_model_Name()
1455+
model = MPS.Model()
1456+
MOI.set(model, MOI.Name(), "TestFoo")
1457+
io = IOBuffer()
1458+
write(io, model)
1459+
seekstart(io)
1460+
contents = read(io, String)
1461+
@test occursin("NAME TestFoo", contents)
1462+
return
1463+
end
1464+
1465+
function test_model_large_integer()
1466+
model = MPS.Model()
1467+
x = MOI.add_constrained_variable(model, MOI.GreaterThan(123.0))
1468+
io = IOBuffer()
1469+
write(io, model)
1470+
seekstart(io)
1471+
contents = read(io, String)
1472+
@test occursin("LO bounds x1 123", contents)
1473+
return
1474+
end
1475+
1476+
function test_model_not_empty()
1477+
model = MPS.Model()
1478+
x = MOI.add_variable(model)
1479+
io = IOBuffer()
1480+
@test_throws(
1481+
ErrorException("Cannot read in file because model is not empty."),
1482+
read!(io, model),
1483+
)
1484+
return
1485+
end
1486+
14541487
end # TestMPS
14551488

14561489
TestMPS.runtests()

test/FileFormats/MPS/free_integer.mps

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
* A model with blank lines and comments
12
NAME
3+
24
OBJSENSE MIN
5+
36
ROWS
47
N obj
58
G con1
9+
610
COLUMNS
711
MARKER 'MARKER' 'INTORG'
812
x obj 1 con1 1

0 commit comments

Comments
 (0)