11using CommonRLInterface
22using Test
33
4+ mutable struct LQREnv <: AbstractEnv
5+ s:: Float64
6+ end
7+
48@testset " from README" begin
5- mutable struct LQREnv <: AbstractEnv
6- s:: Float64
7- end
89
910 function CommonRLInterface. reset! (m:: LQREnv )
1011 m. s = 0.0
1112 end
1213
13- CommonRLInterface. actions (m:: LQREnv ) = ( - 1.0 , 0.0 , 1.0 )
14+ CommonRLInterface. actions (m:: LQREnv ) = [ - 1.0 , 0.0 , 1.0 ]
1415 CommonRLInterface. observe (m:: LQREnv ) = m. s
1516 CommonRLInterface. terminated (m:: LQREnv ) = false
1617
@@ -40,7 +41,7 @@ MyEnv() = MyEnv(1)
4041function CommonRLInterface. reset! (env:: MyEnv )
4142 env. state = 1
4243end
43- CommonRLInterface. actions (env:: MyEnv ) = ( - 1 , 0 , 1 )
44+ CommonRLInterface. actions (env:: MyEnv ) = [ - 1 , 0 , 1 ]
4445CommonRLInterface. observe (env:: MyEnv ) = env. state
4546CommonRLInterface. terminated (env:: MyEnv ) = false
4647function CommonRLInterface. act! (env:: MyEnv , a)
@@ -57,7 +58,7 @@ MyGame() = MyGame(1)
5758function CommonRLInterface. reset! (env:: MyGame )
5859 env. state = 1
5960end
60- CommonRLInterface. actions (env:: MyGame ) = ( - 1 , 1 )
61+ CommonRLInterface. actions (env:: MyGame ) = [ - 1 , 1 ]
6162CommonRLInterface. observe (env:: MyGame ) = env. state
6263CommonRLInterface. terminated (env:: MyGame ) = false
6364function CommonRLInterface. act! (env:: MyGame , a)
140141end
141142
142143@testset " spaces" begin
143- @provide CommonRLInterface. valid_actions (env:: MyEnv ) = ( 0 , 1 )
144+ @provide CommonRLInterface. valid_actions (env:: MyEnv ) = [ 0 , 1 ]
144145 @test provided (valid_actions, env)
145146 @test issubset (valid_actions (env), actions (env))
146147
156157 @test observations (env) == 1 : 10
157158end
158159
159- include (" examples/gridworld.jl" )
160+ if VERSION >= v " 1.4" # not sure if this is the actual minimal version, but I know it will work
161+ include (" examples/gridworld.jl" )
162+ end
0 commit comments