leapc
Loading...
Searching...
No Matches
leap_abs_date_test.c
1#include "leap.h"
2
3#include <assert.h>
4#include <stdlib.h>
5
6int leap_abs_date_test(int argc, char **argv) {
7 (void)argc;
8 (void)argv;
9
10 assert(equal_leap_date((struct leap_date){0, 1, 1}, leap_abs_date(0)));
11 assert(equal_leap_date((struct leap_date){1970, 1, 1}, leap_abs_date(leap_abs_from(1970, 1, 1))));
12 assert(equal_leap_date((struct leap_date){1970, 2, 1}, leap_abs_date(leap_abs_from(1970, 1, 31) + 1)));
13
14 return EXIT_SUCCESS;
15}
Leap year function prototypes.
struct leap_date leap_abs_date(int day_off)
Absolute date from day of year.
Definition leap.c:135
static bool equal_leap_date(struct leap_date lhs, struct leap_date rhs)
Compares two leap_date structures for equality.
Definition leap.h:193
int leap_abs_from(int year, int month, int day)
Absolute date from year, month, and day of month.
Definition leap.c:137
Leap year date structure.
Definition leap.h:163