mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6924 from Icinga/bugfix/convert-long-double
Fix double to long conversions
This commit is contained in:
commit
b334c3259e
|
@ -64,6 +64,11 @@ public:
|
|||
return val;
|
||||
}
|
||||
|
||||
static long ToLong(double val)
|
||||
{
|
||||
return static_cast<long>(val);
|
||||
}
|
||||
|
||||
static double ToDouble(const Value& val)
|
||||
{
|
||||
return val;
|
||||
|
|
|
@ -33,6 +33,8 @@ BOOST_AUTO_TEST_CASE(tolong)
|
|||
BOOST_CHECK_THROW(Convert::ToLong("7a"), boost::exception);
|
||||
|
||||
BOOST_CHECK(Convert::ToLong(Value(-7)) == -7);
|
||||
|
||||
BOOST_CHECK(Convert::ToLong(3.141386593) == 3);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(todouble)
|
||||
|
|
Loading…
Reference in New Issue