Extra sanity checks for year_month_day

This commit is contained in:
Howard Hinnant 2015-08-10 23:09:56 -04:00
parent a2ac8a8003
commit 751f6aa279

View File

@ -204,4 +204,15 @@ main()
std::ostringstream os;
os << ymd1;
assert(os.str() == "2015-08-09");
#if __cplusplus >= 201402
static_assert( (2000_y/feb/29).ok(), "");
static_assert(!(2000_y/feb/30).ok(), "");
static_assert( (2100_y/feb/28).ok(), "");
static_assert(!(2100_y/feb/29).ok(), "");
static_assert(day_point(2100_y/feb/28) + days{1} == day_point(2100_y/mar/1), "");
static_assert(day_point(2000_y/mar/1) - day_point(2000_y/feb/28) == days{2}, "");
static_assert(day_point(2100_y/mar/1) - day_point(2100_y/feb/28) == days{1}, "");
#endif
}