Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Oct 5, 2023
1 parent eb2f9e6 commit d7a3eb0
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions test/src/date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,89 +55,89 @@ TEST_CASE("date/minus/days") {
budget::date a(2010, 5, 6);
a -= budget::days(1);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 5);

a -= budget::days(10);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 4);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(4));
FAST_CHECK_EQ(a.day(), 25);
}

TEST_CASE("date/minus/month") {
budget::date a(2010, 5, 6);
a -= budget::months(1);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 4);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(4));
FAST_CHECK_EQ(a.day(), 6);

a -= budget::months(10);

FAST_CHECK_EQ(a.year(), 2009);
FAST_CHECK_EQ(a.month(), 6);
FAST_CHECK_EQ(a.year(), budget::year(2009));
FAST_CHECK_EQ(a.month(), budget::month(6));
FAST_CHECK_EQ(a.day(), 6);
}

TEST_CASE("date/minus/years") {
budget::date a(2010, 5, 6);
a -= budget::years(1);

FAST_CHECK_EQ(a.year(), 2009);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(2009));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 6);

a -= budget::years(10);

FAST_CHECK_EQ(a.year(), 1999);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(1999));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 6);
}

TEST_CASE("date/plus/days") {
budget::date a(2010, 5, 6);
a += budget::days(1);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 7);

a += budget::days(30);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 6);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(6));
FAST_CHECK_EQ(a.day(), 6);
}

TEST_CASE("date/plus/month") {
budget::date a(2010, 5, 6);
a += budget::months(1);

FAST_CHECK_EQ(a.year(), 2010);
FAST_CHECK_EQ(a.month(), 6);
FAST_CHECK_EQ(a.year(), budget::year(2010));
FAST_CHECK_EQ(a.month(), budget::month(6));
FAST_CHECK_EQ(a.day(), 6);

a += budget::months(10);

FAST_CHECK_EQ(a.year(), 2011);
FAST_CHECK_EQ(a.month(), 4);
FAST_CHECK_EQ(a.year(), budget::year(2011));
FAST_CHECK_EQ(a.month(), budget::month(4));
FAST_CHECK_EQ(a.day(), 6);
}

TEST_CASE("date/plus/years") {
budget::date a(2010, 5, 6);
a += budget::years(1);

FAST_CHECK_EQ(a.year(), 2011);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(2011));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 6);

a += budget::years(10);

FAST_CHECK_EQ(a.year(), 2021);
FAST_CHECK_EQ(a.month(), 5);
FAST_CHECK_EQ(a.year(), budget::year(2021));
FAST_CHECK_EQ(a.month(), budget::month(5));
FAST_CHECK_EQ(a.day(), 6);
}

Expand Down

0 comments on commit d7a3eb0

Please sign in to comment.