@@ -8,16 +8,17 @@ module TestMOF
88
99using Test
1010
11- import JSON
11+ import JSON3
1212import JSONSchema
1313import MathOptInterface as MOI
1414
1515const MOF = MOI. FileFormats. MOF
1616
1717const TEST_MOF_FILE = " test.mof.json"
1818
19- const SCHEMA =
20- JSONSchema. Schema (JSON. parsefile (MOI. FileFormats. MOF. SCHEMA_PATH))
19+ const SCHEMA = JSONSchema. Schema (
20+ JSON3. read (read (MOI. FileFormats. MOF. SCHEMA_PATH, String), Dict{String,Any}),
21+ )
2122
2223function runtests ()
2324 for name in names (@__MODULE__ , all = true )
@@ -39,7 +40,7 @@ function _validate(filename::String)
3940 " r" ,
4041 MOI. FileFormats. AutomaticCompression (),
4142 ) do io
42- object = JSON . parse (io)
43+ object = JSON3 . read (io, Dict{String,Any} )
4344 ret = JSONSchema. validate (SCHEMA, object)
4445 if ret != = nothing
4546 error (
@@ -112,8 +113,10 @@ function test_HS071()
112113 MOI. set (model, MOI. NLPBlock (), HS071 (x))
113114 MOI. set (model, MOI. ObjectiveSense (), MOI. MIN_SENSE)
114115 MOI. write_to_file (model, TEST_MOF_FILE)
115- @test replace (read (TEST_MOF_FILE, String), ' \r ' => " " ) ==
116- replace (read (joinpath (@__DIR__ , " nlp.mof.json" ), String), ' \r ' => " " )
116+ target = read (joinpath (@__DIR__ , " nlp.mof.json" ), String)
117+ target = replace (target, r" \s " => " " )
118+ target = replace (target, " MathOptFormatModel" => " MathOptFormat Model" )
119+ @test read (TEST_MOF_FILE, String) == target
117120 _validate (TEST_MOF_FILE)
118121 return
119122end
0 commit comments