|
1 | | -function test_only_zeros(table) |
2 | | - for (key, vals) in table |
3 | | - if !isnan(vals) |
4 | | - @test vals == 0 |
5 | | - vals != 0 && println(key) |
6 | | - end |
7 | | - end |
8 | | -end |
9 | | - |
10 | 1 | @testset "allocations" begin |
11 | 2 | @testset "allocs QPSData" begin |
12 | 3 | for problem in qp_problems_Matrix |
13 | 4 | nlp_qps = eval(Symbol(problem * "_QPSData"))() |
14 | 5 | allocs = test_allocs_nlpmodels(nlp_qps; linear_api = true, exclude = [jac_op]) |
15 | | - test_only_zeros(allocs) |
| 6 | + test_zero_allocations(allocs) |
16 | 7 | end |
17 | 8 | end |
18 | 9 |
|
19 | 10 | @testset "allocs QP_dense" begin |
20 | 11 | for problem in qp_problems_Matrix |
21 | 12 | nlp_qm_dense = eval(Symbol(problem * "_QP_dense"))() |
22 | 13 | allocs = test_allocs_nlpmodels(nlp_qm_dense; linear_api = true, exclude = [jac_op]) |
23 | | - test_only_zeros(allocs) |
| 14 | + test_zero_allocations(allocs) |
24 | 15 | end |
25 | 16 | end |
26 | 17 |
|
27 | 18 | @testset "allocs COO QPSData" begin |
28 | 19 | for problem in qp_problems_COO |
29 | 20 | nlp_qps = eval(Symbol(problem * "_QPSData"))() |
30 | 21 | allocs = test_allocs_nlpmodels(nlp_qps; linear_api = true, exclude = [jac_op]) |
31 | | - test_only_zeros(allocs) |
| 22 | + test_zero_allocations(allocs) |
32 | 23 | end |
33 | 24 | end |
34 | 25 |
|
35 | 26 | @testset "allocs COO QP" begin |
36 | 27 | for problem in qp_problems_COO |
37 | 28 | nlp_qm_dense = eval(Symbol(problem * "_QP"))() |
38 | 29 | allocs = test_allocs_nlpmodels(nlp_qm_dense; linear_api = true, exclude = [jac_op]) |
39 | | - test_only_zeros(allocs) |
| 30 | + test_zero_allocations(allocs) |
40 | 31 | end |
41 | 32 | end |
42 | 33 |
|
|
46 | 37 | x = nlp.meta.x0 |
47 | 38 | nlp_qm = QuadraticModel(nlp, x) |
48 | 39 | allocs = test_allocs_nlpmodels(nlp_qm; linear_api = true, exclude = [jac_op]) |
49 | | - test_only_zeros(allocs) |
| 40 | + test_zero_allocations(allocs) |
50 | 41 | end |
51 | 42 | end |
52 | 43 | end |
0 commit comments