leapc
Loading...
Searching...
No Matches
leap_thru_test.c
1#include "leap.h"
2
3#include <assert.h>
4
5int leap_thru_test(int argc, char **argv) {
6 assert(0 == leap_thru(0));
7 assert(0 == leap_thru(1));
8 assert(0 == leap_thru(2));
9 assert(0 == leap_thru(3));
10 assert(1 == leap_thru(4));
11 assert(1 == leap_thru(5));
12 assert(24 == leap_thru(100));
13 assert(24 == leap_thru(101));
14 assert(48 == leap_thru(200));
15 assert(48 == leap_thru(201));
16 assert(97 == leap_thru(400));
17 assert(97 == leap_thru(401));
18 assert(693960 == 1900 * 365 + leap_thru(1900));
19 return 0;
20}
Leap year function prototypes.
int leap_thru(int year)
Leap years completed from year 0 up to but not including the first day of the specified year.
Definition leap.c:30