add unittest for YAML::Node <-> float
This adds a unittests which stores a 'float' into a Node and than extract it again. A version for 'double' already exists. Note: this unittest is failing, since std::numeric_limits<T>::digits10 is not being used correctly.
This commit is contained in:
parent
f2608bf2f1
commit
b6b521fccb
@ -391,7 +391,13 @@ TEST(NodeTest, AutoBoolConversion) {
|
|||||||
EXPECT_TRUE(!!node["foo"]);
|
EXPECT_TRUE(!!node["foo"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(NodeTest, FloatingPrecision) {
|
TEST(NodeTest, FloatingPrecisionFloat) {
|
||||||
|
const float x = 0.123456789;
|
||||||
|
Node node = Node(x);
|
||||||
|
EXPECT_EQ(x, node.as<float>());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NodeTest, FloatingPrecisionDouble) {
|
||||||
const double x = 0.123456789;
|
const double x = 0.123456789;
|
||||||
Node node = Node(x);
|
Node node = Node(x);
|
||||||
EXPECT_EQ(x, node.as<double>());
|
EXPECT_EQ(x, node.as<double>());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user