From fa12d6f0256cb60f108b5bfc95cc56f40187169b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Mon, 8 Jul 2019 09:42:32 -0400 Subject: [PATCH] :wrench: add some tests --- docs/make.jl | 10 +++++----- docs/src/plots.md | 4 ++++ test/rand/cascademodel.jl | 3 +++ test/types/conversions.jl | 5 +++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 12332246c..520214f30 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,11 +1,12 @@ using Pkg +tmp_packages = ["EcologicalNetworksPlots", "Plots"] + push!(LOAD_PATH,"../src/") Pkg.activate(".") -Pkg.add("EcologicalNetworksPlots") # IMPORTANT -Pkg.add("Plots") # IMPORTANT +Pkg.add.(tmp_packages) # IMPORTANT using Documenter using EcologicalNetworks @@ -31,7 +32,7 @@ makedocs( "Overlap and similarity" => "properties/overlap.md", "Null models" => "properties/nullmodels.md", "Beta-diversity" => "properties/betadiversity.md", - "Resilience" => "properties/resilience.md" + "Resilience" => "properties/resilience.md", "Information theory" => "properties/information.md" ], "Plots" => "plots.md" @@ -44,5 +45,4 @@ deploydocs( devbranch = "master" ) -Pkg.rm("EcologicalNetworksPlots") # IMPORTANT -Pkg.rm("Plots") # IMPORTANT +Pkg.rm.(tmp_packages) # IMPORTANT diff --git a/docs/src/plots.md b/docs/src/plots.md index 1585f95b6..5ff79df5f 100644 --- a/docs/src/plots.md +++ b/docs/src/plots.md @@ -1,3 +1,7 @@ +Plotting functions are part of the `EcologicalNetworksPlot`, which requires +`Plot` to work. + + ## Initial layouts ```@docs diff --git a/test/rand/cascademodel.jl b/test/rand/cascademodel.jl index d989d7006..b55aba42e 100644 --- a/test/rand/cascademodel.jl +++ b/test/rand/cascademodel.jl @@ -7,6 +7,9 @@ module TestCascadeModel @test richness(cascademodel(10, 0.1)) == 10 @test richness(cascademodel(10, 0.2)) == 10 @test richness(cascademodel(20, 0.1)) == 20 + + @test richness(cascademodel((10, 0.1))) == 10 + @test richness(cascademodel((10, 10))) == 10 @test_throws ArgumentError cascademodel(10, 0.9) @test_throws ArgumentError cascademodel(10, 0.7) diff --git a/test/types/conversions.jl b/test/types/conversions.jl index 1bb58b981..85443c604 100644 --- a/test/types/conversions.jl +++ b/test/types/conversions.jl @@ -11,6 +11,11 @@ M = convert(UnipartiteNetwork, N) @test has_interaction(M, :b, :B) @test !has_interaction(M, :A, :B) +# Convert back to bipartite +K = convert(BipartiteNetwork, M) +@test has_interaction(M, :b, :B) +@test !has_interaction(M, :A, :B) + N = BipartiteQuantitativeNetwork([4 0 ; 2 1], [:a, :b], [:A, :B]) M = convert(UnipartiteQuantitativeNetwork, N) @test has_interaction(M, :a, :A)