1
1
using CommonRLInterface
2
2
using Test
3
3
4
+ mutable struct LQREnv <: AbstractEnv
5
+ s:: Float64
6
+ end
7
+
4
8
@testset " from README" begin
5
- mutable struct LQREnv <: AbstractEnv
6
- s:: Float64
7
- end
8
9
9
10
function CommonRLInterface. reset! (m:: LQREnv )
10
11
m. s = 0.0
11
12
end
12
13
13
- CommonRLInterface. actions (m:: LQREnv ) = ( - 1.0 , 0.0 , 1.0 )
14
+ CommonRLInterface. actions (m:: LQREnv ) = [ - 1.0 , 0.0 , 1.0 ]
14
15
CommonRLInterface. observe (m:: LQREnv ) = m. s
15
16
CommonRLInterface. terminated (m:: LQREnv ) = false
16
17
@@ -40,7 +41,7 @@ MyEnv() = MyEnv(1)
40
41
function CommonRLInterface. reset! (env:: MyEnv )
41
42
env. state = 1
42
43
end
43
- CommonRLInterface. actions (env:: MyEnv ) = ( - 1 , 0 , 1 )
44
+ CommonRLInterface. actions (env:: MyEnv ) = [ - 1 , 0 , 1 ]
44
45
CommonRLInterface. observe (env:: MyEnv ) = env. state
45
46
CommonRLInterface. terminated (env:: MyEnv ) = false
46
47
function CommonRLInterface. act! (env:: MyEnv , a)
@@ -57,7 +58,7 @@ MyGame() = MyGame(1)
57
58
function CommonRLInterface. reset! (env:: MyGame )
58
59
env. state = 1
59
60
end
60
- CommonRLInterface. actions (env:: MyGame ) = ( - 1 , 1 )
61
+ CommonRLInterface. actions (env:: MyGame ) = [ - 1 , 1 ]
61
62
CommonRLInterface. observe (env:: MyGame ) = env. state
62
63
CommonRLInterface. terminated (env:: MyGame ) = false
63
64
function CommonRLInterface. act! (env:: MyGame , a)
140
141
end
141
142
142
143
@testset " spaces" begin
143
- @provide CommonRLInterface. valid_actions (env:: MyEnv ) = ( 0 , 1 )
144
+ @provide CommonRLInterface. valid_actions (env:: MyEnv ) = [ 0 , 1 ]
144
145
@test provided (valid_actions, env)
145
146
@test issubset (valid_actions (env), actions (env))
146
147
156
157
@test observations (env) == 1 : 10
157
158
end
158
159
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