diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-16 15:21:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-16 15:21:56 +0100 |
| commit | 4b88f8048441ba782f11707d9a19aa63e836f26c (patch) | |
| tree | 524fa06d3219737324c0a381258c0357a8f89478 /test/util_test.cc | |
| parent | 26a7e197befe79f6770395b084be6a80d4895813 (diff) | |
Improve approximate time reporting a bit (#383).
Diffstat (limited to 'test/util_test.cc')
| -rw-r--r-- | test/util_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/util_test.cc b/test/util_test.cc index 750023d9f..40a2835f1 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -66,3 +66,16 @@ BOOST_AUTO_TEST_CASE (divide_with_round_test) BOOST_CHECK_EQUAL (divide_with_round (1000, 500), 2); } + +BOOST_AUTO_TEST_CASE (seconds_to_approximate_hms_test) +{ + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1), "1 second"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2), "2 seconds"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (60), "1 minute"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1.5 * 60), "1 minute 30 seconds"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (2 * 60), "2 minutes"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (17 * 60 + 20), "17 minutes"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (1 * 3600), "1 hour"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (3600 + 40 * 60), "1 hour 40 minutes"); + BOOST_CHECK_EQUAL (seconds_to_approximate_hms (13 * 3600 + 40 * 60), "14 hours"); +} |
