Skip to content

Commit

Permalink
Add basin index test
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed May 8, 2024
1 parent ef2ec90 commit 57b7015
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/test/validation_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,22 @@ end
dt,
)
end

@testitem "basin indices" begin
using Ribasim: NodeType

toml_path = normpath(@__DIR__, "../../generated_testmodels/basic/ribasim.toml")
@test ispath(toml_path)

model = Ribasim.Model(toml_path)
(; graph, basin) = model.integrator.p
for edge_metadata in values(graph.edge_data)
(; edge, basin_idxs) = edge_metadata
id_src, id_dst = edge
if id_src.type == NodeType.Basin
@test id_src == basin.node_id.values[basin_idxs[1]]
elseif id_dst.type == NodeType.Basin
@test id_dst == basin.node_id.values[basin_idxs[2]]
end
end
end

0 comments on commit 57b7015

Please sign in to comment.