aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/serialization.cpp
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2021-01-24 07:42:57 +0000
committerLee Clagett <code@leeclagett.com>2021-01-23 06:23:39 +0000
commit08e4497c6e3b3f434c0bb255c3942648f153fe66 (patch)
tree2564f4214e9e66b2dc03ce3c788bb080b963be56 /tests/unit_tests/serialization.cpp
parentMerge pull request #7669 (diff)
downloadmonero-08e4497c6e3b3f434c0bb255c3942648f153fe66.tar.xz
Improve cryptonote (block and tx) binary read performance
Diffstat (limited to '')
-rw-r--r--tests/unit_tests/serialization.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp
index 7b8a291d0..535752665 100644
--- a/tests/unit_tests/serialization.cpp
+++ b/tests/unit_tests/serialization.cpp
@@ -132,11 +132,10 @@ TEST(Serialization, BinaryArchiveInts) {
ASSERT_EQ(8, oss.str().size());
ASSERT_EQ(string("\0\0\0\0\xff\0\0\0", 8), oss.str());
- istringstream iss(oss.str());
- binary_archive<false> iar(iss);
+ binary_archive<false> iar{epee::strspan<std::uint8_t>(oss.str())};
iar.serialize_int(x1);
- ASSERT_EQ(8, iss.tellg());
- ASSERT_TRUE(iss.good());
+ ASSERT_EQ(8, iar.getpos());
+ ASSERT_TRUE(iar.good());
ASSERT_EQ(x, x1);
}
@@ -151,10 +150,9 @@ TEST(Serialization, BinaryArchiveVarInts) {
ASSERT_EQ(6, oss.str().size());
ASSERT_EQ(string("\x80\x80\x80\x80\xF0\x1F", 6), oss.str());
- istringstream iss(oss.str());
- binary_archive<false> iar(iss);
+ binary_archive<false> iar{epee::strspan<std::uint8_t>(oss.str())};
iar.serialize_varint(x1);
- ASSERT_TRUE(iss.good());
+ ASSERT_TRUE(iar.good());
ASSERT_EQ(x, x1);
}