using Base.Test

include("../roc.jl")
@test Roc.tpNumNaive([1,11]      , [10,20,30,40], 3) == 1
@test Roc.tpNumNaive([1,11,13]   , [10,20,30,40], 3) == 2
@test Roc.tpNumNaive([1,11,14]   , [10,20,30,40], 3) == 1
@test Roc.tpNumNaive([1,11,14,30], [10,20,30,40], 3) == 2

@test Roc.tpRate([1,31   ], [10,20,30,40], 3) == 1/4
@test Roc.tpRate([1,31,44], [10,20,30,40], 3) == 1/4
@test Roc.tpRate([1,31,43], [10,20,30,40], 3) == 2/4

@test Roc.faRate([1,31   ], [10,20,30,40], 3, 100) == 1/(1+(100-4*3))
@test Roc.tpNum([1,11]      , [10,20,30,40], 3) == 1

#           T             T    T    T    T   F    F     T   F     T  
detections=[0,           388, 395, 407, 418, 436, 448, 473, 487, 502]
changes   =[0, 100, 199, 300, 401, 501]

max_delay  = 30
println("... test_roc.jl > TP num. ", Roc.tpNum(detections, changes, max_delay))
println("... test_roc.jl > TP rate ", Roc.tpRate(detections, changes, max_delay))
