13#define assert_dt_eq(x, ...) assert_dt_eq_fn( LOCATION( #x " == " #__VA_ARGS__ ), x, __VA_ARGS__)
31static inline void normalN(
int&
lo,
int&
hi,
int N)
45#define assert_nn_eq(x, y, N, x1, y1) assert_nn_eq_fn( LOCATION( #x ", " #y " mod " #N " == " #x1 ", " #y1 ), x, y, N, x1, y1)
57 <<
vx <<
", " <<
vy <<
"] != ["
58 <<
x1 <<
", " <<
y1 <<
"] instead";
131 fill(val, 2008, 3, 31);
133 fill(val, 2008, 3, 31, 3);
135 fill(val, 2008, 3, 31, 3, 21);
137 fill(val, 2008, 3, 31, 3, 21, 0);
156 fill(val, 2008, 1, 1, 0, 0, 0);
160 fill(val, 2008, 1, 1, 0, 0, 0);
165 fill(val, 2008, 3, 1, 0, 0, 0);
170 fill(val, 2008, 2, 28, 23, 0, 0);
175 fill(val, 2008, 2, 28, 23, 0, 0);
181 fill(val, 2008, 2, 28, 23, 0, 0);
220 fill(
val2, 2006, 12, 31, 23, 59, 59);
223 fill(
val1, 2006, 12, 31, 23, 59, 59);
229struct TestGrcalTime {
246 fill(val, 11, 10, 9);
This header provides functions to handle Gregorian calendar dates and times.
#define assert_nn_eq(x, y, N, x1, y1)
Definition grcal.test.h:45
#define assert_dt_eq(x,...)
Definition grcal.test.h:13
std::string tostring(const int *val)
Convert a datetime to a string.
Definition grcal.cpp:319
int daysinyear(int year)
Return the number of days in a year.
Definition grcal.cpp:84
long long int secondsfrom(int year, const int *val)
Convert the given time in seconds elapsed since the beginning of the given year.
Definition grcal.cpp:229
void upperbound(const int *src, int *dst)
Make a copy of the datetime, filling in missing values with the highest possible value they can have.
Definition grcal.cpp:191
void lowerbound(const int *src, int *dst)
Make a copy of the datetime, filling in missing values with the lowest possible value they can have.
Definition grcal.cpp:112
int daysinmonth(int year, int month)
Return the number of days in a month.
Definition grcal.cpp:57
void normalise(int *res)
Normalise a datetime, in place.
Definition grcal.cpp:145
void easter(int year, int *month, int *day)
Compute the day of Easter.
Definition grcal.cpp:91
long long int duration(const int *begin, const int *end)
Give the duration in seconds of the interval between begin and end.
Definition grcal.cpp:245
std::string tostring(const int *val)
Format a time of day to a string.
Definition grcal.cpp:391
#define assert_eq(x, y)
Definition test.h:33