Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Jul 11, 2018
1 parent b493e7f commit 9f6c103
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit_Polygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,22 @@ for N in [Float64, Float32, Rational{Int}]
# Test Dimension
@test dim(p) == 2

# Test Support Vector
# test support vector, with linear and binary search
d = N[1., 0.]
@test σ(d, p) == N[4., 2.]
@test σ(d, p, linear_search=true) == σ(d, p, linear_search=false)
d = N[0., 1.]
@test σ(d, p) == N[2., 4.]
@test σ(d, p, linear_search=true) == σ(d, p, linear_search=false)
d = N[-1., 0.]
@test σ(d, p) == N[-1., 1.]
@test σ(d, p, linear_search=true) == σ(d, p, linear_search=false)
d = N[0., -1.]
@test σ(d, p) == N[0., 0.]
@test σ(d, p, linear_search=true) == σ(d, p, linear_search=false)
d = N[1., -1.]
@test σ(d, p) == N[4., 2.]
@test σ(d, p, linear_search=true) == σ(d, p, linear_search=false)

# Test containment
@test (N[0., 0.], p)
Expand Down

0 comments on commit 9f6c103

Please sign in to comment.