caio.co/de/fuzzyclock

Fix fuzzy minutes index calculation and enable tests

Id
b7f998ce2e817aca6dc8200c124f7d938454c1ed
Author
Caio
Commit time
2012-03-28T09:54:41-03:00

Modified src/fuzzyclock.c

@@ -42,7 +42,7
int min = clock->tm_min;

if (min > 2) {
- index = ((min - 3) / 5) - 1;
+ index = ((min - 3) / 5) + 1;
}

if (index > 6) { hour++; }

Modified tests/check_fuzzyclock.c

@@ -78,7 +78,7
}
END_TEST

-START_TEST(test_haltpast) {
+START_TEST(test_halfpast) {
fuzzy_time_test_gen(1, 0, 28, 33, "half past %s", 0);
}
END_TEST
@@ -90,12 +90,12

tcase_add_test(tc_core, test_get_hour_string);
tcase_add_test(tc_core, test_oclock);
- /* tcase_add_test(tc_core, test_fivepast); */
- /* tcase_add_test(tc_core, test_tenpast); */
- /* tcase_add_test(tc_core, test_quarterpast); */
- /* tcase_add_test(tc_core, test_twentypast); */
- /* tcase_add_test(tc_core, test_twentyfivepast); */
- /* tcase_add_test(tc_core, test_haltpast); */
+ tcase_add_test(tc_core, test_fivepast);
+ tcase_add_test(tc_core, test_tenpast);
+ tcase_add_test(tc_core, test_quarterpast);
+ tcase_add_test(tc_core, test_twentypast);
+ tcase_add_test(tc_core, test_twentyfivepast);
+ tcase_add_test(tc_core, test_halfpast);

suite_add_tcase(suite, tc_core);