From 57b701595b53ff43a215283e3d9ff44fbdfe50e3 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Wed, 8 May 2024 11:44:52 +0200 Subject: [PATCH] Add basin index test --- core/test/validation_test.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/test/validation_test.jl b/core/test/validation_test.jl index 2f181e5fc..4cbf242da 100644 --- a/core/test/validation_test.jl +++ b/core/test/validation_test.jl @@ -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