19 #include <gtest/gtest.h> 37 TEST(SerializeTestBase, LoadDemoFile)
62 R.v9 =
"an example test";
71 cerr <<
"WARNING: Skipping test due to missing file: " << fil <<
"\n";
76 gg >> L.v1 >> L.v2 >> L.v3 >> L.v4 >> L.v5 >> L.v6 >> L.v7 >> L.v8 >>
79 EXPECT_EQ(
R.v1, L.v1);
80 EXPECT_EQ(
R.v2, L.v2);
81 EXPECT_EQ(
R.v3, L.v3);
82 EXPECT_EQ(
R.v4, L.v4);
83 EXPECT_EQ(
R.v5, L.v5);
84 EXPECT_EQ(
R.v6, L.v6);
85 EXPECT_EQ(
R.v7, L.v7);
86 EXPECT_EQ(
R.v8, L.v8);
87 EXPECT_EQ(
R.v9, L.v9);
102 TEST(SerializeTestBase, WriteReadToMem)
120 catch (std::exception& e)
122 GTEST_FAIL() <<
"Exception during serialization test for class '" 130 TEST(SerializeTestBase, CopyOperator)
144 catch (std::exception& e)
146 GTEST_FAIL() <<
"Exception during copy operator test for class '" 155 TEST(SerializeTestBase, CArray)
169 catch (std::exception& e)
171 GTEST_FAIL() <<
"Exception:\n" << e.what() << endl;
176 TEST(SerializeTestBase, STL_serialization)
184 std::vector<double>
a,
b;
186 for (
size_t i = 0; i <
a.size(); i++)
a[i] = 50 - i;
198 std::list<std::map<double, std::set<std::string>>>
a,
b;
203 for (
size_t i = 0; i < N; i++)
205 std::map<double, std::set<std::string>> d;
207 for (
size_t j = 0; j < M; j++)
209 std::set<std::string>& dd =
212 for (
size_t k = 0; k < L; k++)
226 catch (std::exception& e)
228 GTEST_FAIL() <<
"Exception:\n" << e.what() << endl;
233 TEST(SerializeTestBase, CastSmartPointers)
double drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::string MRPT_GLOBAL_UNITTEST_SRC_DIR
unsigned __int16 uint16_t
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
Introduces a pure virtual method for moving to a specified position in the streamed resource...
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
A thred-safe pseudo random number generator, based on an internal MT19937 randomness generator...
const mrpt::utils::TRuntimeClassId * lstClasses[]
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
std::shared_ptr< CPose2D > Ptr
Structure to hold the parameters of a pinhole stereo camera model.
This base provides a set of functions for maths stuff.
mrpt::utils::CObject * createObject() const
#define CLASS_ID(T)
Access to runtime class ID for a defined class name.
This CStream derived class allow using a memory buffer as a CStream.
TEST(SerializeTestBase, LoadDemoFile)
GLfloat GLfloat GLfloat GLfloat v3
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
GLsizei const GLchar ** string
A class used to store a 2D point.
A class used to store a 3D point.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::shared_ptr< CSerializable > Ptr
unsigned __int64 uint64_t
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::utils::CSerializable) is of t...
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
GLfloat GLfloat GLfloat v2
A structure that holds runtime class type information.
unsigned __int32 uint32_t
GLubyte GLubyte GLubyte a
double drawGaussian1D_normalized()
Generate a normalized (mean=0, std=1) normally distributed sample.