From 3edf3df4acc399d8bcf421dce031b99edafa70ff Mon Sep 17 00:00:00 2001 From: Mathias Paulin Date: Fri, 14 Oct 2022 16:11:34 +0200 Subject: [PATCH] [unittests][dataflow] improve logging and error management --- tests/unittest/Dataflow/customnodes.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/unittest/Dataflow/customnodes.cpp b/tests/unittest/Dataflow/customnodes.cpp index 7220b7e0325..35598eabaef 100644 --- a/tests/unittest/Dataflow/customnodes.cpp +++ b/tests/unittest/Dataflow/customnodes.cpp @@ -69,20 +69,21 @@ class FilterSelector final : public Node T getThreshold() const { return m_threshold; } protected: - void fromJsonInternal( const nlohmann::json& jsonData ) override { - if ( jsonData.contains( "operator" ) ) { m_operatorName = jsonData["operator"]; } + bool fromJsonInternal( const nlohmann::json& data ) override { + if ( data.contains( "operator" ) ) { m_operatorName = data["operator"]; } else { m_operatorName = "true"; } - if ( jsonData.contains( "threshold" ) ) { m_threshold = jsonData["threshold"]; } + if ( data.contains( "threshold" ) ) { m_threshold = data["threshold"]; } else { m_threshold = T {}; } + return true; } - void toJsonInternal( nlohmann::json& jsonData ) const override { - jsonData["operator"] = m_operatorName; - jsonData["threshold"] = m_threshold; + void toJsonInternal( nlohmann::json& data ) const override { + data["operator"] = m_operatorName; + data["threshold"] = m_threshold; } public: