Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.29
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mapiterators.cpp
2#include <catch2/catch_test_macros.hpp>
3
4#include <string>
5#include <utility>
6
7TEST_CASE( "Core/Utils/StdMapIterators", "[unittests][Core][Core/Utils][StdMapIterators]" ) {
8 std::map<int, std::string> myMap { { 2, "2" }, { 3, "3" } };
9
11 for ( const auto& k : Ra::Core::Utils::map_keys( myMap ) )
12 REQUIRE( k == std::stoi( myMap[k] ) );
14
16 for ( auto& v : Ra::Core::Utils::map_values( myMap ) )
17 v = std::string( "-" ) + v;
19
20 for ( const auto& k : Ra::Core::Utils::map_keys( myMap ) )
21 REQUIRE( k == -std::stoi( myMap[k] ) );
22}
T stoi(T... args)
Generate a range to iterate over the keys of a map.
Generate a range to iterate over the values of a map.