diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-01-05 18:28:07 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-01-05 18:28:07 +0100 |
commit | 05d1823e1220a6bdf5f31990462b66ee60c0c9d1 (patch) | |
tree | cc5302f175ac245eda1c631a192621b0e161b8d4 | |
parent | 92ba92a9517650fc6cfe4a8e3a4f34f7ab3e8eda (diff) |
Serialization for archive.h
-rw-r--r-- | archive.h | 4 | ||||
-rw-r--r-- | tests/test-archive.cpp | 10 |
2 files changed, 7 insertions, 7 deletions
@@ -16,7 +16,7 @@ typedef boost::coroutines2::coroutine<void> coro_t; // Serialization, similar to Boost Serialization // but for portable binary archive // using big endian coding (network byte order) -namespace Serialization { +namespace Reichwein::Serialization { class OArchive { @@ -224,4 +224,4 @@ IArchive& operator >>(IArchive& ar, T& v) return ar; }; -} +} // namespace diff --git a/tests/test-archive.cpp b/tests/test-archive.cpp index 2ffa2cd..3e9ec10 100644 --- a/tests/test-archive.cpp +++ b/tests/test-archive.cpp @@ -54,13 +54,13 @@ bool operator==(const MyStruct& lhs, const MyStruct& rhs) TEST_F(ArchiveTest, archive) { std::stringstream ss; - Serialization::OArchive oa(ss); + Reichwein::Serialization::OArchive oa(ss); MyStruct mystruct0{123, 45678, 3, 4, 5, {1, 2}, "abc"}; oa << mystruct0; EXPECT_EQ(ss.str().size(), 36); - Serialization::IArchive ia(ss); + Reichwein::Serialization::IArchive ia(ss); MyStruct mystruct1{}; ia >> mystruct1; @@ -71,7 +71,7 @@ TEST_F(ArchiveTest, out) { std::stringstream ss(std::ios_base::in|std::ios_base::out|std::ios_base::binary); - Serialization::OArchive oarchive(ss); + Reichwein::Serialization::OArchive oarchive(ss); uint64_t v1(123456789); oarchive << v1; @@ -113,7 +113,7 @@ TEST_F(ArchiveTest, in) std::string v1("\x00\x00\x00\x00\x07\x5b\xcd\x15\x05\x39\x7f\xb1\x26\x94\x02" "\x00\x00\x00\x04" "abcd\x00\x00\x00\x05\x01\x02\x03\x04\x05", 32); ss.write(v1.data(), v1.size()); - Serialization::IArchive iarchive(ss); + Reichwein::Serialization::IArchive iarchive(ss); ASSERT_EQ(ss.str().size(), 32); @@ -163,7 +163,7 @@ TEST_F(ArchiveTest, in_coro) } sink(); }); - Serialization::IArchive iarchive(ss, coro); + Reichwein::Serialization::IArchive iarchive(ss, coro); uint64_t x1; iarchive >> x1; |