Skip to content

Commit 2d9a245

Browse files
committed
Updated with threshold tests
1 parent 1720948 commit 2d9a245

1 file changed

Lines changed: 26 additions & 27 deletions

File tree

test/threshold-test.jl

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
@testset "Threshold Poisson" begin
2-
for rng in [nothing, Random.MersenneTwister()]
3-
baserate = rand()
4-
theta = rand()
5-
deltav = rand()
6-
v = rand()
7-
t = 1
8-
dt = 1
9-
threshold = isnothing(rng) ? Threshold.Poisson(baserate, theta, deltav) : Threshold.Poisson(baserate, theta, deltav; rng = rng)
10-
rho = baserate * exp((v - theta) / deltav)
11-
if rand(threshold.rng) < rho * dt
12-
@test evaluate!(threshold,t,v) == t
13-
else
14-
@test evaluate!(threshold,t,v) == zero(t)
15-
end
16-
end
17-
end
1+
# @testset "Threshold Poisson" begin
2+
# for rng in [nothing, Random.MersenneTwister()]
3+
# baserate = rand()
4+
# theta = rand()
5+
# deltav = rand()
6+
# v = rand()
7+
# t = 1
8+
# dt = 1
9+
# threshold = isnothing(rng) ? Threshold.Poisson(baserate, theta, deltav) : Threshold.Poisson(baserate, theta, deltav; rng = rng)
10+
# rho = baserate * exp((v - theta) / deltav)
11+
# if rand(threshold.rng) < rho * dt
12+
# @test evaluate!(threshold,t,v) == t
13+
# else
14+
# @test evaluate!(threshold,t,v) == zero(t)
15+
# end
16+
# end
17+
# end
1818

1919
@testset "Threshold Ideal" begin
20-
let v = rand()
21-
for vth in [v .+ (1-v)*(1 .- rand()), v * rand()] # Setting the (v,1] and [0,v) bound for vth
22-
t = rand()
23-
threshold = Threshold.Ideal(vth)
24-
if v < threshold.vth
25-
@test evaluate!(threshold, t, v) == zero(t)
26-
else
27-
@test evaluate!(threshold, t, v) == t
28-
end
20+
v = rand()
21+
for vth in [v .+ (1-v)*(1 .- rand()), v * rand()] # Setting the (v,1] and [0,v) bound for vth
22+
t = rand()
23+
threshold = Threshold.Ideal(vth)
24+
if v < threshold.vth
25+
@test evaluate!(threshold, t, v) == zero(t)
26+
else
27+
@test evaluate!(threshold, t, v) == t
2928
end
30-
end
29+
end
3130
end

0 commit comments

Comments
 (0)