diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2021-01-20 14:05:15 +0300 |
---|---|---|
committer | tatiana-yan <tatiana.kondakova@gmail.com> | 2021-01-20 14:05:15 +0300 |
commit | f5c932d16a434e29418c3c2947c5b9e2b7ddb41a (patch) | |
tree | db58b98a0bb18192a6231af36a234e8808a66332 | |
parent | cc3d82a25e4bc87b8a57024c28a3ce01fa4549cd (diff) |
Add more time format tests.
-rw-r--r-- | tests/unit_tests.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit_tests.cpp b/tests/unit_tests.cpp index e43af3d..4fc646e 100644 --- a/tests/unit_tests.cpp +++ b/tests/unit_tests.cpp @@ -23,6 +23,14 @@ TEST_CASE("Time in HH:MM:SS format") CHECK_EQ(stop_time.get_total_seconds(), 39 * 60 * 60 + 45 * 60 + 30); } +TEST_CASE("Time in HHH:MM:SS format") +{ + Time stop_time("103:05:21"); + CHECK_EQ(stop_time.get_hh_mm_ss(), std::make_tuple(103, 5, 21)); + CHECK_EQ(stop_time.get_raw_time(), "103:05:21"); + CHECK_EQ(stop_time.get_total_seconds(), 103 * 60 * 60 + 5 * 60 + 21); +} + TEST_CASE("Time from integers 1") { Time stop_time(14, 30, 0); @@ -44,6 +52,7 @@ TEST_CASE("Invalid time format") CHECK_THROWS_AS(Time("12/10/00"), const InvalidFieldFormat &); CHECK_THROWS_AS(Time("12:100:00"), const InvalidFieldFormat &); CHECK_THROWS_AS(Time("12:10:100"), const InvalidFieldFormat &); + CHECK_THROWS_AS(Time("12:10/10"), const InvalidFieldFormat &); } TEST_CASE("Time not provided") |