Skip to content

Commit c08181c

Browse files
committed
Use test_zero_allocations from NLPModelsTest
1 parent c529415 commit c08181c

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

test/test_allocations.jl

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
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-
101
@testset "allocations" begin
112
@testset "allocs QPSData" begin
123
for problem in qp_problems_Matrix
134
nlp_qps = eval(Symbol(problem * "_QPSData"))()
145
allocs = test_allocs_nlpmodels(nlp_qps; linear_api = true, exclude = [jac_op])
15-
test_only_zeros(allocs)
6+
test_zero_allocations(allocs)
167
end
178
end
189

1910
@testset "allocs QP_dense" begin
2011
for problem in qp_problems_Matrix
2112
nlp_qm_dense = eval(Symbol(problem * "_QP_dense"))()
2213
allocs = test_allocs_nlpmodels(nlp_qm_dense; linear_api = true, exclude = [jac_op])
23-
test_only_zeros(allocs)
14+
test_zero_allocations(allocs)
2415
end
2516
end
2617

2718
@testset "allocs COO QPSData" begin
2819
for problem in qp_problems_COO
2920
nlp_qps = eval(Symbol(problem * "_QPSData"))()
3021
allocs = test_allocs_nlpmodels(nlp_qps; linear_api = true, exclude = [jac_op])
31-
test_only_zeros(allocs)
22+
test_zero_allocations(allocs)
3223
end
3324
end
3425

3526
@testset "allocs COO QP" begin
3627
for problem in qp_problems_COO
3728
nlp_qm_dense = eval(Symbol(problem * "_QP"))()
3829
allocs = test_allocs_nlpmodels(nlp_qm_dense; linear_api = true, exclude = [jac_op])
39-
test_only_zeros(allocs)
30+
test_zero_allocations(allocs)
4031
end
4132
end
4233

@@ -46,7 +37,7 @@ end
4637
x = nlp.meta.x0
4738
nlp_qm = QuadraticModel(nlp, x)
4839
allocs = test_allocs_nlpmodels(nlp_qm; linear_api = true, exclude = [jac_op])
49-
test_only_zeros(allocs)
40+
test_zero_allocations(allocs)
5041
end
5142
end
5243
end

0 commit comments

Comments
 (0)