Skip to content

Commit

Permalink
merge test
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed Jun 28, 2018
1 parent 521f523 commit 809adee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using Compat, Compat.Test, OnlineStatsBase, LearnBase

import OnlineStatsBase: OnlineStat, _fit!, fit!,
import OnlineStatsBase: OnlineStat, _fit!, fit!, _merge!
EqualWeight, ExponentialWeight, LearningRate, LearningRate2, HarmonicWeight,
McclainWeight
#-----------------------------------------------------------------------#
mutable struct FakeStat <: OnlineStat{Number}
n::Int
end
_fit!(o::FakeStat, y) = (o.n += 1)
_merge!(o::FakeStat, o2::FakeStat) = (o.n += o2.n)

struct FakeStat2 <: OnlineStat{Number} end
println(FakeStat(0))
Expand All @@ -21,6 +22,7 @@ println(FakeStat(0))
@test FakeStat(10) == FakeStat(10)
@test FakeStat(0) != FakeStat2()
@test value(fit!(FakeStat(0), rand(100))) == 100
@test merge(FakeStat(10), FakeStat(11)).n == 21
end

#-----------------------------------------------------------------------# Weight
Expand Down

0 comments on commit 809adee

Please sign in to comment.