Skip to content

Commit

Permalink
Improved json sequence diagram test cases utils
Browse files Browse the repository at this point in the history
  • Loading branch information
bkryza committed Jan 15, 2025
1 parent 93cdd0d commit 9a2fa75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_case_utils/test_case_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,14 @@ int find_message_nested(const nlohmann::json &j, const std::string &from,
if (!j.contains("messages") && !j.contains("message_chains"))
return -1;

if (!chain_index.has_value() && !j.contains("messages"))
if (j.contains("message_chains") && !chain_index.has_value())
return -1;

if (chain_index.has_value() && !j.contains("message_chains"))
if (j.contains("message_chains") &&
j["message_chains"].size() < chain_index.value())
return -1;

const auto &messages = !chain_index.has_value()
const auto &messages = j.contains("messages")
? j["messages"]
: j["message_chains"][chain_index.value()]["messages"];

Expand Down

0 comments on commit 9a2fa75

Please sign in to comment.