Website Summary Files Commits Branches @commit @diff @stats
path: root / tests / Test_DateTime.cpp
diff options
context:
space:
mode:
Commitbe1e83c17dba4e5254e5dec78da1ee213b2ba8e9 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 11:34:39 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 11:34:39 +0300
Filesa578cd3d2c49b6abe6deecdf45f68715e075d005 /tests/Test_DateTime.cpp
FMI-OOP-P1_TicketSystem-be1e83c17dba4e5254e5dec78da1ee213b2ba8e9.tar
FMI-OOP-P1_TicketSystem-be1e83c17dba4e5254e5dec78da1ee213b2ba8e9.tar.gz
FMI-OOP-P1_TicketSystem-be1e83c17dba4e5254e5dec78da1ee213b2ba8e9.zip
Parent991373dd1db0c4f9feb38cc77d61875de21bf89d (diff)
Autocommit at 01.05.2022 @ 11:34
1 files changed, 14 insertions, 9 deletions
-rw-r--r--tests/Test_DateTime.cpp23
diff --git a/tests/Test_DateTime.cpp b/tests/Test_DateTime.cpp
index ac28b4a..0bbca14 100644
--- a/tests/Test_DateTime.cpp
+++ b/tests/Test_DateTime.cpp
@@ -38,7 +38,7 @@ TEST_SUITE("GettersAndSetters") {
}
TEST_CASE("HourSetter_ReturnTrue_WhenGivenCorrectValue") {
DateTime dt(h, m, d, M, y);
- unsigned nh;
+ unsigned nh = h;
SUBCASE("SingleDigits") { nh = 2; }
SUBCASE("DoubleDigits") { nh = 10; }
SUBCASE("24hour") { nh = 17; }
@@ -48,7 +48,7 @@ TEST_SUITE("GettersAndSetters") {
}
TEST_CASE("HourSetter_SetsValue_WhenGivenCorrectValue") {
DateTime dt(h, m, d, M, y);
- unsigned nh;
+ unsigned nh = h;
SUBCASE("SingleDigits") { nh = 2; }
SUBCASE("DoubleDigits") { nh = 10; }
SUBCASE("24hour") { nh = 17; }
@@ -59,7 +59,7 @@ TEST_SUITE("GettersAndSetters") {
}
TEST_CASE("HourSetter_ReturnsFalse_WhenGivenIncorrectValue") {
DateTime dt(h, m, d, M, y);
- unsigned nh;
+ unsigned nh = h;
SUBCASE("TooBig") { nh = 891; }
CHECK_UNARY_FALSE(dt.set_hour(nh));
@@ -72,24 +72,29 @@ TEST_SUITE("GettersAndSetters") {
}
TEST_CASE("MinuteSetter_ReturnTrue_WhenGivenCorrectValue") {
DateTime dt(h, m, d, M, y);
- unsigned nm;
+ unsigned nm = m;
SUBCASE("SingleDigits") { nm = 2; }
- SUBCASE("DoubleDigits") { nm = 10; }
- SUBCASE("24hour") { nm = 17; }
+ SUBCASE("DoubleDigits") { nm = 52; }
SUBCASE("Zero") { nm = 0; }
CHECK_UNARY(dt.set_minute(nm));
}
TEST_CASE("MinuteSetter_SetsValue_WhenGivenCorrectValue") {
DateTime dt(h, m, d, M, y);
- dt.set_minute(9);
+ unsigned nm = m;
+ SUBCASE("SingleDigits") { nm = 2; }
+ SUBCASE("DoubleDigits") { nm = 42; }
+ SUBCASE("Zero") { nm = 0; }
+ dt.set_minute(nm);
- CHECK_EQ(dt.get_minute(), 9);
+ CHECK_EQ(dt.get_minute(), nm);
}
TEST_CASE("MinuteSetter_ReturnsFalse_WhenGivenIncorrectValue") {
DateTime dt(h, m, d, M, y);
+ unsigned nm = m;
+ SUBCASE("TooBig") { nm = 847; }
- CHECK_UNARY_FALSE(dt.set_minute(888));
+ CHECK_UNARY_FALSE(dt.set_minute(nm));
}
}