Website Summary Files Commits Branches @commit @diff @stats
path: root / tests / Test_DateTime.cpp
diff options
context:
space:
mode:
1 files changed, 19 insertions, 4 deletions
-rw-r--r--tests/Test_DateTime.cpp23
diff --git a/tests/Test_DateTime.cpp b/tests/Test_DateTime.cpp
index 65763f2..1fc827e 100644
--- a/tests/Test_DateTime.cpp
+++ b/tests/Test_DateTime.cpp
@@ -5,18 +5,20 @@
TEST_SUITE_BEGIN("ClassDateTime");
+const unsigned short h = 5, m = 12, d = 19, M = 4, y = 2022; // valid values
+
TEST_SUITE("Constructors") {
- TEST_CASE("Ctor_SavesValues_WhenGivenCorrectOnes") {
- unsigned short h = 5, m = 12, d = 19, M = 4, y = 2022;
+ TEST_CASE("Ctor_SavesValues_WhenGivenValidValues") {
DateTime dt(h, m, d, M, y);
+
CHECK_EQ(dt.get_hour(), h);
CHECK_EQ(dt.get_minute(), m);
CHECK_EQ(dt.get_day(), d);
CHECK_EQ(dt.get_month(), M);
CHECK_EQ(dt.get_year(), y);
}
- TEST_CASE("Ctor_ThrowsInvalidArgumentException_WhenGivenIncorrectValues") {
- unsigned short h = 5, m = 12, d = 19, M = 4, y = 2022;
+ TEST_CASE("Ctor_ThrowsInvalidArgumentException_WhenGivenInvalidValues") {
+ unsigned short h = h, m = m, d = d, M = M, y = y;
SUBCASE("HourIsTooBig") { h = 194; }
SUBCASE("MinutesAreTooBig") { m = 7032; }
SUBCASE("DayIsZero") { d = 0; }
@@ -28,4 +30,17 @@ TEST_SUITE("Constructors") {
}
}
+TEST_SUITE("GettersAndSetters") {
+ TEST_CASE("HourGetter_ReturnsCorrectValue_WhenCreatedWithValidValues") {
+ DateTime dt(h, m, d, M, y);
+
+ CHECK_EQ(dt.get_hour(), h);
+ }
+ TEST_CASE("HourSetter_ReturnTrue_WhenGivenCorrectValue") {
+ DateTime dt(h, m, d, M, y);
+
+ CHECK_EQ
+ }
+}
+
TEST_SUITE_END();