Skip to content

Commit bf3de41

Browse files
add tests
1 parent c75c8dc commit bf3de41

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

test/runtests.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ for (mod, mod_name) ∈ ((x -> x, "exact"), (LSR1Model, "lsr1"), (LBFGSModel, "l
4545
@test length(out.solution) == bpdn.meta.nvar
4646
@test typeof(out.dual_feas) == eltype(out.solution)
4747
@test out.status == :first_order
48+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
4849

4950
out = solver(mod(bpdn), h, args..., options, x0 = x0, atol_decr = 0.0, rtol_decr = 0.0, atol_step = 1e-6, rtol_step = 1e-6)
5051
@test typeof(out.solution) == typeof(bpdn.meta.x0)
5152
@test length(out.solution) == bpdn.meta.nvar
5253
@test typeof(out.dual_feas) == eltype(out.solution)
5354
@test out.status == :first_order
55+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
5456
end
5557
end
5658
end
@@ -77,12 +79,14 @@ for (mod, mod_name) ∈ ((SpectralGradientModel, "spg"),)
7779
@test length(out.solution) == bpdn.meta.nvar
7880
@test typeof(out.dual_feas) == eltype(out.solution)
7981
@test out.status == :first_order
82+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
8083

8184
out = TRDH(mod(bpdn), h, χ, options, x0 = x0, atol_decr = 0.0, rtol_decr = 0.0, atol_step = 1e-6, rtol_step = 1e-6)
8285
@test typeof(out.solution) == typeof(bpdn.meta.x0)
8386
@test length(out.solution) == bpdn.meta.nvar
8487
@test typeof(out.dual_feas) == eltype(out.solution)
8588
@test out.status == :first_order
89+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
8690
end
8791
end
8892
end
@@ -107,12 +111,14 @@ for (mod, mod_name) ∈ ((LSR1Model, "lsr1"), (LBFGSModel, "lbfgs"))
107111
@test length(TR_out.solution) == bpdn.meta.nvar
108112
@test typeof(TR_out.dual_feas) == eltype(TR_out.solution)
109113
@test TR_out.status == :first_order
114+
@test TR_out.step_status == (TR_out.iter > 0 ? :accepted : :unknown)
110115

111116
TR_out = TR(mod(bpdn), h, NormL2(1.0), options, x0 = x0, atol_decr = 0.0, rtol_decr = 0.0, atol_step = 1e-6, rtol_step = 1e-6)
112117
@test typeof(TR_out.solution) == typeof(bpdn.meta.x0)
113118
@test length(TR_out.solution) == bpdn.meta.nvar
114119
@test typeof(TR_out.dual_feas) == eltype(TR_out.solution)
115120
@test TR_out.status == :first_order
121+
@test TR_out.step_status == (TR_out.iter > 0 ? :accepted : :unknown)
116122
end
117123
end
118124
end
@@ -140,12 +146,14 @@ for (h, h_name) ∈ ((NormL0(λ), "l0"), (NormL1(λ), "l1"), (IndBallL0(10 * com
140146
@test length(out.solution) == bpdn.meta.nvar
141147
@test typeof(out.dual_feas) == eltype(out.solution)
142148
@test out.status == :first_order
149+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
143150

144151
out = solver(bpdn_nls, h, args..., options, x0 = x0, atol_decr = 0.0, rtol_decr = 0.0, atol_step = 1e-6, rtol_step = 1e-6)
145152
@test typeof(out.solution) == typeof(bpdn.meta.x0)
146153
@test length(out.solution) == bpdn.meta.nvar
147154
@test typeof(out.dual_feas) == eltype(out.solution)
148155
@test out.status == :first_order
156+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
149157
end
150158
end
151159
end
@@ -194,13 +202,14 @@ for (mod, mod_name) ∈ (
194202
@test length(out.solution) == bpdn.meta.nvar
195203
@test typeof(out.dual_feas) == eltype(out.solution)
196204
@test out.status == :first_order
205+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
197206

198207
out = solver(mod(bpdn), h, options, x0 = x0, atol_decr = 0.0, rtol_decr = 0.0, atol_step = 1e-6, rtol_step = 1e-6)
199208
@test typeof(out.solution) == typeof(bpdn.meta.x0)
200209
@test length(out.solution) == bpdn.meta.nvar
201210
@test typeof(out.dual_feas) == eltype(out.solution)
202211
@test out.status == :first_order
203-
212+
@test out.step_status == (out.iter > 0 ? :accepted : :unknown)
204213
end
205214
end
206215
end

0 commit comments

Comments
 (0)