diff --git a/include/rfl.hpp b/include/rfl.hpp index 7c1e1f1e..fb4fea60 100644 --- a/include/rfl.hpp +++ b/include/rfl.hpp @@ -45,6 +45,7 @@ #include "rfl/UnderlyingEnums.hpp" #include "rfl/Validator.hpp" #include "rfl/Variant.hpp" +#include "rfl/Vectorstring.hpp" #include "rfl/always_false.hpp" #include "rfl/apply.hpp" #include "rfl/as.hpp" diff --git a/include/rfl/Vectorstring.hpp b/include/rfl/Vectorstring.hpp new file mode 100644 index 00000000..8d3d26c9 --- /dev/null +++ b/include/rfl/Vectorstring.hpp @@ -0,0 +1,13 @@ +#ifndef RFL_VECTORSTRING_HPP_ +#define RFL_VECTORSTRING_HPP_ + +#include +#include + +namespace rfl { + +using Vectorstring = std::vector; + +} // namespace rfl + +#endif diff --git a/include/rfl/avro/Reader.hpp b/include/rfl/avro/Reader.hpp index 4c4724ba..faea20c4 100644 --- a/include/rfl/avro/Reader.hpp +++ b/include/rfl/avro/Reader.hpp @@ -12,6 +12,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/is_literal.hpp" #include "../parsing/schemaful/IsSchemafulReader.hpp" @@ -68,15 +69,24 @@ struct Reader { } return std::string(c_str, size - 1); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; const void* ptr = nullptr; size_t size = 0; const auto err = avro_value_get_bytes(_var.val_, &ptr, &size); if (err) { - return error("Could not cast to bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } - const auto data = internal::ptr_cast(ptr); - return rfl::Bytestring(data, data + size); + const auto data = internal::ptr_cast(ptr); + return VectorType(data, data + size); } else if constexpr (std::is_same, bool>()) { if (type != AVRO_BOOLEAN) { return rfl::error("Could not cast to boolean."); diff --git a/include/rfl/avro/Writer.hpp b/include/rfl/avro/Writer.hpp index e07c1a19..b530191d 100644 --- a/include/rfl/avro/Writer.hpp +++ b/include/rfl/avro/Writer.hpp @@ -19,6 +19,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/is_literal.hpp" @@ -186,7 +187,9 @@ class Writer { avro_value_set_string_len(_val, _var.c_str(), _var.size() + 1); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { auto var = _var; avro_value_set_bytes(_val, var.data(), var.size()); diff --git a/include/rfl/bson/Reader.hpp b/include/rfl/bson/Reader.hpp index 02de12ab..d7736bef 100644 --- a/include/rfl/bson/Reader.hpp +++ b/include/rfl/bson/Reader.hpp @@ -21,6 +21,7 @@ #include "../Box.hpp" #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -112,18 +113,34 @@ struct Reader { } } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (btype != BSON_TYPE_BINARY) { - return error("Could not cast to bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } if (value.v_binary.subtype != BSON_SUBTYPE_BINARY) { - return error( - "The BSON subtype must be a binary in order to read into a " - "bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error( + "The BSON subtype must be a binary in order to read into a " + "bytestring."); + } else { + return error( + "The BSON subtype must be a binary in order to read into a " + "vectorstring."); + } } const auto data = - internal::ptr_cast(value.v_binary.data); - return rfl::Bytestring(data, data + value.v_binary.data_len); + internal::ptr_cast(value.v_binary.data); + return VectorType(data, data + value.v_binary.data_len); } else if constexpr (std::is_same, bool>()) { if (btype != BSON_TYPE_BOOL) { diff --git a/include/rfl/bson/Writer.hpp b/include/rfl/bson/Writer.hpp index a3cc42f8..c120350c 100644 --- a/include/rfl/bson/Writer.hpp +++ b/include/rfl/bson/Writer.hpp @@ -18,6 +18,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -101,7 +102,9 @@ class Writer { bson_array_builder_append_utf8(_parent->val_, _var.c_str(), static_cast(_var.size())); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { bson_array_builder_append_binary( _parent->val_, BSON_SUBTYPE_BINARY, internal::ptr_cast(_var.data()), @@ -131,7 +134,9 @@ class Writer { static_cast(_name.size()), _var.c_str(), static_cast(_var.size())); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { bson_append_binary(_parent->val_, _name.data(), static_cast(_name.size()), BSON_SUBTYPE_BINARY, internal::ptr_cast(_var.data()), diff --git a/include/rfl/capnproto/Reader.hpp b/include/rfl/capnproto/Reader.hpp index 767eccf8..7d3a74f4 100644 --- a/include/rfl/capnproto/Reader.hpp +++ b/include/rfl/capnproto/Reader.hpp @@ -12,6 +12,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/is_literal.hpp" #include "../internal/ptr_cast.hpp" @@ -64,13 +65,22 @@ class Reader { return std::string(_var.val_.as().cStr()); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (type != capnp::DynamicValue::DATA) { - return error("Could not cast to bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } const auto data = _var.val_.as(); - const auto begin = internal::ptr_cast(data.begin()); - return rfl::Bytestring(begin, begin + data.size()); + const auto begin = internal::ptr_cast(data.begin()); + return VectorType(begin, begin + data.size()); } else if constexpr (std::is_same, bool>()) { if (type != capnp::DynamicValue::BOOL) { diff --git a/include/rfl/capnproto/Writer.hpp b/include/rfl/capnproto/Writer.hpp index 32c2e58a..7d7f0e31 100644 --- a/include/rfl/capnproto/Writer.hpp +++ b/include/rfl/capnproto/Writer.hpp @@ -20,6 +20,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/is_literal.hpp" #include "../internal/ptr_cast.hpp" @@ -168,7 +169,9 @@ class Writer { _parent->val_.set(_parent->ix_++, _var.c_str()); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { const auto array_ptr = kj::ArrayPtr( internal::ptr_cast(_var.data()), _var.size()); _parent->val_.set(_parent->ix_++, capnp::Data::Reader(array_ptr)); diff --git a/include/rfl/cbor/Reader.hpp b/include/rfl/cbor/Reader.hpp index e3a40538..3672c974 100644 --- a/include/rfl/cbor/Reader.hpp +++ b/include/rfl/cbor/Reader.hpp @@ -11,6 +11,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -73,13 +74,22 @@ class Reader { return _var.val_->as(); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (!_var.val_->is_byte_string()) { - return error("Could not cast to bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } const auto vec = _var.val_->as>(); - const auto data = internal::ptr_cast(vec.data()); - return rfl::Bytestring(data, data + vec.size()); + const auto data = internal::ptr_cast(vec.data()); + return VectorType(data, data + vec.size()); } else if constexpr (std::is_same, bool>()) { if (!_var.val_->is_bool()) { diff --git a/include/rfl/cbor/Writer.hpp b/include/rfl/cbor/Writer.hpp index f31d2d61..28ef5d4b 100644 --- a/include/rfl/cbor/Writer.hpp +++ b/include/rfl/cbor/Writer.hpp @@ -17,6 +17,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" namespace rfl::cbor { @@ -97,7 +98,9 @@ class Writer { if constexpr (std::is_same, std::string>()) { encoder_->string_value(_var); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { encoder_->byte_string_value(_var); } else if constexpr (std::is_same, bool>()) { encoder_->bool_value(_var); diff --git a/include/rfl/flexbuf/Reader.hpp b/include/rfl/flexbuf/Reader.hpp index d23a3717..8772be56 100644 --- a/include/rfl/flexbuf/Reader.hpp +++ b/include/rfl/flexbuf/Reader.hpp @@ -15,6 +15,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -76,13 +77,22 @@ struct Reader { return std::string(_var.AsString().c_str()); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (!_var.IsBlob()) { - return error("Could not cast to a bytestring."); + if constexpr (std::is_same, + rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } const auto blob = _var.AsBlob(); - const auto data = internal::ptr_cast(blob.data()); - return rfl::Bytestring(data, data + blob.size()); + const auto data = internal::ptr_cast(blob.data()); + return VectorType(data, data + blob.size()); } else if constexpr (std::is_same, bool>()) { if (!_var.IsBool()) { diff --git a/include/rfl/flexbuf/Writer.hpp b/include/rfl/flexbuf/Writer.hpp index 90b6302b..9f5f4703 100644 --- a/include/rfl/flexbuf/Writer.hpp +++ b/include/rfl/flexbuf/Writer.hpp @@ -18,6 +18,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" namespace rfl { @@ -96,7 +97,9 @@ struct Writer { if constexpr (std::is_same, std::string>()) { fbb_->String(_name.data(), _var); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { fbb_->Blob(_name.data(), _var.data(), _var.size()); } else if constexpr (std::is_same, bool>()) { fbb_->Bool(_name.data(), _var); diff --git a/include/rfl/generic/Reader.hpp b/include/rfl/generic/Reader.hpp index 8d679448..df5e7c4c 100644 --- a/include/rfl/generic/Reader.hpp +++ b/include/rfl/generic/Reader.hpp @@ -11,7 +11,6 @@ #include #include -#include "../Bytestring.hpp" #include "../Generic.hpp" #include "../Result.hpp" #include "../always_false.hpp" diff --git a/include/rfl/msgpack/Reader.hpp b/include/rfl/msgpack/Reader.hpp index 8e9039b7..71bbc946 100644 --- a/include/rfl/msgpack/Reader.hpp +++ b/include/rfl/msgpack/Reader.hpp @@ -11,6 +11,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -66,13 +67,21 @@ struct Reader { return std::string(str.ptr, str.size); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (type != MSGPACK_OBJECT_BIN) { - return error("Could not cast to a bytestring."); + if constexpr (std::is_same, rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } const auto bin = _var.via.bin; - const auto data = internal::ptr_cast(bin.ptr); - return rfl::Bytestring(data, data + bin.size); + const auto data = internal::ptr_cast(bin.ptr); + return VectorType(data, data + bin.size); } else if constexpr (std::is_same, bool>()) { if (type != MSGPACK_OBJECT_BOOLEAN) { diff --git a/include/rfl/msgpack/Writer.hpp b/include/rfl/msgpack/Writer.hpp index 13cc4e4b..4f1e6767 100644 --- a/include/rfl/msgpack/Writer.hpp +++ b/include/rfl/msgpack/Writer.hpp @@ -14,10 +14,11 @@ #include #include "../Box.hpp" +#include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" -#include "../Bytestring.hpp" namespace rfl::msgpack { @@ -97,7 +98,7 @@ class Writer { if constexpr (std::is_same()) { msgpack_pack_str(pk_, _var.size()); msgpack_pack_str_body(pk_, _var.c_str(), _var.size()); - } else if constexpr (std::is_same()) { + } else if constexpr (std::is_same() || std::is_same()) { msgpack_pack_bin(pk_, _var.size()); msgpack_pack_bin_body(pk_, _var.data(), _var.size()); } else if constexpr (std::is_same()) { diff --git a/include/rfl/parsing/Parser.hpp b/include/rfl/parsing/Parser.hpp index e7f2ed8d..a1a9c8a7 100644 --- a/include/rfl/parsing/Parser.hpp +++ b/include/rfl/parsing/Parser.hpp @@ -28,6 +28,7 @@ #include "Parser_tuple.hpp" #include "Parser_unique_ptr.hpp" #include "Parser_variant.hpp" +#include "Parser_vectorstring.hpp" #include "Parser_vector_like.hpp" #include "Parser_wstring.hpp" diff --git a/include/rfl/parsing/Parser_vectorstring.hpp b/include/rfl/parsing/Parser_vectorstring.hpp new file mode 100644 index 00000000..480e77bc --- /dev/null +++ b/include/rfl/parsing/Parser_vectorstring.hpp @@ -0,0 +1,38 @@ +#ifndef RFL_PARSING_PARSER_VECTORSRING_HPP_ +#define RFL_PARSING_PARSER_VECTORSRING_HPP_ + +#include + +#include "../Vectorstring.hpp" +#include "../Result.hpp" +#include "Parser_base.hpp" +#include "schema/Type.hpp" + +namespace rfl::parsing { + +template + requires AreReaderAndWriter +struct Parser { + using InputVarType = typename R::InputVarType; + using ParentType = Parent; + + static Result read(const R& _r, + const InputVarType& _var) noexcept { + return _r.template to_basic_type(_var); + } + + template + static void write(const W& _w, const Vectorstring& _b, + const P& _parent) noexcept { + ParentType::add_value(_w, _b, _parent); + } + + static schema::Type to_schema( + std::map* _definitions) { + return schema::Type{schema::Type::Vectorstring{}}; + } +}; + +} // namespace rfl::parsing + +#endif diff --git a/include/rfl/parsing/VectorParser.hpp b/include/rfl/parsing/VectorParser.hpp index b6ac9cfe..2c92762d 100644 --- a/include/rfl/parsing/VectorParser.hpp +++ b/include/rfl/parsing/VectorParser.hpp @@ -9,6 +9,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "MapParser.hpp" #include "Parent.hpp" @@ -40,6 +41,8 @@ struct VectorParser { static_assert(!std::is_same_v, Bytestring>, "Cannot be a bytestring."); + static_assert(!std::is_same_v, Vectorstring>, + "Cannot be a vectorstring."); static Result read(const R& _r, const InputVarType& _var) noexcept { if constexpr (treat_as_map()) { diff --git a/include/rfl/parsing/schema/Type.hpp b/include/rfl/parsing/schema/Type.hpp index a5372308..0515a9d9 100644 --- a/include/rfl/parsing/schema/Type.hpp +++ b/include/rfl/parsing/schema/Type.hpp @@ -18,6 +18,8 @@ struct Type { struct Bytestring {}; + struct Vectorstring {}; + struct Int32 {}; struct Int64 {}; @@ -88,7 +90,7 @@ struct Type { }; using VariantType = - rfl::Variant; diff --git a/include/rfl/ubjson/Reader.hpp b/include/rfl/ubjson/Reader.hpp index 8ae37af7..cb359f21 100644 --- a/include/rfl/ubjson/Reader.hpp +++ b/include/rfl/ubjson/Reader.hpp @@ -11,6 +11,7 @@ #include "../Bytestring.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" #include "../internal/ptr_cast.hpp" @@ -73,13 +74,21 @@ class Reader { return _var.val_->as(); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { + using VectorType = std::remove_cvref_t; + using ValueType = typename VectorType::value_type; if (!_var.val_->is>()) { - return error("Could not cast to bytestring."); + if constexpr (std::is_same, rfl::Bytestring>()) { + return error("Could not cast to bytestring."); + } else { + return error("Could not cast to vectorstring."); + } } const auto vec = _var.val_->as>(); - const auto data = internal::ptr_cast(vec.data()); - return rfl::Bytestring(data, data + vec.size()); + const auto data = internal::ptr_cast(vec.data()); + return VectorType(data, data + vec.size()); } else if constexpr (std::is_same, bool>()) { if (!_var.val_->is_bool()) { diff --git a/include/rfl/ubjson/Writer.hpp b/include/rfl/ubjson/Writer.hpp index 9c5905e8..4208e611 100644 --- a/include/rfl/ubjson/Writer.hpp +++ b/include/rfl/ubjson/Writer.hpp @@ -17,6 +17,7 @@ #include "../Bytestring.hpp" #include "../Ref.hpp" #include "../Result.hpp" +#include "../Vectorstring.hpp" #include "../always_false.hpp" namespace rfl::ubjson { @@ -97,7 +98,9 @@ class Writer { if constexpr (std::is_same, std::string>()) { encoder_->string_value(_var); } else if constexpr (std::is_same, - rfl::Bytestring>()) { + rfl::Bytestring>() || + std::is_same, + rfl::Vectorstring>()) { encoder_->byte_string_value(_var); } else if constexpr (std::is_same, bool>()) { encoder_->bool_value(_var); diff --git a/src/rfl/avro/to_schema.cpp b/src/rfl/avro/to_schema.cpp index a9c86fc6..1e40d938 100644 --- a/src/rfl/avro/to_schema.cpp +++ b/src/rfl/avro/to_schema.cpp @@ -50,7 +50,8 @@ schema::Type type_to_avro_schema_type( if constexpr (std::is_same()) { return schema::Type{.value = schema::Type::Boolean{}}; - } else if constexpr (std::is_same()) { + } else if constexpr (std::is_same() || + std::is_same()) { return schema::Type{.value = schema::Type::Bytes{}}; } else if constexpr (std::is_same() || diff --git a/src/rfl/capnproto/to_schema.cpp b/src/rfl/capnproto/to_schema.cpp index 3057a60e..dbef44c4 100644 --- a/src/rfl/capnproto/to_schema.cpp +++ b/src/rfl/capnproto/to_schema.cpp @@ -150,7 +150,8 @@ schema::Type type_to_capnproto_schema_type( if constexpr (std::is_same()) { return schema::Type{.value = schema::Type::Bool{}}; - } else if constexpr (std::is_same()) { + } else if constexpr (std::is_same() || + std::is_same()) { return schema::Type{.value = schema::Type::Data{}}; } else if constexpr (std::is_same() || diff --git a/src/rfl/json/to_schema.cpp b/src/rfl/json/to_schema.cpp index d487d922..33274695 100644 --- a/src/rfl/json/to_schema.cpp +++ b/src/rfl/json/to_schema.cpp @@ -196,7 +196,8 @@ schema::Type type_to_json_schema_type(const parsing::schema::Type& _type, return schema::Type{.value = schema::Type::Number{}}; } else if constexpr (std::is_same() || - std::is_same()) { + std::is_same() || + std::is_same()) { return schema::Type{.value = schema::Type::String{}}; } else if constexpr (std::is_same()) { diff --git a/tests/bson/test_vectorstring.cpp b/tests/bson/test_vectorstring.cpp new file mode 100644 index 00000000..0cea16d1 --- /dev/null +++ b/tests/bson/test_vectorstring.cpp @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +#include "write_and_read.hpp" + +namespace test_vectorstring { + +struct TestStruct { + rfl::Vectorstring vectorstring; + std::vector vectorstrings; +}; + +TEST(bson, test_vectorstring) { + const auto vstr = rfl::Vectorstring( + {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}); + const auto test = TestStruct{ + .vectorstring = vstr, + .vectorstrings = std::vector({vstr, vstr, vstr})}; + write_and_read(test); +} +} // namespace test_vectorstring diff --git a/tests/cbor/test_vectorstring.cpp b/tests/cbor/test_vectorstring.cpp new file mode 100644 index 00000000..dc424614 --- /dev/null +++ b/tests/cbor/test_vectorstring.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#include "write_and_read.hpp" + +namespace test_vectorstring { + +struct TestStruct { + rfl::Vectorstring vectorstring; +}; + +TEST(cbor, test_vectorstring) { + const auto test = TestStruct{ + .vectorstring = rfl::Vectorstring({'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'})}; + + write_and_read(test); +} +} // namespace test_vectorstring diff --git a/tests/msgpack/test_vectorstring.cpp b/tests/msgpack/test_vectorstring.cpp new file mode 100644 index 00000000..11e83a67 --- /dev/null +++ b/tests/msgpack/test_vectorstring.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#include "write_and_read.hpp" + +namespace test_vectorstring { + +struct TestStruct { + rfl::Vectorstring vectorstring; +}; + +TEST(msgpack, test_vectorstring) { + const auto test = + TestStruct{.vectorstring = rfl::Vectorstring({'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'})}; + + write_and_read(test); +} +} // namespace test_vectorstring \ No newline at end of file diff --git a/tests/ubjson/test_vectorstring.cpp b/tests/ubjson/test_vectorstring.cpp new file mode 100644 index 00000000..7e7c44ff --- /dev/null +++ b/tests/ubjson/test_vectorstring.cpp @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#include "write_and_read.hpp" + +namespace test_vectorstring { + +struct TestStruct { + rfl::Vectorstring vectorstring; +}; + +TEST(ubjson, test_vectorstring) { + const auto test = + TestStruct{.vectorstring = rfl::Vectorstring({'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'})}; + + write_and_read(test); +} +} // namespace test_vectorstring \ No newline at end of file