Skip to content

Commit

Permalink
[unittests][dataflow] improve logging and error management
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasPaulin committed Oct 17, 2022
1 parent e8c3bd7 commit 3edf3df
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/unittest/Dataflow/customnodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3edf3df

Please sign in to comment.