Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/include/join/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,9 @@ namespace join
case StringValue:
return _data.template get<StringValue> ().empty ();

case BinaryValue:
return _data.template get<BinaryValue> ().data.empty ();

case ArrayValue:
return _data.template get<ArrayValue> ().empty ();

Expand All @@ -2250,6 +2253,9 @@ namespace join
case StringValue:
return _data.template get<StringValue> ().size ();

case BinaryValue:
return _data.template get<BinaryValue> ().data.size ();

case ArrayValue:
return _data.template get<ArrayValue> ().size ();

Expand Down
14 changes: 14 additions & 0 deletions data/tests/value_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const uint8_t> ();
ASSERT_TRUE (value.empty ());

value = std::span<const uint8_t> (bytes, sizeof (bytes));
ASSERT_FALSE (value.empty ());

value = Array ();
ASSERT_TRUE (value.empty ());

Expand Down Expand Up @@ -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<const uint8_t> ();
ASSERT_EQ (value.size (), 0);

value = std::span<const uint8_t> (bytes, sizeof (bytes));
ASSERT_EQ (value.size (), 3);

value = array.getArray ();
ASSERT_EQ (value.size (), 1);

Expand Down
Loading