Esempio n. 1
0
// Roundtrip testing on calymonthstart
void test_RoundTripMonthStart() {
    static const time_t pivot = 0;
    u_int32 ntp, expms, trums;
    struct calendar date;

    for (ntp = 0; ntp < 0xFFFFFFFFu - 2000000u; ntp += 2000000u) {
        trums = calmonthstart(ntp, &pivot);
        ntpcal_ntp_to_date(&date, ntp, &pivot);
        date.monthday = 1;
        date.hour = date.minute = date.second = 0;
        expms = ntpcal_date_to_ntp(&date);
        TEST_ASSERT_EQUAL(expms, trums);
    }
}
Esempio n. 2
0
// Roundtrip testing on calymonthstart
TEST_F(calendarTest, RoundTripMonthStart) {
	static const time_t pivot = 0;
	u_int32 ntp, expms, trums;
	calendar date;

	for (ntp = 0; ntp < 0xFFFFFFFFu - 2000000u; ntp += 2000000u) {
		trums = calmonthstart(ntp, &pivot);
		ntpcal_ntp_to_date(&date, ntp, &pivot);
		date.monthday = 1;
		date.hour = date.minute = date.second = 0;
		expms = ntpcal_date_to_ntp(&date);
		EXPECT_EQ(expms, trums);
	}
}