@@ -215,99 +215,3 @@ should be stored in a `src/MOI_wrapper` folder and included by a
215215By convention, optimizers should not be exported and should be named
216216` PackageName.Optimizer ` . For example, ` CPLEX.Optimizer ` , ` Gurobi.Optimizer ` , and
217217` Xpress.Optimizer ` .
218-
219- ## Testing guideline
220-
221- The skeleton below can be used for the wrapper test file of a solver named
222- ` FooBar ` .
223- ``` julia
224- using Test
225-
226- using MathOptInterface
227- const MOI = MathOptInterface
228- const MOIT = MOI. Test
229- const MOIU = MOI. Utilities
230- const MOIB = MOI. Bridges
231-
232- import FooBar
233- const OPTIMIZER_CONSTRUCTOR = MOI. OptimizerWithAttributes (
234- FooBar. Optimizer, MOI. Silent () => true
235- )
236- const OPTIMIZER = MOI. instantiate (OPTIMIZER_CONSTRUCTOR)
237-
238- @testset " SolverName" begin
239- @test MOI. get (OPTIMIZER, MOI. SolverName ()) == " FooBar"
240- end
241-
242- @testset " supports_default_copy_to" begin
243- @test MOIU. supports_default_copy_to (OPTIMIZER, false )
244- # Use `@test !...` if names are not supported
245- @test MOIU. supports_default_copy_to (OPTIMIZER, true )
246- end
247-
248- const BRIDGED = MOI. instantiate (
249- OPTIMIZER_CONSTRUCTOR, with_bridge_type = Float64
250- )
251- const CONFIG = MOIT. TestConfig (atol= 1e-6 , rtol= 1e-6 )
252-
253- @testset " Unit" begin
254- # Test all the functions included in dictionary `MOI.Test.unittests`,
255- # except functions "number_threads" and "solve_qcp_edge_cases."
256- MOIT. unittest (
257- BRIDGED,
258- CONFIG,
259- [" number_threads" , " solve_qcp_edge_cases" ]
260- )
261- end
262-
263- @testset " Modification" begin
264- MOIT. modificationtest (BRIDGED, CONFIG)
265- end
266-
267- @testset " Continuous Linear" begin
268- MOIT. contlineartest (BRIDGED, CONFIG)
269- end
270-
271- @testset " Continuous Conic" begin
272- MOIT. contlineartest (BRIDGED, CONFIG)
273- end
274-
275- @testset " Integer Conic" begin
276- MOIT. intconictest (BRIDGED, CONFIG)
277- end
278- ```
279-
280- Test functions like ` MOI.Test.unittest ` and ` MOI.Test.modificationtest ` are
281- wrappers around corresponding dictionaries ` MOI.Test.unittests ` and
282- ` MOI.Test.modificationtests ` . The keys of each dictionary (strings describing
283- the test) map to functions that take two arguments: an optimizer and a
284- ` MOI.Test.TestConfig ` object. Exclude tests by passing a vector of strings
285- corresponding to the test keys you want to exclude as the third positional
286- argument to the test function (e.g., ` MOI.Test.unittest ` ).
287-
288- Print a list of all keys using ` println.(keys(MOI.Test.unittests)) `
289-
290- The optimizer ` BRIDGED ` constructed with [ ` instantiate ` ] ( @ref )
291- automatically bridges constraints that are not supported by ` OPTIMIZER `
292- using the bridges listed in [ Bridges] ( @ref ) . It is recommended for an
293- implementation of MOI to only support constraints that are natively supported
294- by the solver and let bridges transform the constraint to the appropriate form.
295- For this reason it is expected that tests may not pass if ` OPTIMIZER ` is used
296- instead of ` BRIDGED ` .
297-
298- To test that a specific problem can be solved without bridges, a specific test
299- can be run with ` OPTIMIZER ` instead of ` BRIDGED ` . For instance
300- ``` julia
301- @testset " Interval constraints" begin
302- MOIT. linear10test (OPTIMIZER, CONFIG)
303- end
304- ```
305- checks that ` OPTIMIZER ` implements support for
306- [ ` ScalarAffineFunction ` ] ( @ref ) -in-[ ` Interval ` ] ( @ref ) .
307-
308- If the wrapper does not support building the model incrementally (i.e. with
309- [ ` add_variable ` ] ( @ref ) and [ ` add_constraint ` ] ( @ref ) ),
310- then [ ` Utilities.supports_default_copy_to ` ] ( @ref ) can be replaced by
311- [ ` Utilities.supports_allocate_load ` ] ( @ref ) if appropriate (see
312- [ Implementing copy] ( @ref ) ).
313-
0 commit comments