From 78a6c440ca1c446298978e90b1090ba0edf5dc36 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sun, 22 Mar 2020 15:26:07 -0700 Subject: [PATCH] More tests for Iterators.accumulate --- test/iterators.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/iterators.jl b/test/iterators.jl index da4501cd4ac56..71a24e5e4ca1f 100644 --- a/test/iterators.jl +++ b/test/iterators.jl @@ -793,6 +793,9 @@ end @test collect(Iterators.accumulate(+, [1,2])) == [1,3] @test collect(Iterators.accumulate(+, [1,2,3])) == [1,3,6] @test collect(Iterators.accumulate(=>, [:a,:b,:c])) == [:a, :a => :b, (:a => :b) => :c] + @test collect(Iterators.accumulate(+, (x for x in [true])))::Vector{Int} == [1] + @test collect(Iterators.accumulate(+, (x for x in [true, true, false])))::Vector{Int} == [1, 2, 2] + @test collect(Iterators.accumulate(+, (x for x in [true]), init=10.0))::Vector{Float64} == [11.0] @test length(Iterators.accumulate(+, [10,20,30])) == 3 @test size(Iterators.accumulate(max, rand(2,3))) == (2,3) @test Base.IteratorSize(Iterators.accumulate(max, rand(2,3))) === Base.IteratorSize(rand(2,3))