Skip to content

Commit e75ba99

Browse files
committed
add "iterate" to DummyState
1 parent bf6ff1d commit e75ba99

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/test_suite.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ using ..AlgorithmsInterface
1010
struct DummyAlgorithm{S <: AlgorithmsInterface.StoppingCriterion} <: AlgorithmsInterface.Algorithm
1111
stopping_criterion::S
1212
end
13+
1314
struct DummyProblem <: AlgorithmsInterface.Problem end
14-
mutable struct DummyState{S <: AlgorithmsInterface.StoppingCriterionState} <: AlgorithmsInterface.State
15+
16+
mutable struct DummyState{V, S <: AlgorithmsInterface.StoppingCriterionState} <: AlgorithmsInterface.State
17+
iterate::V
1518
stopping_criterion_state::S
1619
iteration::Int
1720
end
21+
1822
end

test/stopping_criterion.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ problem = AIT.DummyProblem()
1313
algorithm = AIT.DummyAlgorithm(s1)
1414
s1_state = initialize_state(problem, algorithm, s1)
1515
@test !indicates_convergence(s1, s1_state)
16-
state_finished = AIT.DummyState(s1_state, 2)
17-
alg_state = AIT.DummyState(s1_state, 1)
16+
state_finished = AIT.DummyState(nothing, s1_state, 2)
17+
alg_state = AIT.DummyState(nothing, s1_state, 1)
1818
@test is_finished(problem, algorithm, state_finished)
1919
@test !is_finished(problem, algorithm, alg_state)
2020
# Fake a stop:
@@ -31,7 +31,7 @@ end
3131

3232
algorithm = AIT.DummyAlgorithm(s1)
3333
s1_state = initialize_state(problem, algorithm, s1)
34-
alg_state = AIT.DummyState(s1_state, 0)
34+
alg_state = AIT.DummyState(nothing, s1_state, 0)
3535
# Iteration 0: Start timer
3636
@test !is_finished!(problem, algorithm, alg_state)
3737
@test !is_finished(problem, algorithm, alg_state)
@@ -63,7 +63,7 @@ end
6363
@test contains(s1_str, "Overall: not reached")
6464

6565
@test isnothing(AlgorithmsInterface.get_reason(s1, s1_state))
66-
alg_state = AIT.DummyState(s1_state, 1)
66+
alg_state = AIT.DummyState(nothing, s1_state, 1)
6767
@test !is_finished(problem, algorithm, alg_state)
6868
# Fake start timer
6969
s1_state.criteria_states[2].start = Nanosecond(time_ns())
@@ -109,7 +109,7 @@ end
109109
@test contains(s1_str, "Overall: not reached")
110110

111111
@test isnothing(AlgorithmsInterface.get_reason(s1, s1_state))
112-
alg_state = AIT.DummyState(s1_state, 1)
112+
alg_state = AIT.DummyState(nothing, s1_state, 1)
113113
@test !is_finished!(problem, algorithm, alg_state)
114114
@test !is_finished(problem, algorithm, alg_state)
115115
s1_state.criteria_states[2].time = Second(2)

0 commit comments

Comments
 (0)