Skip to content

Commit 1c169ec

Browse files
authored
Update test_utils.jl
1 parent 9c79bd9 commit 1c169ec

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

test/test_utils.jl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using NLPModels
2-
using ADNLPModels
31
ndef = OptimizationProblems.default_nvar
42
test_nvar = Int(round(ndef / 2))
53
meta = OptimizationProblems.meta
@@ -60,16 +58,8 @@ function test_in_place_residual(prob::Symbol, nls::AbstractNLSModel)
6058
Fx = similar(x, nls.nls_meta.nequ)
6159
pb = String(prob)
6260
if VERSION v"1.7" && !occursin("palmer", pb) && (pb != "watson") # palmer residual allocate
63-
# Prefer calling the user-provided in-place residual `F!` directly when
64-
# available — ADNLPModels.residual! may allocate internal temporaries.
65-
if hasfield(typeof(nls), Symbol("F!"))
66-
f = getfield(nls, Symbol("F!"))
67-
@allocated f(Fx, x)
68-
@test (@allocated f(Fx, x)) == 0
69-
else
70-
@allocated residual!(nls, x, Fx)
71-
@test (@allocated residual!(nls, x, Fx)) == 0
72-
end
61+
@allocated residual!(nls, x, Fx)
62+
@test (@allocated residual!(nls, x, Fx)) == 0
7363
end
7464
m = OptimizationProblems.eval(Meta.parse("get_$(prob)_nls_nequ"))()
7565
@test nls.nls_meta.nequ == m

0 commit comments

Comments
 (0)