From 01e4dbfd84fc47a2dc2a3131ccd8d530150f3bfb Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 29 Jan 2021 06:15:52 +0100 Subject: [PATCH] add tests --- test/test-state/unit-test-GenericStatemod.jl | 7 +++++++ test/test-state/unit-test-NLPAtXmod.jl | 6 ++++++ test/test-stopping/test-unitaire-generic-stopping.jl | 1 + 3 files changed, 14 insertions(+) diff --git a/test/test-state/unit-test-GenericStatemod.jl b/test/test-state/unit-test-GenericStatemod.jl index a040c217..5bda6dc7 100644 --- a/test/test-state/unit-test-GenericStatemod.jl +++ b/test/test-state/unit-test-GenericStatemod.jl @@ -42,3 +42,10 @@ reinit!(state0, current_time = 0.5) @test ismissing(Main.Stopping._init_field(Missing)) @test !_init_field(typeof(true)) @test _init_field(typeof(1)) == -9223372036854775808 + +#_check_nan_miss +@test !Stopping._check_nan_miss(nothing) +@test !Stopping._check_nan_miss(Counters()) +@test !Stopping._check_nan_miss(spzeros(0)) +@test !Stopping._check_nan_miss(zeros(0)) +@test !Stopping._check_nan_miss(missing) \ No newline at end of file diff --git a/test/test-state/unit-test-NLPAtXmod.jl b/test/test-state/unit-test-NLPAtXmod.jl index ba8eea82..2b92e217 100644 --- a/test/test-state/unit-test-NLPAtXmod.jl +++ b/test/test-state/unit-test-NLPAtXmod.jl @@ -59,6 +59,12 @@ reinit!(uncons_nlp_at_x) reinit!(uncons_nlp_at_x, x = zeros(10)) @test uncons_nlp_at_x.x == zeros(10) @test isnan(uncons_nlp_at_x.fx) +reinit!(uncons_nlp_at_x, zeros(10)) +@test uncons_nlp_at_x.x == zeros(10) +@test isnan(uncons_nlp_at_x.fx) +reinit!(uncons_nlp_at_x, zeros(10), l = zeros(0)) +@test uncons_nlp_at_x.x == zeros(10) +@test isnan(uncons_nlp_at_x.fx) c_uncons_nlp_at_x = copy_compress_state(uncons_nlp_at_x, max_vector_size = 5) diff --git a/test/test-stopping/test-unitaire-generic-stopping.jl b/test/test-stopping/test-unitaire-generic-stopping.jl index d80cd9d8..5f7ee330 100644 --- a/test/test-stopping/test-unitaire-generic-stopping.jl +++ b/test/test-stopping/test-unitaire-generic-stopping.jl @@ -7,6 +7,7 @@ stop0 = GenericStopping(rosenbrock, state0, tol_check = (atol,rtol,opt0) -> atol + rtol * opt0, list = ListStates(state0) ) show(stop0) + stop0.listofstates[1] meta = StoppingMeta(tol_check = (atol,rtol,opt0) -> atol + rtol * opt0) stop0_meta = GenericStopping(rosenbrock, meta, state0, list = ListStates(state0))