This commit is contained in:
Mike Innes 2018-08-17 11:44:01 +01:00
parent b460439484
commit 995543f648

View File

@ -1,15 +1,13 @@
using Flux using Flux
using Flux: throttle, jacobian, initn, glorot_uniform, glorot_normal using Flux: throttle, jacobian, initn, glorot_uniform, glorot_normal
using StatsBase: std using StatsBase: std
using Dates
using Random using Random
using Test using Test
using Dates: now
@testset "Throttle" begin @testset "Throttle" begin
@testset "default behaviour" begin @testset "default behaviour" begin
a = [] a = []
f = throttle(()->push!(a, now()), 1, leading=true, trailing=false) f = throttle(()->push!(a, time()), 1, leading=true, trailing=false)
f() f()
f() f()
f() f()
@ -19,7 +17,7 @@ using Dates: now
@testset "leading behaviour" begin @testset "leading behaviour" begin
a = [] a = []
f = throttle(()->push!(a, now()), 1, leading=true, trailing=false) f = throttle(()->push!(a, time()), 1, leading=true, trailing=false)
f() f()
@test length(a) == 1 @test length(a) == 1
f() f()
@ -31,7 +29,7 @@ using Dates: now
@testset "trailing behaviour" begin @testset "trailing behaviour" begin
a = [] a = []
f = throttle(()->push!(a, now()), 1, leading=false, trailing=true) f = throttle(()->push!(a, time()), 1, leading=false, trailing=true)
f() f()
@test length(a) == 0 @test length(a) == 0
f() f()