gigasecond: initial commit and iteration 1

This commit is contained in:
Dmitry Kokorin 2016-03-17 00:12:54 +03:00
parent 2aa26a8950
commit 7883503508
4 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,32 @@
#include "gigasecond.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
// See <http://www.boost.org/doc/libs/1_55_0/doc/html/date_time.html>
// for documentation on boost::gregorian::date
BOOST_AUTO_TEST_CASE(test_1)
{
const auto actual = gigasecond::advance(boost::gregorian::date(2011, 4, 26));
const boost::gregorian::date expected(2043, 1, 2);
BOOST_REQUIRE_EQUAL(expected, actual);
}
#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(test_2)
{
const auto actual = gigasecond::advance(boost::gregorian::date(1977, 6, 14));
const boost::gregorian::date expected(2009, 2, 20);
BOOST_REQUIRE_EQUAL(expected, actual);
}
BOOST_AUTO_TEST_CASE(test_3)
{
const auto actual = gigasecond::advance(boost::gregorian::date(1959, 7, 20));
const boost::gregorian::date expected(1991, 3, 28);
BOOST_REQUIRE_EQUAL(expected, actual);
}
#endif