Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from JuliaReinforcementLearning/test_envinterface
Browse files Browse the repository at this point in the history
add test_envinterface
  • Loading branch information
findmyway authored Sep 7, 2018
2 parents f882dd9 + e6acd17 commit 443a7aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ReinforcementLearningBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ module ReinforcementLearningBase

include("spaces/space.jl")
include("abstractenv.jl")
include("tests.jl")

end # module
16 changes: 16 additions & 0 deletions src/tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function test_envinterface(env)
@eval Main begin
@testset "$(typeof($env)) interface test" begin
res = reset!($env)
@test typeof(res) == NamedTuple{(:observation,),
Tuple{typeof(res[:observation])}}
res = interact!($env, sample(actionspace($env)))
@test typeof(res) == NamedTuple{(:observation, :reward, :isdone),
Tuple{typeof(res[:observation]),
typeof(res[:reward]), Bool}}
res = getstate($env)
@test typeof(res) == NamedTuple{(:observation, :isdone),
Tuple{typeof(res[:observation]), Bool}}
end
end
end

0 comments on commit 443a7aa

Please sign in to comment.