@@ -16,20 +16,21 @@ function consistent_nlps(
16
16
nlps;
17
17
exclude = [jth_hess, jth_hess_coord, jth_hprod, ghjvprod],
18
18
linear_api = false ,
19
+ reimplemented = [],
19
20
test_meta = true ,
20
21
test_slack = true ,
21
22
test_qn = true ,
22
23
test_derivative = true ,
23
24
rtol = 1.0e-8 ,
24
25
)
25
- consistent_counters (nlps, linear_api = linear_api)
26
+ consistent_counters (nlps, linear_api = linear_api, reimplemented = reimplemented )
26
27
test_meta && consistent_meta (nlps, rtol = rtol)
27
28
consistent_functions (nlps, linear_api = linear_api, rtol = rtol, exclude = exclude)
28
- consistent_counters (nlps, linear_api = linear_api)
29
+ consistent_counters (nlps, linear_api = linear_api, reimplemented = reimplemented )
29
30
for nlp in nlps
30
31
reset! (nlp)
31
32
end
32
- consistent_counters (nlps, linear_api = linear_api)
33
+ consistent_counters (nlps, linear_api = linear_api, reimplemented = reimplemented )
33
34
if test_derivative
34
35
for nlp in nlps
35
36
@test length (gradient_check (nlp)) == 0
@@ -50,7 +51,7 @@ function consistent_nlps(
50
51
linear_api = linear_api,
51
52
exclude = [hess, hess_coord, hprod, jth_hess, jth_hess_coord, jth_hprod, ghjvprod] ∪ exclude,
52
53
)
53
- consistent_counters ([nlps; qnmodels], linear_api = linear_api)
54
+ consistent_counters ([nlps; qnmodels], linear_api = linear_api, reimplemented = reimplemented )
54
55
end
55
56
56
57
if test_slack && has_inequalities (nlps[1 ])
@@ -61,7 +62,7 @@ function consistent_nlps(
61
62
linear_api = linear_api,
62
63
exclude = [jth_hess, jth_hess_coord, jth_hprod] ∪ exclude,
63
64
)
64
- consistent_counters (slack_nlps, linear_api = linear_api)
65
+ consistent_counters (slack_nlps, linear_api = linear_api, reimplemented = reimplemented )
65
66
end
66
67
end
67
68
@@ -79,7 +80,7 @@ function consistent_meta(nlps; rtol = 1.0e-8)
79
80
end
80
81
end
81
82
82
- function consistent_counters (nlps; linear_api = false )
83
+ function consistent_counters (nlps; linear_api = false , reimplemented = String[] )
83
84
N = length (nlps)
84
85
V = zeros (Int, N)
85
86
check_fields = filter (
@@ -96,8 +97,11 @@ function consistent_counters(nlps; linear_api = false)
96
97
end
97
98
if linear_api
98
99
V = [sum_counters (nlp) for nlp in nlps]
99
- @test all (V .== V[1 ])
100
+ @test (reimplemented != []) | all (V .== V[1 ])
100
101
for field in setdiff (collect (fieldnames (Counters)), check_fields)
102
+ if any (x -> occursin (x, string (field)), reimplemented)
103
+ continue
104
+ end
101
105
V = [eval (field)(nlp) for nlp in nlps]
102
106
@testset " Field $field " begin
103
107
for i = 1 : (N - 1 )
0 commit comments