9 #include <boost/test/unit_test.hpp> 11 #define BOOST_TEST_MODULE test_hikyuu_utilities 12 #include <boost/test/unit_test.hpp> 15 #include <hikyuu/Log.h> 16 #include <hikyuu/utilities/util.h> 31 BOOST_CHECK(roundEx(x) == 10.0);
32 BOOST_CHECK(roundDown(x) == 10.0);
33 BOOST_CHECK(roundUp(x) == 11.0);
34 BOOST_CHECK(roundEx(x, 1) == 10.1);
35 BOOST_CHECK(roundDown(x, 1) == 10.1);
36 BOOST_CHECK(roundUp(x, 1) == 10.2);
39 BOOST_CHECK(roundEx(x) == 11);
40 BOOST_CHECK(roundDown(x) == 10);
41 BOOST_CHECK(roundUp(x) == 11.0);
42 BOOST_CHECK(roundEx(x, 1) == 10.6);
43 BOOST_CHECK(roundDown(x, 1) == 10.5);
44 BOOST_CHECK(roundUp(x, 1) == 10.6);
47 BOOST_CHECK(roundEx(x) == -10);
48 BOOST_CHECK(roundDown(x) == -10);
49 BOOST_CHECK(roundUp(x) == -11.0);
50 BOOST_CHECK(roundEx(x, 1) == -10.1);
51 BOOST_CHECK(roundDown(x, 1) == -10.1);
52 BOOST_CHECK(roundUp(x, 1) == -10.2);
55 BOOST_CHECK(roundEx(x) == -11);
56 BOOST_CHECK(roundDown(x) == -10);
57 BOOST_CHECK(roundUp(x) == -11.0);
58 BOOST_CHECK(roundEx(x, 1) == -10.6);
59 BOOST_CHECK(roundDown(x, 1) == -10.5);
60 BOOST_CHECK(roundUp(x, 1) == -10.6);
BOOST_AUTO_TEST_CASE(test_round)