int group_test(int year, int month, int day) { int yearday = day_of_year(year, month, day); printf("%d/%d/%d -> %d\t", year, month, day, yearday); if (yearday == 0) { printf("\n"); return 0; } test_month_day(year, yearday); return 0; }
int main() { printf("test day out of range\n"); group_test(2000, 2, 28); group_test(2000, 2, 29); group_test(2000, 2, 30); printf("test month out of range\n"); group_test(2000, 0, 30); group_test(2000, 13, 30); printf("test month_day out of range\n"); test_month_day(2016, 0); test_month_day(2016, 1); test_month_day(2016, 366); test_month_day(2016, 367); printf("group test\n"); group_test(2016, 4, 15); // leap group_test(2000, 4, 15); // leap group_test(1900, 4, 15); // not leap group_test(2001, 4, 15); // not leap return 0; }
int main() { std::string tstr = "10:49"; std::string tstr1 = "09:00:00"; std::string tstr2 = "17:30:00"; long t = 1437382175; test_is_time(tstr,t); test_trade_hours(tstr1,tstr2,t); test_week_day(t); test_month_day(t); test_datestr(t); exit(0); }
int main() { test_month_day(2015, 1); test_month_day(2015, 5); test_month_day(2015, 100); test_month_day(2015, 31); test_month_day(2015, 365); // leap year test_month_day(2016, 5); test_month_day(2016, 60); test_month_day(2016, 100); test_month_day(2016, 366); // error checking test_month_day(2015, 0); test_month_day(2015, -1); test_month_day(1000, 5); test_month_day(2015, 366); test_day_of_year(2015, 1, 1); test_day_of_year(2015, 2, 1); test_day_of_year(2015, 3, 1); test_day_of_year(2015, 12, 31); // leap year test_day_of_year(2016, 2, 29); test_day_of_year(2016, 12, 31); // error checking test_day_of_year(1000, 1, 1); test_day_of_year(2015, 0, 1); test_day_of_year(2015, 13, 1); test_day_of_year(2015, -1, 1); test_day_of_year(2015, 1, -1); test_day_of_year(2015, 13, 1); test_day_of_year(2015, 1, 32); // ... correct number of days in particular month test_day_of_year(2015, 2, 30); test_day_of_year(2015, 2, 29); test_day_of_year(2016, 2, 30); }