aboutsummaryrefslogtreecommitdiff
path: root/src/test/streams_tests.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-04-03 13:42:55 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-05-05 20:19:03 +0200
commitfa2204f6adef493079d1ca5148b0fdc2b55816e6 (patch)
tree52355efc18d481328f01c7877cb0d93983669882 /src/test/streams_tests.cpp
parent128b98fce36db8d4a85e056a30e141fc117f3390 (diff)
streams: Accept URef obj for VectorReader unserialize
Diffstat (limited to 'src/test/streams_tests.cpp')
-rw-r--r--src/test/streams_tests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index 3079c9ff29..7af2b79f37 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -112,6 +112,17 @@ BOOST_AUTO_TEST_CASE(streams_vector_reader)
BOOST_CHECK_THROW(new_reader >> d, std::ios_base::failure);
}
+BOOST_AUTO_TEST_CASE(streams_vector_reader_rvalue)
+{
+ std::vector<uint8_t> data{0x82, 0xa7, 0x31};
+ VectorReader reader(SER_NETWORK, INIT_PROTO_VERSION, data, /* pos= */ 0);
+ uint32_t varint = 0;
+ // Deserialize into r-value
+ reader >> VARINT(varint);
+ BOOST_CHECK_EQUAL(varint, 54321);
+ BOOST_CHECK(reader.empty());
+}
+
BOOST_AUTO_TEST_CASE(bitstream_reader_writer)
{
CDataStream data(SER_NETWORK, INIT_PROTO_VERSION);