Commit 4cc62876 authored by miloyip's avatar miloyip

Add some parsing number tests

parent 3a923740
......@@ -254,6 +254,32 @@ static void TestParseDouble() {
TEST_DOUBLE(fullPrecision, "1.00000000000000011102230246251565404236316680908203124", 1.0); // previous double
TEST_DOUBLE(fullPrecision, "1.00000000000000011102230246251565404236316680908203126", 1.00000000000000022); // next double
// Numbers from https://github.com/floitsch/double-conversion/blob/master/test/cctest/test-strtod.cc
TEST_DOUBLE(fullPrecision, "72057594037927928.0", 72057594037927928.0);
TEST_DOUBLE(fullPrecision, "72057594037927936.0", 72057594037927936.0);
TEST_DOUBLE(fullPrecision, "72057594037927932.0", 72057594037927936.0);
TEST_DOUBLE(fullPrecision, "7205759403792793199999e-5", 72057594037927928.0);
TEST_DOUBLE(fullPrecision, "7205759403792793200001e-5", 72057594037927936.0);
TEST_DOUBLE(fullPrecision, "9223372036854774784.0", 9223372036854774784.0);
TEST_DOUBLE(fullPrecision, "9223372036854775808.0", 9223372036854775808.0);
TEST_DOUBLE(fullPrecision, "9223372036854775296.0", 9223372036854775808.0);
TEST_DOUBLE(fullPrecision, "922337203685477529599999e-5", 9223372036854774784.0);
TEST_DOUBLE(fullPrecision, "922337203685477529600001e-5", 9223372036854775808.0);
TEST_DOUBLE(fullPrecision, "10141204801825834086073718800384", 10141204801825834086073718800384.0);
TEST_DOUBLE(fullPrecision, "10141204801825835211973625643008", 10141204801825835211973625643008.0);
TEST_DOUBLE(fullPrecision, "10141204801825834649023672221696", 10141204801825835211973625643008.0);
TEST_DOUBLE(fullPrecision, "1014120480182583464902367222169599999e-5", 10141204801825834086073718800384.0);
TEST_DOUBLE(fullPrecision, "1014120480182583464902367222169600001e-5", 10141204801825835211973625643008.0);
TEST_DOUBLE(fullPrecision, "5708990770823838890407843763683279797179383808", 5708990770823838890407843763683279797179383808.0);
TEST_DOUBLE(fullPrecision, "5708990770823839524233143877797980545530986496", 5708990770823839524233143877797980545530986496.0);
TEST_DOUBLE(fullPrecision, "5708990770823839207320493820740630171355185152", 5708990770823839524233143877797980545530986496.0);
TEST_DOUBLE(fullPrecision, "5708990770823839207320493820740630171355185151999e-3", 5708990770823838890407843763683279797179383808.0);
TEST_DOUBLE(fullPrecision, "5708990770823839207320493820740630171355185152001e-3", 5708990770823839524233143877797980545530986496.0);
{
char n1e308[310]; // '1' followed by 308 '0'
n1e308[0] = '1';
......@@ -263,7 +289,7 @@ static void TestParseDouble() {
TEST_DOUBLE(fullPrecision, n1e308, 1E308);
}
#if 1 // Very slow
#if 0 // Very slow
static const unsigned count = 10000000;
// Random test for double
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment