Skip to content

Commit 7574588

Browse files
committed
Test push! errors
1 parent 62e6261 commit 7574588

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test_lbfgs.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,28 @@ function test_lbfgs()
204204
@test nallocs == 0
205205
end
206206

207+
@testset "push! errors" begin
208+
n = 100
209+
mem = 20
210+
B = LBFGSOperator(n, mem = mem)
211+
H = InverseLBFGSOperator(n, mem = mem)
212+
BD = LBFGSOperator(n, mem = mem, damped = true)
213+
HD = InverseLBFGSOperator(n, mem = mem, damped = true)
214+
s = ones(n)
215+
y = ones(n)
216+
g = ones(n)
217+
Bs = zeros(n)
218+
@test_throws ErrorException push!(B, s, y, Bs)
219+
@test_throws ErrorException push!(H, s, y, Bs)
220+
@test_throws ErrorException push!(HD, s, y, Bs)
221+
@test_throws ErrorException push!(B, s, y, 1.0, g)
222+
@test_throws ErrorException push!(BD, s, y, 1.0, g)
223+
@test_throws ErrorException push!(H, s, y, 1.0, g)
224+
@test_throws ErrorException push!(B, s, y, 1.0, g, Bs)
225+
@test_throws ErrorException push!(BD, s, y, 1.0, g, Bs)
226+
@test_throws ErrorException push!(H, s, y, 1.0, g, Bs)
227+
end
228+
207229
@testset "LBFGS eigenvalues" begin
208230
n = 100
209231
mem = 20

0 commit comments

Comments
 (0)