10 #include <gtest/gtest.h> 20 TEST(Serialization, STL_stdvector)
22 std::vector<uint32_t> m2, m1{1, 2, 3};
33 TEST(Serialization, STL_stdmap)
35 std::map<uint32_t, uint8_t> m2, m1;
49 TEST(Serialization, STL_complex_error_type)
51 std::map<double, std::array<uint8_t, 2>> v1;
52 std::map<double, std::array<int8_t, 2>> v2;
62 EXPECT_THROW(arch >> v2, std::exception);
65 TEST(Serialization, optional_STL)
67 using map2array_t = std::map<double, std::array<uint8_t, 2>>;
69 std::optional<map2array_t> v1a, v1b;
70 std::optional<map2array_t> v2a, v2b;
83 EXPECT_FALSE(v2a.has_value());
89 Foo(
int i = 0) : m_i(i) {}
93 bool operator==(const
Foo& b)
const {
return m_i == b.m_i; }
106 TEST(Serialization, vector_custom_type)
108 std::vector<Foo> m2, m1{1, 2, 3};
119 TEST(Serialization, vector_shared_ptr)
121 std::vector<std::shared_ptr<Foo>> m2, m1;
122 m1.push_back(std::make_shared<Foo>(1));
123 m1.push_back(std::make_shared<Foo>(2));
125 m1.push_back(std::make_shared<Foo>(3));
134 for (
auto i = 0U; i < m1.size(); i++)
TEST(Serialization, STL_stdvector)
CArchiveStreamBase< STREAM > archiveFrom(STREAM &s)
Helper function to create a templatized wrapper CArchive object for a: MRPT's CStream, std::istream, std::ostream, std::stringstream.
This CStream derived class allow using a memory buffer as a CStream.
#define DECLARE_TTYPENAME_CLASSNAME(_CLASSNAME)
Like DECLARE_CUSTOM_TTYPENAME(), but for use within the class declaration body.
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
CArchive & operator>>(CArchive &s, mrpt::aligned_std_vector< float > &a)
Virtual base class for "archives": classes abstracting I/O streams.
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
CArchive & operator<<(CArchive &s, const mrpt::aligned_std_vector< float > &a)