Skip to content

Commit

Permalink
test deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff committed Jun 18, 2023
1 parent 33d2088 commit 14caf8f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ fn = sum
width = 3
data = collect(1.0:7.0)

result = rolling(sum, data, width)
current = rolling(sum, width, data)
old = rolling(sum, data, width)

@test current == old

34 changes: 34 additions & 0 deletions test/run/run_stats.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

@test runmean(windowsize, datavec) == Float32[2.0, 3.0, 4.0]
#=
julia> runmean(windowsize, datavec)
ERROR: MethodError: no method matching running(::typeof(VectorizedStatistics.vmean), ::Int64, ::Vector{Float32}; padding::RollingFunctions.NoPadding, atend::Bool)
=#

expected = [2.0f0, 3.0f0, 4.0f0]
obtained = running(mean, 3, datavec)
@test Float32(eps(Float64)) > abs(sum(expected .- obtained))

expected = [1.236568f0, 1.7457432f0, 2.254918f0]
obtained = runmean(windowsize, datavec, weighting)
@test Float32(eps(Float32)) > abs(sum(expected .- obtained))

expected = [1.236568f0, 1.7457432f0, 2.254918f0]
obtained = running(mean, 3, datavec, weighting)
@test Float32(eps(Float32)) > abs(sum(expected .- obtained))

data1=[1,2,3,4,5,6,7];data2=[1,4,6,16,25,36,49];
weighting = AnalyticWeights(normalize([1.0, 2.0, 1.0, 2.0]));

expected = [2.5, 6.0, 9.5, 10.0, 12.0]
obtained = running(cov, 3, data1, data2)
@test eps(Float32) > abs(sum(expected .- obtained))

expected = [0.9751641759537001, 0.9283031155706918, 0.9749534026403799, 0.9732162133211492]
obtained = runcor(4, data1, data2, weighting)
@test eps(Float32) > abs(sum(expected .- obtained))

expected = [15.0, 20.75, 26.5]
obtained = runlcov(5, data1, data2)
@test eps(Float32) > abs(sum(expected .- obtained))

0 comments on commit 14caf8f

Please sign in to comment.