mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-15 11:25:26 +00:00
tests: Make sure we can make a double from a string
This commit is contained in:
parent
4e1a3e1afa
commit
f6c90ccf61
|
@ -137,4 +137,14 @@ TEST_CASE("u_json")
|
||||||
CHECK(json_node["alpha"][3].asObject()["gamma"].asInt() == 5);
|
CHECK(json_node["alpha"][3].asObject()["gamma"].asInt() == 5);
|
||||||
CHECK(json_node["iota"].hasKey("kappa"));
|
CHECK(json_node["iota"].hasKey("kappa"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Can make a double")
|
||||||
|
{
|
||||||
|
JSONNode stringToDouble("0.5");
|
||||||
|
|
||||||
|
constexpr float e = std::numeric_limits<float>::epsilon();
|
||||||
|
|
||||||
|
CHECK(stringToDouble.isDouble());
|
||||||
|
CHECK(stringToDouble.asDouble() == Approx(0.5).margin(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue