Skip to content

Commit

Permalink
Add more time format tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana-yan committed Jan 20, 2021
1 parent cc3d82a commit f5c932d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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")
Expand Down

0 comments on commit f5c932d

Please sign in to comment.