9 #include "../common/utilities/time/work_week.h" 19 set_time.tm_year = 117;
21 set_time.tm_isdst = -1;
23 work_week first_day( std::mktime( &set_time ) );
28 work_week sixth_day( std::mktime( &set_time ) );
33 work_week seventh_day( std::mktime( &set_time ) );
36 set_time.tm_year = 118;
38 work_week second_week( std::mktime( &set_time ) );
43 "Invalid work week given: 2020 doesn't have a work week 0" );
45 "Invalid work week given: 2020 doesn't have a work week 53" );
49 set_time.tm_year = 117;
51 set_time.tm_mday = 31;
52 work_week belons_to_next_year( std::mktime( &set_time ) );
59 TEST_CASE(
"test work_week c'tor equivalence",
"[work_week]" )
63 auto now = std::time(
nullptr );
65 CHECK( current_ww.get_year() == now_to_work_week.
get_year() );
70 CHECK( current_ww.get_year() == copy.get_year() );
71 CHECK( current_ww.get_work_week() == copy.get_work_week() );
75 set_time.tm_year = 117;
77 set_time.tm_isdst = -1;
79 work_week from_time( std::mktime( &set_time ) );
86 TEST_CASE(
"test work_week subtraction",
"[work_week]" )
106 tm Jan_1_2017 = { 0 };
107 Jan_1_2017.tm_year = 117;
108 Jan_1_2017.tm_mon = 0;
109 Jan_1_2017.tm_mday = 1;
110 Jan_1_2017.tm_wday = 0;
111 Jan_1_2017.tm_yday = 0;
112 Jan_1_2017.tm_isdst = -1;
113 tm Dec_31_2016 = { 0 };
114 Dec_31_2016.tm_year = 116;
115 Dec_31_2016.tm_mon = 11;
116 Dec_31_2016.tm_mday = 31;
117 Dec_31_2016.tm_wday = 5;
118 Dec_31_2016.tm_yday = 365;
119 Dec_31_2016.tm_isdst = -1;
124 tm Jan_1_2018 = { 0 };
125 Jan_1_2018.tm_year = 118;
126 Jan_1_2018.tm_mon = 0;
127 Jan_1_2018.tm_mday = 1;
128 Jan_1_2018.tm_isdst = -1;
129 tm Dec_31_2017 = { 0 };
130 Dec_31_2017.tm_year = 117;
131 Dec_31_2017.tm_mon = 11;
132 Dec_31_2017.tm_mday = 31;
133 Dec_31_2017.tm_isdst = -1;
#define CHECK_THROWS_WITH(expr, matcher)
TEST_CASE("test work_week c'tor","[work_week]")
unsigned get_year() const
unsigned get_work_weeks_since(const work_week &start)
#define CHECK_NOTHROW(...)
static work_week current()
unsigned get_work_week() const
void copy(void *dst, void const *src, size_t size)