Added more Age-class tests
This commit is contained in:
parent
09f8fa4faf
commit
220f92453d
@ -4,8 +4,8 @@
|
||||
#include <sstream>
|
||||
|
||||
Age::Age(unsigned int years, unsigned int months)
|
||||
: m_years(years)
|
||||
, m_months(months)
|
||||
: m_years(years)
|
||||
, m_months(months)
|
||||
{
|
||||
}
|
||||
|
||||
|
13
test/Age.cpp
13
test/Age.cpp
@ -18,7 +18,7 @@ TEST_CASE("year/month initialization")
|
||||
{
|
||||
for (unsigned int year = 0; year <= 100; ++year)
|
||||
{
|
||||
for (unsigned int month = 1; month <= 12; ++month)
|
||||
for (unsigned int month = 0; month < 12; ++month)
|
||||
{
|
||||
Age age(year, month);
|
||||
|
||||
@ -27,3 +27,14 @@ TEST_CASE("year/month initialization")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("age by reference")
|
||||
{
|
||||
QDate birth(1970, 1, 1);
|
||||
QDate reference(1980, 1, 1);
|
||||
|
||||
Age age(birth, reference);
|
||||
|
||||
REQUIRE(age.years() == 10);
|
||||
REQUIRE(age.months() == 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user