From 757458805437446db8a99ac357c3648d319303ef Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Mon, 12 Jul 2021 17:47:01 -0300 Subject: [PATCH] Test push! errors --- test/test_lbfgs.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_lbfgs.jl b/test/test_lbfgs.jl index 4ae951a7..527772a0 100644 --- a/test/test_lbfgs.jl +++ b/test/test_lbfgs.jl @@ -204,6 +204,28 @@ function test_lbfgs() @test nallocs == 0 end + @testset "push! errors" begin + n = 100 + mem = 20 + B = LBFGSOperator(n, mem = mem) + H = InverseLBFGSOperator(n, mem = mem) + BD = LBFGSOperator(n, mem = mem, damped = true) + HD = InverseLBFGSOperator(n, mem = mem, damped = true) + s = ones(n) + y = ones(n) + g = ones(n) + Bs = zeros(n) + @test_throws ErrorException push!(B, s, y, Bs) + @test_throws ErrorException push!(H, s, y, Bs) + @test_throws ErrorException push!(HD, s, y, Bs) + @test_throws ErrorException push!(B, s, y, 1.0, g) + @test_throws ErrorException push!(BD, s, y, 1.0, g) + @test_throws ErrorException push!(H, s, y, 1.0, g) + @test_throws ErrorException push!(B, s, y, 1.0, g, Bs) + @test_throws ErrorException push!(BD, s, y, 1.0, g, Bs) + @test_throws ErrorException push!(H, s, y, 1.0, g, Bs) + end + @testset "LBFGS eigenvalues" begin n = 100 mem = 20