10 #include <gtest/gtest.h> 14 TEST(CPoint, toFromString_2D)
19 EXPECT_DOUBLE_EQ(p.
x(), 1.0);
20 EXPECT_DOUBLE_EQ(p.
y(), 2.0);
25 EXPECT_THROW(p.
fromString(
"[]"), std::exception);
26 EXPECT_THROW(p.
fromString(
"[1 2;4 5]"), std::exception);
27 EXPECT_THROW(p.
fromString(
"[1 2 3]"), std::exception);
28 EXPECT_THROW(p.
fromString(
"[1;2]"), std::exception);
31 TEST(CPoint, toFromString_3D)
36 EXPECT_DOUBLE_EQ(p.
x(), 1.0);
37 EXPECT_DOUBLE_EQ(p.
y(), 2.0);
38 EXPECT_DOUBLE_EQ(p.z(), 3.0);
41 EXPECT_EQ(s,
"[1.000000 2.000000 3.000000]");
43 EXPECT_THROW(p.
fromString(
"[]"), std::exception);
44 EXPECT_THROW(p.
fromString(
"[1 2;4 5]"), std::exception);
45 EXPECT_THROW(p.
fromString(
"[1 2]"), std::exception);
46 EXPECT_THROW(p.
fromString(
"[1;2;3]"), std::exception);
TEST(CPoint, toFromString_2D)
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[0.02 1.04]" ) ...
double x() const
Common members of all points & poses classes.
A class used to store a 2D point.
A class used to store a 3D point.
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04]" ) ...