Skip to content

Commit

Permalink
Added tests for prune functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-asmar committed Jun 28, 2024
1 parent c94bdf7 commit 03a751e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/prune.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@testset "prune" begin
# NativeSARSOP.strictly_dominates
a1 = [1.0, 2.0, 3.0]
a2 = [1.0, 2.1, 2.9]
a3 = [0.9, 1.9, 2.9]
@test !NativeSARSOP.strictly_dominates(a1, a2, 1e-10)
@test NativeSARSOP.strictly_dominates(a1, a1, 1e-10)
@test NativeSARSOP.strictly_dominates(a1, a3, 1e-10)

# NativeSARSOP.intersection_distance
b = SparseVector([1.0, 0.0])
a1 = [1.0, 0.0]
a2 = [0.0, 1.0]
@test isapprox(NativeSARSOP.intersection_distance(a1, a2, b),
sqrt(0.5^2 + 0.5^2), atol=1e-10)

b = SparseVector([0.5, 0.5])
@test isapprox(NativeSARSOP.intersection_distance(a1, a2, b), 0.0, atol=1e-10)
end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ include("sample.jl")

include("updater.jl")

include("prune.jl")

include("tree.jl")

@testset "Tiger POMDP" begin
Expand Down

0 comments on commit 03a751e

Please sign in to comment.