Skip to content

Commit

Permalink
fix reset tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremiah Lewis committed Mar 13, 2024
1 parent 545fb4c commit 906b7c9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ReinforcementLearningCore/test/core/reset_conditions.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
using Test
using ReinforcementLearningCore

@testset "Reset Conditions Tests" begin

@testset "Test ResetIfEnvTerminated" begin
policy = RandomPolicy()
env = RandomWalk1D()
reset_condition = ResetIfEnvTerminated()
is_terminated(env) = true
@test check!(reset_condition, policy, env) == true
env.pos = 1
@test RLCore.check!(reset_condition, policy, env) == true
end

@testset "Test ResetAfterNSteps" begin
policy = RandomPolicy()
env = RandomWalk1D()
reset_condition = ResetAfterNSteps(3)
@test check!(reset_condition, policy, env) == false
@test check!(reset_condition, policy, env) == false
@test check!(reset_condition, policy, env) == true
@test check!(reset_condition, policy, env) == false
@test RLCore.check!(reset_condition, policy, env) == false
@test RLCore.check!(reset_condition, policy, env) == false
@test RLCore.check!(reset_condition, policy, env) == false
@test RLCore.check!(reset_condition, policy, env) == true
@test RLCore.check!(reset_condition, policy, env) == false
end
end

0 comments on commit 906b7c9

Please sign in to comment.