summaryrefslogtreecommitdiff
path: root/test/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils.cpp')
-rw-r--r--test/utils.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/utils.cpp b/test/utils.cpp
index 66b91f12..f482e6a1 100644
--- a/test/utils.cpp
+++ b/test/utils.cpp
@@ -6,6 +6,7 @@
*/
#include <iostream>
+#include <map>
#include <sstream>
#include <string>
#include <vector>
@@ -144,6 +145,27 @@ protected:
if (TestPass != testDirname())
return TestFail;
+
+ /* utils::map_keys() test. */
+ const std::map<std::string, unsigned int> map{
+ { "zero", 0 },
+ { "one", 1 },
+ { "two", 2 },
+ };
+ std::vector<std::string> expectedKeys{
+ "zero",
+ "one",
+ "two",
+ };
+
+ std::sort(expectedKeys.begin(), expectedKeys.end());
+
+ const std::vector<std::string> keys = utils::map_keys(map);
+ if (keys != expectedKeys) {
+ cerr << "utils::map_keys() test failed" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};