fixup tests

Test was calling the wrong function in place of to_double. Also
fix up an answer value after this.

Fixes up commit 7cd205832f
This commit is contained in:
Chris Beck 2014-05-31 14:30:55 -04:00
parent eb18ffc8a8
commit 5aba222f00

View file

@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_int, 1);
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 1ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1.0);
@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "10000000");
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 10000000ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1e7);
c["x"] = "";
@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "");
x_int = c["x"].to_int();
BOOST_CHECK_EQUAL(x_int, 0);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 0.0);
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "0x11");
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 0ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 0.0);
@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "0xab");
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 0ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 0.0);
@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "00001111");
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 1111ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1.111e3);
@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str,"000000");
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 0ll);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 0.0);
@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str,"01234567890123456789");
x_int = c["x"].to_int();
BOOST_CHECK_EQUAL(x_int, 0);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1.23456789012345678e18);
@ -122,8 +122,8 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "99999999999999999999");
x_int = c["x"].to_int();
BOOST_CHECK_EQUAL(x_int, 0);
x_dbl = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_dbl, 0);
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1e20);
c["x"] = 1.499;
x_sll = c["x"].to_long_long();
@ -132,14 +132,14 @@ BOOST_AUTO_TEST_CASE ( test_config_attribute_value )
BOOST_CHECK_EQUAL(x_str, "1.499");
x_int = c["x"].to_int();
BOOST_CHECK_EQUAL(x_int, 1);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK(abs(x_dbl - 1.499) < 1e-6);
c["x"] = 123456789123ll;
x_int = c["x"].to_int();
BOOST_CHECK_EQUAL(x_int, -1097262461);
x_dbl = c["x"].to_long_long();
x_dbl = c["x"].to_double();
BOOST_CHECK_EQUAL(x_dbl, 1.23456789123e11);
x_sll = c["x"].to_long_long();
BOOST_CHECK_EQUAL(x_sll, 123456789123ll);