|
1 | 1 | module TestPrint |
2 | 2 |
|
| 3 | +using Test |
| 4 | + |
3 | 5 | using MathOptInterface |
4 | 6 | const MOI = MathOptInterface |
5 | 7 | const MOIU = MOI.Utilities |
6 | 8 |
|
7 | | -using Test |
| 9 | +function runtests() |
| 10 | + for name in names(@__MODULE__; all = true) |
| 11 | + if startswith("$(name)", "test_") |
| 12 | + @testset "$(name)" begin |
| 13 | + getfield(@__MODULE__, name)() |
| 14 | + end |
| 15 | + end |
| 16 | + end |
| 17 | + return |
| 18 | +end |
8 | 19 |
|
9 | 20 | const LATEX = MIME("text/latex") |
10 | 21 | const PLAIN = MIME("text/plain") |
@@ -523,7 +534,7 @@ function test_nlp() |
523 | 534 | MOI.set(model, MOI.VariableName(), v[i], "x[$i]") |
524 | 535 | end |
525 | 536 | lb, ub = [25.0, 40.0], [Inf, 40.0] |
526 | | - evaluator = MOI.DeprecatedTest.HS071(true) |
| 537 | + evaluator = MOI.Test.HS071(true) |
527 | 538 | block_data = MOI.NLPBlockData(MOI.NLPBoundsPair.(lb, ub), evaluator, true) |
528 | 539 | MOI.set(model, MOI.NLPBlock(), block_data) |
529 | 540 | MOI.set(model, MOI.ObjectiveSense(), MOI.MIN_SENSE) |
@@ -573,14 +584,28 @@ function test_nlp() |
573 | 584 | return |
574 | 585 | end |
575 | 586 |
|
576 | | -function runtests() |
577 | | - for name in names(@__MODULE__; all = true) |
578 | | - if startswith("$(name)", "test_") |
579 | | - @testset "$(name)" begin |
580 | | - getfield(@__MODULE__, name)() |
581 | | - end |
582 | | - end |
583 | | - end |
| 587 | +function test_print_with_acronym() |
| 588 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface") == "MOI" |
| 589 | + @test sprint( |
| 590 | + MOIU.print_with_acronym, |
| 591 | + "MathOptInterface.MathOptInterface", |
| 592 | + ) == "MOI.MOI" |
| 593 | + @test sprint( |
| 594 | + MOIU.print_with_acronym, |
| 595 | + "MathOptInterface.Utilities.MathOptInterface", |
| 596 | + ) == "MOIU.MOI" |
| 597 | + @test sprint(MOIU.print_with_acronym, "MathOptInterfaceXXBridges") == |
| 598 | + "MOIXXBridges" |
| 599 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface.BridgesXX") == |
| 600 | + "MOIBXX" |
| 601 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Test.x") == "MOIT.x" |
| 602 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface.x.Test") == |
| 603 | + "MOI.x.Test" |
| 604 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == |
| 605 | + "MOIU.Test" |
| 606 | + @test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") == |
| 607 | + "MOIU.Test" |
| 608 | + return |
584 | 609 | end |
585 | 610 |
|
586 | 611 | end |
|
0 commit comments