You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2023/06/08 19:46:40 UTC

[qpid-proton] branch main updated (e4e8da31d -> f394976bc)

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


    from e4e8da31d PROTON-2743: Cannot log raw incoming frames
     new 6d83cf2ce NO-JIRA: Use a bit more C++11 in C++ connection driver test
     new f394976bc No-JIRA: Update unit tests to use C++11 features not macros

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 c/tests/connection_driver_test.cpp | 52 +++++++++++++++++++-------------------
 c/tests/pn_test.cpp                | 11 --------
 c/tests/pn_test.hpp                |  5 ----
 c/tests/proactor_test.cpp          | 18 ++++++-------
 cpp/src/connection_driver_test.cpp |  8 ++----
 5 files changed, 37 insertions(+), 57 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton] 02/02: No-JIRA: Update unit tests to use C++11 features not macros

Posted by as...@apache.org.
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

commit f394976bc6e0eeb3cc7d7a2ee6daec457dbf03bd
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Thu May 11 15:21:59 2023 -0400

    No-JIRA: Update unit tests to use C++11 features not macros
---
 c/tests/connection_driver_test.cpp | 52 +++++++++++++++++++-------------------
 c/tests/pn_test.cpp                | 11 --------
 c/tests/pn_test.hpp                |  5 ----
 c/tests/proactor_test.cpp          | 18 ++++++-------
 4 files changed, 35 insertions(+), 51 deletions(-)

