From fdffcc1d7ccc0ef61eca141f710fcd9d7848f7ad Mon Sep 17 00:00:00 2001 From: Theodoros Katzalis <thodkatz@gmail.com> Date: Sun, 17 Mar 2019 20:19:46 +0200 Subject: [PATCH] Added tests for the constructor --- test/Helpers/TimeAndDate.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/Helpers/TimeAndDate.cpp b/test/Helpers/TimeAndDate.cpp index 28532ca8..44d1c439 100644 --- a/test/Helpers/TimeAndDate.cpp +++ b/test/Helpers/TimeAndDate.cpp @@ -4,6 +4,15 @@ TEST_CASE("Date comparison", "[operands]") { + SECTION("Invalid date") { + TimeAndDate InvalidDate0(1900, 2, 2, 4, 5, 6); // error in year + TimeAndDate InvalidDate1(2030, 70, 2, 4, 5, 6); // error in month + TimeAndDate InvalidDate2(2030, 2, 73, 4, 5, 6); // error in day + TimeAndDate InvalidDate3(2030, 2, 2, 74, 5, 6); // error in hour + TimeAndDate InvalidDate4(2030, 2, 2, 4, 75, 6); // error in minute + TimeAndDate InvalidDate5(2030, 2, 2, 4, 5, 76); // error in seconds + } + SECTION("Different year") { TimeAndDate Now; // 10/04/2021 10:15:00 @@ -197,7 +206,7 @@ TEST_CASE("Date comparison", "[operands]") { CHECK((Now == Date) == false); } - SECTION("Same date"){ + SECTION("Same date") { TimeAndDate Now; // 10/04/2020 10:15:01 Now.year = 2020; -- GitLab