Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/fixed_hierarchy_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "phlex/model/data_cell_index.hpp"
#include "phlex/model/fixed_hierarchy.hpp"
#include "phlex/utilities/resumable_driver.hpp"

#include "catch2/catch_test_macros.hpp"
#include "catch2/matchers/catch_matchers_string.hpp"
Expand Down Expand Up @@ -124,3 +125,21 @@ TEST_CASE("Paths with and without 'job' prefix produce the same hierarchy", "[fi
ContainsSubstring("Layer /job/unknown is not part of the fixed hierarchy"));
}
}

TEST_CASE("Cursor yields and traverses child indices", "[fixed_hierarchy]")
{
detail::framework_driver driver{[](detail::framework_driver& d) {
fixed_hierarchy const hierarchy{{"run", "subrun"}};
auto job_cursor = hierarchy.yield_job(d);
auto copied_job_cursor = job_cursor; // Test copy-constructibility of the cursor.
auto run_cursor = copied_job_cursor.yield_child("run", 0);
run_cursor.yield_child("subrun", 0);
}};

std::vector<experimental::layer_path> yielded;
while (auto index = driver()) {
yielded.push_back((*index)->layer_path());
}

CHECK(yielded == std::vector<experimental::layer_path>{"/job", "/job/run", "/job/run/subrun"});
}
Loading