Skip to content

Commit

Permalink
typical: add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
iblislin committed May 9, 2017
1 parent 19aa5e7 commit c771d22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion test/runtests.jl
Expand Up @@ -4,8 +4,9 @@ using MarketTechnicals

include("candlesticks.jl")
include("levels.jl")
include("movingaverages.jl")
include("momentum.jl")
include("movingaverages.jl")
include("utilities.jl")
include("volatility.jl")
include("volume.jl")

Expand Down
15 changes: 7 additions & 8 deletions test/utilities.jl
@@ -1,14 +1,13 @@
facts("Utilities") do

context("Base.abs returns all positive numbers") do
@fact sum((abs(cl .- op) .>= 0).values) --> length(cl)
end
context("typical price") do

context("pad correctly pads NaN values for non-existent values") do
@fact sum((abs(cl .- op) .>= 0).values) --> length(cl)
end
ts = collect(Date(2017, 5, 1):Date(2017, 5, 5))
ta = typical(
TimeArray(ts, reshape(1:15, (5, 3)), ["High", "Low", "Close"]))

context("pad correctly pads NaN values for missing values") do
@fact sum((abs(cl .- op) .>= 0).values) --> length(cl)
@fact ta.timestamp[1] --> Date(2017, 5, 1)
@fact ta.timestamp[end] --> Date(2017, 5, 5)
@fact ta.values --> [6, 7, 8, 9, 10]
end
end

0 comments on commit c771d22

Please sign in to comment.