From 4e8351eff282ddafdc163c051925c688cc11e0bb Mon Sep 17 00:00:00 2001 From: mrabine Date: Tue, 10 Nov 2026 22:33:12 +0100 Subject: [PATCH] Value binary size --- data/include/join/value.hpp | 6 ++++++ data/tests/value_test.cpp | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/data/include/join/value.hpp b/data/include/join/value.hpp index 975eb0a9..f56687d3 100644 --- a/data/include/join/value.hpp +++ b/data/include/join/value.hpp @@ -2225,6 +2225,9 @@ namespace join case StringValue: return _data.template get ().empty (); + case BinaryValue: + return _data.template get ().data.empty (); + case ArrayValue: return _data.template get ().empty (); @@ -2250,6 +2253,9 @@ namespace join case StringValue: return _data.template get ().size (); + case BinaryValue: + return _data.template get ().data.size (); + case ArrayValue: return _data.template get ().size (); diff --git a/data/tests/value_test.cpp b/data/tests/value_test.cpp index c531c361..347485f7 100644 --- a/data/tests/value_test.cpp +++ b/data/tests/value_test.cpp @@ -4990,6 +4990,13 @@ TEST (Value, empty) value = "127.0.0.1"; ASSERT_FALSE (value.empty ()); + const uint8_t bytes[] = {0x00, 0x01, 0xff}; + value = std::span (); + ASSERT_TRUE (value.empty ()); + + value = std::span (bytes, sizeof (bytes)); + ASSERT_FALSE (value.empty ()); + value = Array (); ASSERT_TRUE (value.empty ()); @@ -5098,6 +5105,13 @@ TEST (Value, size) value = "127.0.0.1"; ASSERT_EQ (value.size (), 9); + const uint8_t bytes[] = {0x00, 0x01, 0xff}; + value = std::span (); + ASSERT_EQ (value.size (), 0); + + value = std::span (bytes, sizeof (bytes)); + ASSERT_EQ (value.size (), 3); + value = array.getArray (); ASSERT_EQ (value.size (), 1);