14 #include <gtest/gtest.h> 19 TEST(Serialization, STL_stdvector)
21 std::vector<uint32_t> m2, m1{1, 2, 3};
32 TEST(Serialization, STL_stdmap)
34 std::map<uint32_t, uint8_t> m2, m1;
48 TEST(Serialization, STL_complex_error_type)
50 std::map<double, std::array<uint8_t, 2>>
v1;
51 std::map<double, std::array<int8_t, 2>>
v2;
61 EXPECT_THROW(arch >>
v2, std::exception);
66 Foo(
int i = 0) : m_i(i) {}
70 bool operator==(const
Foo&
b)
const {
return m_i ==
b.m_i; }
83 TEST(Serialization, vector_custom_type)
85 std::vector<Foo> m2, m1{1, 2, 3};
96 TEST(Serialization, vector_shared_ptr)
98 std::vector<std::shared_ptr<Foo>> m2, m1;
99 m1.push_back(std::make_shared<Foo>(1));
100 m1.push_back(std::make_shared<Foo>(2));
102 m1.push_back(std::make_shared<Foo>(3));
110 EXPECT_EQ(m1.size(), m2.size());
111 for (
auto i = 0U; i < m1.size(); i++)
115 EXPECT_EQ(m1[i], m2[i]);
119 EXPECT_EQ(*m1[i], *m2[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.
CArchive & operator<<(CArchive &s, const mrpt::aligned_std_vector< float > &a)
GLfloat GLfloat GLfloat v2
GLubyte GLubyte GLubyte a