Skip to content

Commit ca511f7

Browse files
committed
Test without partialnt
1 parent 3a05be0 commit ca511f7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/episodes.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ using Test
44
@testset "EpisodesBuffer" begin
55
@testset "with circular traces" begin
66
eb = EpisodesBuffer(
7-
CircularArraySARSATTraces(;
7+
CircularArraySARTTraces(;
88
capacity=10)
99
)
1010
#push a first episode l=5
11-
push!(eb, (state = 1, action = 1))
11+
push!(eb, (state = 1,))
1212
@test eb.sampleable_inds[end] == 0
1313
@test eb.episodes_lengths[end] == 0
1414
@test eb.step_numbers[end] == 1
1515
for i = 1:5
16-
push!(eb, (state = i+1, action =i+1, reward = i, terminal = false))
16+
push!(eb, (state = i+1, action =i, reward = i, terminal = false))
1717
@test eb.sampleable_inds[end] == 0
1818
@test eb.sampleable_inds[end-1] == 1
1919
@test eb.step_numbers[end] == i + 1
@@ -22,7 +22,7 @@ using Test
2222
@test eb.sampleable_inds == [1,1,1,1,1,0]
2323
@test length(eb.traces) == 5
2424
#start new episode of 6 periods.
25-
push!(eb, (state = 7, action = 7))
25+
push!(eb, (state = 7,))
2626
@test eb.sampleable_inds[end] == 0
2727
@test eb.sampleable_inds[end-1] == 0
2828
@test eb.episodes_lengths[end] == 0
@@ -32,7 +32,7 @@ using Test
3232
ep2_len = 0
3333
for (j,i) = enumerate(8:11)
3434
ep2_len += 1
35-
push!(eb, (state = i, action =i, reward = i-1, terminal = false))
35+
push!(eb, (state = i, action =i-1, reward = i-1, terminal = false))
3636
@test eb.sampleable_inds[end] == 0
3737
@test eb.sampleable_inds[end-1] == 1
3838
@test eb.step_numbers[end] == j + 1
@@ -43,7 +43,7 @@ using Test
4343
#three last steps replace oldest steps in the buffer.
4444
for (i, s) = enumerate(12:13)
4545
ep2_len += 1
46-
push!(eb, (state = s, action =s, reward = s-1, terminal = false))
46+
push!(eb, (state = s, action =s-1, reward = s-1, terminal = false))
4747
@test eb.sampleable_inds[end] == 0
4848
@test eb.sampleable_inds[end-1] == 1
4949
@test eb.step_numbers[end] == i + 1 + 4
@@ -59,18 +59,18 @@ using Test
5959
end
6060
b = eb[i]
6161
@test b[:state] == b[:action] == b[:reward] == s
62-
@test b[:next_state] == b[:next_action] == s + 1
62+
@test b[:next_state] == s + 1
6363
end
6464
#episode 2
6565
#start a third episode
66-
push!(eb, (state = 14, action = 14))
66+
push!(eb, (state = 14, ))
6767
@test eb.sampleable_inds[end] == 0
6868
@test eb.sampleable_inds[end-1] == 0
6969
@test eb.episodes_lengths[end] == 0
7070
@test eb.step_numbers[end] == 1
7171
#push until it reaches it own start
7272
for (i,s) in enumerate(15:26)
73-
push!(eb, (state = s, action =s, reward = s-1, terminal = false))
73+
push!(eb, (state = s, action =s-1, reward = s-1, terminal = false))
7474
end
7575
@test eb.sampleable_inds == [fill(true, 10); [false]]
7676
@test eb.episodes_lengths == fill(length(15:26), 11)

0 commit comments

Comments
 (0)