From b207190873b4988bc0aec4ca01a410d899526f18 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:45:18 +0200 Subject: [PATCH] Add tests for `in` for `StateStack`s --- test/test_state_stack.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/test_state_stack.jl b/test/test_state_stack.jl index 66523ef..3ec86e4 100644 --- a/test/test_state_stack.jl +++ b/test/test_state_stack.jl @@ -9,6 +9,28 @@ @test size(stack) == 0 end + @testset "membership" begin + sm = HerbConstraints.StateManager() + stack = HerbConstraints.StateStack{Int}(sm) + push!(stack, 10) + push!(stack, 20) + push!(stack, 30) + @test in(stack, 10) + @test in(stack, 20) + @test in(stack, 30) + @test !in(stack, 40) + + sm = HerbConstraints.StateManager() + stack = HerbConstraints.StateStack{String}(sm) + push!(stack, "A") + push!(stack, "B") + push!(stack, "C") + @test in(stack, "A") + @test in(stack, "B") + @test in(stack, "C") + @test !in(stack, "D") + end + @testset "from vector" begin sm = HerbConstraints.StateManager() stack = HerbConstraints.StateStack{Int}(sm, [10, 20, 30])