From fa376233887cfa26ef69fa000ec7d14f0e6390ac Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 2 Sep 2020 17:36:12 -0300 Subject: [PATCH 1/2] Added test for TablesConnector's throw --- test/connector.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/connector.jl b/test/connector.jl index 5de9feb..2500e4c 100644 --- a/test/connector.jl +++ b/test/connector.jl @@ -12,16 +12,21 @@ @test batch[1, j] == df[i, j] end end - + @test EasyStream.hasnext(conn) == false + @test EasyStream.next(conn) === nothing + @test length(conn) == size(df, 1) EasyStream.reset!(conn) @test conn.state == 0 - + array = [1 2 3 4 5; 6 7 8 9 10] + + @test_throws ArgumentError EasyStream.TablesConnector(array) + @testset "sort functionalities" begin conn = EasyStream.TablesConnector(df, :x) From 495d6fd8a59ce4f93a365c0ca34cdd3636dc75ca Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 2 Sep 2020 19:06:15 -0300 Subject: [PATCH 2/2] Added tests for Generator Connector --- test/connector.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/connector.jl b/test/connector.jl index 2500e4c..fac18bc 100644 --- a/test/connector.jl +++ b/test/connector.jl @@ -63,4 +63,19 @@ @test diff_elements > 0 end end + + @testset "Generator Connector" begin + function generator(n_features::Int) + return DataFrame(permutedims([rand() for _ = 1:n_features ])) + end + + n_features = 5 + conn = EasyStream.GeneratorConnector(generator, n_features) + + data = EasyStream.next(cnn) + + @test size(data, 1) == 1 + @test size(data, 1) == n_features + + end end \ No newline at end of file