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 2026/08/21 16:50:43 UTC

(qpid-proton) 03/06: PROTON-2954: Improve testing for pn_data_t

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

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

commit ad3e3f489b086c40de3952dabd59fd8546d54e01
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Wed Aug 19 13:39:23 2026 -0400

    PROTON-2954: Improve testing for pn_data_t
---
 c/tests/data_test.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/c/tests/data_test.cpp b/c/tests/data_test.cpp
index cf2ae8244..10c53ad12 100644
--- a/c/tests/data_test.cpp
+++ b/c/tests/data_test.cpp
@@ -197,6 +197,10 @@ TEST_CASE("data_multiple") {
   pn_data_put_symbol(src, pn_bytes("baz"));
   pn_data_fill(data, "M", src.get());
   CHECK(":baz" == inspect(data));
+}
+
+TEST_CASE("data_described_list") {
+  auto_free<pn_data_t, pn_data_free> data(pn_data(1));
 
   /* Described list with open frame descriptor */
   pn_data_clear(data);
@@ -208,6 +212,24 @@ TEST_CASE("data_multiple") {
   pn_data_fill(data, "DL[SSnI]", (uint64_t)16, "container-1", 0, 965);
   CHECK("@open(16) [container-id=\"container-1\", channel-max=965]" == inspect(data));
 
+  /* Described list with items after the list */
+  pn_data_clear(data);
+  pn_data_fill(data, "DL[SSnI]S", (uint64_t)16, "container-1", 0, 965, "extra");
+  CHECK("@open(16) [container-id=\"container-1\", channel-max=965], \"extra\"" == inspect(data));
+
+  /* Conditional Described list cases */
+  pn_data_clear(data);
+  pn_data_fill(data, "?DL[SSnI]S", false, (uint64_t)16, "container-1", 0, 965, "extra");
+  CHECK("null, \"extra\"" == inspect(data));
+
+  pn_data_clear(data);
+  pn_data_fill(data, "?DL[?SSnI]?S", true, (uint64_t)16, false, "container-1", 0, 965, true, "extra");
+  CHECK("@open(16) [channel-max=965], \"extra\"" == inspect(data));
+}
+
+TEST_CASE("data_map") {
+  auto_free<pn_data_t, pn_data_free> data(pn_data(1));
+
   /* Map */
   pn_data_clear(data);
   pn_data_fill(data, "{S[iii]SI}", "foo", 1, 987, 3, "bar", 965);


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