Skip to content

Commit d6085c0

Browse files
committed
test merged models
1 parent 50a18b9 commit d6085c0

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

test/runtests.jl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Test
2-
using ADNLPModels, DifferentialEquations
1+
using LinearAlgebra, Test
2+
using ADNLPModels, DifferentialEquations, NLPModels
33
using RegularizedProblems
44

55
@testset "BPDN" begin
@@ -14,6 +14,15 @@ using RegularizedProblems
1414
@test nls_model.meta.nvar == 512
1515
@test nls_model.nls_meta.nequ == 200
1616
@test all(nls_model.meta.x0 .== 0)
17+
18+
x = fill!(similar(model.meta.x0), 1)
19+
f = obj(model, x)
20+
F = residual(nls_model, x)
21+
@test f dot(F, F) / 2
22+
23+
g = grad(model, x)
24+
JtF = jtprod_residual(nls_model, x, F)
25+
@test all(g .≈ JtF)
1726
end
1827

1928
@testset "FH" begin
@@ -28,4 +37,13 @@ end
2837
@test nls_model.meta.nvar == 5
2938
@test nls_model.nls_meta.nequ == 202
3039
@test all(nls_model.meta.x0 .== 1)
40+
41+
x = model.meta.x0
42+
f = obj(model, x)
43+
F = residual(nls_model, x)
44+
@test f dot(F, F) / 2
45+
46+
g = grad(model, x)
47+
JtF = jtprod_residual(nls_model, x, F)
48+
@test all(g .≈ JtF)
3149
end

0 commit comments

Comments
 (0)