#include "catch.hpp" #include "vtr_map_util.h" #include "vtr_range.h" #include TEST_CASE("Iterate Map Keys Values", "[vtr_map_util]") { std::vector keys = {0, 1, 2, 3}; std::vector values = {'a', 'b', 'c', 'd'}; //Initialize map std::map map; for (size_t i = 0; i < keys.size(); ++i) { map[keys[i]] = values[i]; } //Check key iteration auto key_range = vtr::make_key_range(map); std::vector seen_keys; for (int key : key_range) { seen_keys.push_back(key); } REQUIRE(seen_keys == keys); //Check value iteration auto value_range = vtr::make_value_range(map); std::vector seen_values; for (char value : value_range) { seen_values.push_back(value); } REQUIRE(seen_values == values); }