From 809adee7778da47b0fb9cb58a949e755d31458ba Mon Sep 17 00:00:00 2001 From: Josh Day Date: Thu, 28 Jun 2018 08:48:38 -0400 Subject: [PATCH] merge test --- test/runtests.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index e4408a3..b3f3298 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,6 @@ using Compat, Compat.Test, OnlineStatsBase, LearnBase -import OnlineStatsBase: OnlineStat, _fit!, fit!, +import OnlineStatsBase: OnlineStat, _fit!, fit!, _merge! EqualWeight, ExponentialWeight, LearningRate, LearningRate2, HarmonicWeight, McclainWeight #-----------------------------------------------------------------------# @@ -8,6 +8,7 @@ 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)) @@ -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