This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new c76823d8b PROTON-2654: [cpp] Tests for newly added map constructors
c76823d8b is described below
commit c76823d8b4fa35200d1426ee15950f79d8063d32
Author: Rakhi Kumari <[email protected]>
AuthorDate: Fri Nov 25 14:44:00 2022 +0530
PROTON-2654: [cpp] Tests for newly added map constructors
---
cpp/src/map_test.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/cpp/src/map_test.cpp b/cpp/src/map_test.cpp
index 680ae5f2e..f7a7177ad 100644
--- a/cpp/src/map_test.cpp
+++ b/cpp/src/map_test.cpp
@@ -114,6 +114,20 @@ void test_value() {
ASSERT_THROWS(conversion_error, m.value(bad));
}
+void test_copy_constructor() {
+ proton::map<string, scalar> m = std::map<string, scalar>{{"a", 2}, {"b",
3}};
+ ASSERT_EQUAL(scalar(2), m.get("a"));
+ ASSERT_EQUAL(scalar(3), m.get("b"));
+ ASSERT_EQUAL(2U, m.size());
+}
+
+void test_initializer_list_constructor() {
+ proton::map<string, scalar> m({{"a", 2}, {"b", 3}});
+ ASSERT_EQUAL(scalar(2), m.get("a"));
+ ASSERT_EQUAL(scalar(3), m.get("b"));
+ ASSERT_EQUAL(2U, m.size());
+}
+
}
int main(int, char**) {
@@ -122,5 +136,7 @@ int main(int, char**) {
RUN_TEST(failed, test_use());
RUN_TEST(failed, test_cppmap());
RUN_TEST(failed, test_value());
+ RUN_TEST(failed, test_copy_constructor());
+ RUN_TEST(failed, test_initializer_list_constructor());
return failed;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]