This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
module TestFoodWebs | ||
using Test | ||
using EcologicalNetworks | ||
using Test | ||
using EcologicalNetworks | ||
|
||
# test trophic levels on motifs | ||
s1 = unipartitemotifs()[:S1] | ||
s1_ftl = trophic_level(s1) | ||
s1_tl = distance_to_producer(s1) | ||
@test maximum(values(s1_ftl)) ≈ 3 | ||
@test maximum(values(s1_tl)) ≈ 3.0 | ||
@test s1_ftl[:a] ≈ 3 | ||
@test s1_ftl[:b] ≈ 2 | ||
@test s1_ftl[:c] ≈ 1 | ||
# test trophic levels on motifs | ||
s1 = unipartitemotifs()[:S1] | ||
s1_ftl = trophic_level(s1) | ||
s1_tl = distance_to_producer(s1) | ||
@test maximum(values(s1_ftl)) ≈ 3 | ||
@test maximum(values(s1_tl)) ≈ 3.0 | ||
@test s1_ftl[:a] ≈ 3 | ||
@test s1_ftl[:b] ≈ 2 | ||
@test s1_ftl[:c] ≈ 1 | ||
|
||
s2 = unipartitemotifs()[:S2] | ||
@test minimum(values(trophic_level(s1))) ≈ 1.0 | ||
@test minimum(values(distance_to_producer(s1))) == 1.0 | ||
s2 = unipartitemotifs()[:S2] | ||
@test minimum(values(trophic_level(s1))) ≈ 1.0 | ||
@test minimum(values(distance_to_producer(s1))) == 1.0 | ||
|
||
# Test for omnivory | ||
for s in species(s1) | ||
if iszero(EcologicalNetworks.degree_out(s1)[s]) | ||
@test iszero(omnivory(s1)[s]) | ||
end | ||
end | ||
|
||
end |