tighter checking of what is a valid integer/floating point number
also use the check consistently when converting numbers
This commit is contained in:
@ -315,6 +315,26 @@ TEST(Utils, text_not_an_integer)
|
||||
ASSERT_FALSE(utils::is_integer("one"));
|
||||
}
|
||||
|
||||
TEST(Utils, minus_not_an_integer)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_integer("1-"));
|
||||
}
|
||||
|
||||
TEST(Utils, plus_not_an_integer)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_integer("1+"));
|
||||
}
|
||||
|
||||
TEST(Utils, minus_not_a_double)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_double("1-"));
|
||||
}
|
||||
|
||||
TEST(Utils, plus_not_a_double)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_double("1+"));
|
||||
}
|
||||
|
||||
TEST(Utils, text_not_a_double)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_double("half"));
|
||||
@ -365,6 +385,11 @@ TEST(Utils, signed_double_and_exponential)
|
||||
ASSERT_TRUE(utils::is_double("-10E-22"));
|
||||
}
|
||||
|
||||
TEST(Utils, signed_double_and_broken_exponential)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_double("-10e10-2"));
|
||||
}
|
||||
|
||||
TEST(Utils, is_double_with_d_exponential)
|
||||
{
|
||||
ASSERT_FALSE(utils::is_double("10d22"));
|
||||
|
||||
Reference in New Issue
Block a user