Skip to content

Commit

Permalink
statetest: Load input labels
Browse files Browse the repository at this point in the history
  • Loading branch information
miles170 authored and chfast committed Oct 22, 2022
1 parent 109cd73 commit c91dbaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/statetest/statetest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct StateTransitionTest
state::BlockInfo block;
TestMultiTransaction multi_tx;
std::vector<Case> cases;
std::unordered_map<uint64_t, std::string> input_labels;
};

StateTransitionTest load_state_test(const fs::path& test_file);
Expand Down
6 changes: 6 additions & 0 deletions test/statetest/statetest_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ static void from_json(const json::json& j, StateTransitionTest& o)

o.block = from_json<state::BlockInfo>(j_t.at("env"));

if (const auto& info = j_t.at("_info"); info.contains("labels"))
{
for (const auto& [j_id, j_label] : info.at("labels").items())
o.input_labels.emplace(from_json<uint64_t>(j_id), j_label);
}

for (const auto& [rev_name, expectations] : j_t.at("post").items())
{
// TODO(c++20): Use emplace_back with aggregate initialization.
Expand Down

0 comments on commit c91dbaa

Please sign in to comment.