diff --git a/c/tests/connection_driver_test.cpp b/c/tests/connection_driver_test.cpp
index 984bad200..46dcb9c59 100644
--- a/c/tests/connection_driver_test.cpp
+++ b/c/tests/connection_driver_test.cpp
@@ -109,19 +109,19 @@ TEST_CASE("driver_message_transfer") {
   pn_link_open(snd);
   d.run();
 
-  CHECK_THAT(ETYPES(PN_CONNECTION_INIT, PN_CONNECTION_LOCAL_OPEN,
-                    PN_SESSION_INIT, PN_SESSION_LOCAL_OPEN, PN_LINK_INIT,
-                    PN_LINK_LOCAL_OPEN, PN_CONNECTION_BOUND,
-                    PN_CONNECTION_REMOTE_OPEN, PN_SESSION_REMOTE_OPEN,
-                    PN_LINK_REMOTE_OPEN),
+  CHECK_THAT((etypes{PN_CONNECTION_INIT, PN_CONNECTION_LOCAL_OPEN,
+                     PN_SESSION_INIT, PN_SESSION_LOCAL_OPEN, PN_LINK_INIT,
+                     PN_LINK_LOCAL_OPEN, PN_CONNECTION_BOUND,
+                     PN_CONNECTION_REMOTE_OPEN, PN_SESSION_REMOTE_OPEN,
+                     PN_LINK_REMOTE_OPEN}),
              Equals(client.log_clear()));
 
-  CHECK_THAT(ETYPES(PN_CONNECTION_INIT, PN_CONNECTION_BOUND,
-                    PN_CONNECTION_REMOTE_OPEN, PN_SESSION_INIT,
-                    PN_SESSION_REMOTE_OPEN, PN_LINK_INIT, PN_LINK_REMOTE_OPEN,
-                    PN_CONNECTION_LOCAL_OPEN, PN_TRANSPORT,
-                    PN_SESSION_LOCAL_OPEN, PN_TRANSPORT, PN_LINK_LOCAL_OPEN,
-                    PN_TRANSPORT),
+  CHECK_THAT((etypes{PN_CONNECTION_INIT, PN_CONNECTION_BOUND,
+                     PN_CONNECTION_REMOTE_OPEN, PN_SESSION_INIT,
+                     PN_SESSION_REMOTE_OPEN, PN_LINK_INIT, PN_LINK_REMOTE_OPEN,
+                     PN_CONNECTION_LOCAL_OPEN, PN_TRANSPORT,
+                     PN_SESSION_LOCAL_OPEN, PN_TRANSPORT, PN_LINK_LOCAL_OPEN,
+                     PN_TRANSPORT}),
              Equals(server.log_clear()));
 
   pn_link_t *rcv = server.link;
@@ -129,7 +129,7 @@ TEST_CASE("driver_message_transfer") {
   REQUIRE(pn_link_is_receiver(rcv));
   pn_link_flow(rcv, 1);
   d.run();
-  CHECK_THAT(ETYPES(PN_LINK_FLOW), Equals(client.log_clear()));
+  CHECK_THAT((etypes{PN_LINK_FLOW}), Equals(client.log_clear()));
 
   /* Encode and send a message */
   auto_free<pn_message_t, pn_message_free> m(pn_message());
@@ -139,7 +139,7 @@ TEST_CASE("driver_message_transfer") {
   pn_message_send(m, snd, NULL);
 
   d.run();
-  CHECK_THAT(ETYPES(PN_TRANSPORT, PN_DELIVERY), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_TRANSPORT, PN_DELIVERY}), Equals(server.log_clear()));
 
   /* Receive and decode the message */
   pn_delivery_t *dlv = server.delivery;
@@ -214,7 +214,7 @@ TEST_CASE("driver_message_stream") {
     ssize_t c = (i + CHUNK < size) ? CHUNK : size - i;
     CHECK(c == pn_link_send(snd, buf.start + i, c));
     d.run();
-    CHECK_THAT(ETYPES(PN_DELIVERY), Equals(server.log_clear()));
+    CHECK_THAT((etypes{PN_DELIVERY}), Equals(server.log_clear()));
     /* Receive a chunk */
     pn_delivery_t *dlv = server.delivery;
     pn_link_t *l = pn_delivery_link(dlv);
@@ -298,7 +298,7 @@ TEST_CASE("driver_message_abort") {
   CHECK_FALSE(d.run());
   CHECK_THAT(server.log_clear(), Equals(etypes()));
   /* Client gets transport/flow after abort to ensure other messages are sent */
-  CHECK_THAT(ETYPES(PN_TRANSPORT, PN_LINK_FLOW), Equals(client.log_clear()));
+  CHECK_THAT((etypes{PN_TRANSPORT, PN_LINK_FLOW}), Equals(client.log_clear()));
   /* Aborted delivery consumes no credit */
   CHECK(1 == pn_link_credit(rcv));
   CHECK(1 == pn_link_credit(snd));
@@ -383,7 +383,7 @@ TEST_CASE("driver_message_abort_mixed") {
   pn_delivery_abort(sd);
   CHECK(pn_link_current(snd) != sd); /* Advanced */
   d.run();
-  CHECK_THAT(ETYPES(PN_TRANSPORT), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_TRANSPORT}), Equals(server.log_clear()));
   /* Aborting wit no frames sent should leave credit untouched */
   CHECK(2 == pn_link_credit(snd));
   CHECK(2 == pn_link_credit(rcv));
@@ -510,16 +510,16 @@ TEST_CASE("driver_duplicate_link_client", "[!hide][!shouldfail]") {
   pn_link_open(pn_sender(ssn, "x"));
   d.run();
 
-  CHECK_THAT(ETYPES(PN_LINK_REMOTE_CLOSE, PN_LINK_LOCAL_CLOSE, PN_TRANSPORT,
-                    PN_LINK_INIT, PN_LINK_REMOTE_OPEN, PN_LINK_LOCAL_OPEN,
-                    PN_TRANSPORT),
+  CHECK_THAT((etypes{PN_LINK_REMOTE_CLOSE, PN_LINK_LOCAL_CLOSE, PN_TRANSPORT,
+                     PN_LINK_INIT, PN_LINK_REMOTE_OPEN, PN_LINK_LOCAL_OPEN,
+                     PN_TRANSPORT}),
              Equals(server.log_clear()));
   CHECK_THAT(*pn_transport_condition(d.server.transport), cond_empty());
 
   d.run();
-  CHECK_THAT(ETYPES(PN_LINK_LOCAL_CLOSE, PN_TRANSPORT, PN_LINK_REMOTE_CLOSE,
-                    PN_LINK_INIT, PN_LINK_LOCAL_OPEN, PN_TRANSPORT,
-                    PN_LINK_REMOTE_OPEN),
+  CHECK_THAT((etypes{PN_LINK_LOCAL_CLOSE, PN_TRANSPORT, PN_LINK_REMOTE_CLOSE,
+                     PN_LINK_INIT, PN_LINK_LOCAL_OPEN, PN_TRANSPORT,
+                     PN_LINK_REMOTE_OPEN}),
              Equals(client.log_clear()));
   CHECK_THAT(*pn_connection_remote_condition(d.client.connection),
              cond_empty());
@@ -545,7 +545,7 @@ TEST_CASE("driver_settle_incomplete_receiver") {
   CHECK(sizeof(data) == pn_link_send(snd, data, sizeof(data)));
   server.log_clear();
   d.run();
-  CHECK_THAT(ETYPES(PN_DELIVERY), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_DELIVERY}), Equals(server.log_clear()));
   CHECK(sizeof(data) == pn_link_recv(rcv, rbuf, sizeof(data)));
   d.run();
 
@@ -566,7 +566,7 @@ TEST_CASE("driver_settle_incomplete_receiver") {
   CHECK(sizeof(data) == pn_link_send(snd, data, sizeof(data)));
   server.log_clear();
   d.run();
-  CHECK_THAT(ETYPES(PN_DELIVERY), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_DELIVERY}), Equals(server.log_clear()));
   CHECK(sizeof(data) == pn_link_recv(rcv, rbuf, sizeof(data)));
   pn_delivery_tag_t tag = pn_delivery_tag(pn_link_current(rcv));
   CHECK(tag.size == 1);
@@ -596,7 +596,7 @@ TEST_CASE("driver_empty_last_frame") {
   CHECK(sizeof(data) == pn_link_send(snd, data, sizeof(data)));
   server.log_clear();
   d.run();
-  CHECK_THAT(ETYPES(PN_DELIVERY), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_DELIVERY}), Equals(server.log_clear()));
   CHECK(sizeof(data) == pn_link_recv(rcv, rbuf, sizeof(data)));
   CHECK(pn_delivery_partial(pn_link_current(rcv)));
   d.run();
@@ -605,7 +605,7 @@ TEST_CASE("driver_empty_last_frame") {
   CHECK(pn_link_advance(snd));
   server.log_clear();
   d.run();
-  CHECK_THAT(ETYPES(PN_DELIVERY), Equals(server.log_clear()));
+  CHECK_THAT((etypes{PN_DELIVERY}), Equals(server.log_clear()));
   CHECK(PN_EOS == pn_link_recv(rcv, rbuf, sizeof(data)));
   CHECK(!pn_delivery_partial(pn_link_current(rcv)));
 
diff --git a/c/tests/pn_test.cpp b/c/tests/pn_test.cpp
index 03a2526d5..fa793a395 100644
--- a/c/tests/pn_test.cpp
+++ b/c/tests/pn_test.cpp
@@ -66,17 +66,6 @@ std::string inspect(void *obj) {
   return r;
 }
 
-etypes make_etypes_(int first, ...) {
-  etypes v;
-  va_list ap;
-  va_start(ap, first);
-  for (int i = first; i >= 0; i = va_arg(ap, int)) {
-    v.push_back(static_cast<pn_event_type_t>(i));
-  }
-  va_end(ap);
-  return v;
-}
-
 std::ostream &operator<<(std::ostream &o, const etypes &et) {
   return o << Catch::Detail::stringify(static_cast<std::vector<pn_event_type_t> >(et));
 }
diff --git a/c/tests/pn_test.hpp b/c/tests/pn_test.hpp
index b14012b16..ae8c37d32 100644
--- a/c/tests/pn_test.hpp
+++ b/c/tests/pn_test.hpp
@@ -65,11 +65,6 @@ std::string inspect(void *);
 typedef std::vector<pn_event_type_t> etypes;
 std::ostream &operator<<(std::ostream &o, const etypes &et);
 
-// Workaround for lack of list initializers in C++03.
-// Use ETYPES macro, don't call make_etypes_ directly
-etypes make_etypes_(int first, ...);
-#define ETYPES(...) (make_etypes_(__VA_ARGS__, -1))
-
 /// Make a pn_bytes_t from a std::string
 pn_bytes_t pn_bytes(const std::string &s);
 
diff --git a/c/tests/proactor_test.cpp b/c/tests/proactor_test.cpp
index 07a13ba18..98124a9e6 100644
--- a/c/tests/proactor_test.cpp
+++ b/c/tests/proactor_test.cpp
@@ -244,16 +244,16 @@ TEST_CASE("proactor_abort") {
   REQUIRE_RUN(p, PN_PROACTOR_INACTIVE);
 
   /* Verify expected event sequences, no unexpected events */
-  CHECK_THAT(ETYPES(PN_CONNECTION_INIT, PN_CONNECTION_LOCAL_OPEN,
-                    PN_CONNECTION_BOUND, PN_TRANSPORT_TAIL_CLOSED,
-                    PN_TRANSPORT_ERROR, PN_TRANSPORT_HEAD_CLOSED,
-                    PN_TRANSPORT_CLOSED),
+  CHECK_THAT((etypes{PN_CONNECTION_INIT, PN_CONNECTION_LOCAL_OPEN,
+                     PN_CONNECTION_BOUND, PN_TRANSPORT_TAIL_CLOSED,
+                     PN_TRANSPORT_ERROR, PN_TRANSPORT_HEAD_CLOSED,
+                     PN_TRANSPORT_CLOSED}),
              Equals(ch.log_clear()));
-  CHECK_THAT(ETYPES(PN_LISTENER_OPEN, PN_LISTENER_ACCEPT, PN_CONNECTION_INIT,
-                    PN_CONNECTION_BOUND, PN_CONNECTION_REMOTE_OPEN,
-                    PN_TRANSPORT_TAIL_CLOSED, PN_TRANSPORT_ERROR,
-                    PN_TRANSPORT_HEAD_CLOSED, PN_TRANSPORT_CLOSED,
-                    PN_LISTENER_CLOSE, PN_PROACTOR_INACTIVE),
+  CHECK_THAT((etypes{PN_LISTENER_OPEN, PN_LISTENER_ACCEPT, PN_CONNECTION_INIT,
+                     PN_CONNECTION_BOUND, PN_CONNECTION_REMOTE_OPEN,
+                     PN_TRANSPORT_TAIL_CLOSED, PN_TRANSPORT_ERROR,
+                     PN_TRANSPORT_HEAD_CLOSED, PN_TRANSPORT_CLOSED,
+                     PN_LISTENER_CLOSE, PN_PROACTOR_INACTIVE}),
              Equals(sh.log_clear()));
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[qpid-proton] 01/02: NO-JIRA: Use a bit more C++11 in C++ connection driver test

Posted by as...@apache.org.
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

commit 6d83cf2cecdb2e1378533caa142eb171dd9bed98
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Mon May 1 23:00:58 2023 -0400

    NO-JIRA: Use a bit more C++11 in C++ connection driver test
---
 cpp/src/connection_driver_test.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/cpp/src/connection_driver_test.cpp b/cpp/src/connection_driver_test.cpp
index b56cd07e1..608e48e8e 100644
--- a/cpp/src/connection_driver_test.cpp
+++ b/cpp/src/connection_driver_test.cpp
@@ -440,15 +440,11 @@ void test_link_capability_filter() {
     driver_pair d(ha, hb);
 
     // Capabilities and filters
-    std::vector<proton::symbol> caps;
-    caps.push_back("foo");
-    caps.push_back("bar");
+    std::vector<proton::symbol> caps = {"foo", "bar"};
 
     d.a.connection().open_sender("x", sender_options().target(target_options().capabilities(caps)));
 
-    source::filter_map f;
-    f.put("1", "11");
-    f.put("2", "22");
+    source::filter_map f = {{"1", "11"}, {"2", "22"}};
     d.a.connection().open_receiver("y", receiver_options().source(source_options().filters(f).capabilities(caps)));
     while (ha.link_count()+hb.link_count() < 4) d.process();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org