From 8887d1e755a423236635031b55e954ff8df1caa5 Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Fri, 27 Sep 2024 14:41:52 +0000 Subject: [PATCH] Revise realization config and unit test code --- data/example_domainlayer_realization_config.json | 6 +++--- test/core/multilayer/DomainLayerTest.cpp | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/data/example_domainlayer_realization_config.json b/data/example_domainlayer_realization_config.json index 3322fa9e32..e8edcc7253 100644 --- a/data/example_domainlayer_realization_config.json +++ b/data/example_domainlayer_realization_config.json @@ -61,7 +61,7 @@ }, "layer_name": "domain_layer", "time_step_units": "s", - "id": 0, + "id": 1, "time_step": 3600, "domain": "catchments" }, @@ -89,7 +89,7 @@ }, "layer_name": "domain_layer", "time_step_units": "s", - "id": 0, + "id": 2, "time_step": 3600, "domain": "catchments" }, @@ -117,7 +117,7 @@ }, "layer_name": "domain_layer", "time_step_units": "s", - "id": 0, + "id": 3, "time_step": 3600, "domain": "catchments" } diff --git a/test/core/multilayer/DomainLayerTest.cpp b/test/core/multilayer/DomainLayerTest.cpp index a6fc23dd16..9782f80afa 100644 --- a/test/core/multilayer/DomainLayerTest.cpp +++ b/test/core/multilayer/DomainLayerTest.cpp @@ -83,16 +83,21 @@ TEST_F(DomainLayerTest, TestRead0) double c_value = UnitsHelper::get_converted_value(m_data.time_step_units,m_data.time_step,"s"); time_steps.push_back(c_value); } - boost::range::sort(keys, std::greater()); + //boost::range::sort(keys, std::greater()); + boost::range::sort(keys); std::vector > layers; layers.resize(keys.size()); for(long i = 0; i < keys.size(); ++i) { auto desc = layer_meta_data.get_layer(keys[i]); - ASSERT_EQ(desc.name, "domain_layer"); + if (i == 0) { + ASSERT_EQ(desc.name, "surface layer"); + } else { + ASSERT_EQ(desc.name, "domain_layer"); + } ASSERT_EQ(desc.time_step_units, "s"); - ASSERT_EQ(desc.id, 0); + ASSERT_EQ(desc.id, i); ASSERT_EQ(desc.time_step, 3600); }