aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-02-09 21:11:47 +0900
committerstoffu <stoffu@protonmail.ch>2018-02-12 21:56:36 +0900
commite6a6093871f7afd48e113c2dd0c682d29a8733f5 (patch)
tree2be2859042bee9d504eb55bf6f313b98c57bb3af
parentMerge pull request #3198 (diff)
downloadmonero-e6a6093871f7afd48e113c2dd0c682d29a8733f5.tar.xz
unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map
-rw-r--r--tests/unit_tests/unit_tests_utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/unit_tests/unit_tests_utils.h b/tests/unit_tests/unit_tests_utils.h
index 49301f5a8..ecd97e3d5 100644
--- a/tests/unit_tests/unit_tests_utils.h
+++ b/tests/unit_tests/unit_tests_utils.h
@@ -65,3 +65,10 @@ namespace unit_test
std::atomic<size_t> m_counter;
};
}
+
+# define ASSERT_EQ_MAP(val, map, key) \
+ do { \
+ auto found = map.find(key); \
+ ASSERT_TRUE(found != map.end()); \
+ ASSERT_EQ(val, found->second); \
+ } while (false)