diff options
author | stoffu <stoffu@protonmail.ch> | 2018-02-09 21:11:47 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-02-12 21:56:36 +0900 |
commit | e6a6093871f7afd48e113c2dd0c682d29a8733f5 (patch) | |
tree | 2be2859042bee9d504eb55bf6f313b98c57bb3af /tests/unit_tests/unit_tests_utils.h | |
parent | Merge pull request #3198 (diff) | |
download | monero-e6a6093871f7afd48e113c2dd0c682d29a8733f5.tar.xz |
unit_tests: added gtest utility ASSERT_EQ_MAP for easily testing key-value map
Diffstat (limited to '')
-rw-r--r-- | tests/unit_tests/unit_tests_utils.h | 7 |
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) |