Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
fix the omnivory test
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisot committed Feb 11, 2022
1 parent 7c8c615 commit 478cd2d
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions test/community/foodwebs.jl
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

0 comments on commit 478cd2d

Please sign in to comment.