Skip to content

Commit

Permalink
tests for crossover/under
Browse files Browse the repository at this point in the history
  • Loading branch information
dysonance committed Jul 6, 2018
1 parent 7d7d5db commit eb29d9d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ using Base.Test

const N = 1_000
const X0 = 50.0
const seed = 1

srand(seed)
x = cumsum(randn(N)) + X0
ohlc = cumsum(randn(N,4)) + X0
hlc = ohlc[:,2:4]
hl = ohlc[:,2:3]

count_nans(x) = sum(isnan.(x))

#TODO: trendy.jl
#TODO: utils.jl
@testset "Utilities" begin
y = x + randn(N)
cxo = crossover(x, y)
cxu = crossunder(x, y)
@test any(cxo)
@test any(cxu)
@test !any(cxo .* cxu) # ensure crossovers and crossunders never coincide
end

# trendy
@testset "Trendlines" begin
Expand Down Expand Up @@ -79,7 +87,6 @@ end
@test count_nans(tmp) != N
end

#TODO: run.jl
@testset "Running Calculations" begin
tmp = diffn(x)
@test size(tmp, 1) == N
Expand Down

0 comments on commit eb29d9d

Please sign in to comment.