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

Commit e6acd17

Browse files
committed
add test_envinterface
1 parent f882dd9 commit e6acd17

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/ReinforcementLearningBase.jl

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ module ReinforcementLearningBase
22

33
include("spaces/space.jl")
44
include("abstractenv.jl")
5+
include("tests.jl")
56

67
end # module

src/tests.jl

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function test_envinterface(env)
2+
@eval Main begin
3+
@testset "$(typeof($env)) interface test" begin
4+
res = reset!($env)
5+
@test typeof(res) == NamedTuple{(:observation,),
6+
Tuple{typeof(res[:observation])}}
7+
res = interact!($env, sample(actionspace($env)))
8+
@test typeof(res) == NamedTuple{(:observation, :reward, :isdone),
9+
Tuple{typeof(res[:observation]),
10+
typeof(res[:reward]), Bool}}
11+
res = getstate($env)
12+
@test typeof(res) == NamedTuple{(:observation, :isdone),
13+
Tuple{typeof(res[:observation]), Bool}}
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)