leapc
Loading...
Searching...
No Matches
leap_day_test.c
1#include "leap.h"
2#include "days.h"
3
4#include <assert.h>
5
6int leap_day_test(int argc, char **argv) {
7 assert(366 == leap_day(1));
8 assert(693961 == leap_day(1900));
9 assert(25567 == leap_day(1970) - leap_day(1900));
10
11 for (int year0 = 1970; year0 < 2025; year0++)
12 for (int year_span = 1; year_span < 50; year_span++) {
13 assert(0 == diff_days(year0 + year_span, year0));
14 }
15 return 0;
16}
Function prototypes for making days from standard time and computing day differences.
Leap year function prototypes.
int leap_day(int year)
Counts leap-adjusted days up to some year.
Definition leap.c:48