]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
add test break test six to nine
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jul 2026 16:28:20 +0000 (18:28 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jul 2026 16:28:20 +0000 (18:28 +0200)
src/break.c
tests/break_tests.c

index 9b089a94bb012169fd438ec29c151f2459296233..3cbeaf1c6cc9534730ecf999a8645cad46d59b62 100644 (file)
@@ -35,4 +35,18 @@ time_t get_break_time(const time_t worktime)
 
        return 0;
 }
+#endif
+
+#ifndef BEFORE_AUG_2026
+#define SIX_HOURS 21600
+#define NINE_HOURS 32400
+#define THIRTY_MINUTES 1800
+
+time_t get_break_time(const time_t worktime)
+{
+       if (worktime >= SIX_HOURS && worktime < NINE_HOURS)
+               return THIRTY_MINUTES;
+
+       return 0;
+}
 #endif
\ No newline at end of file
index 37494f97253dee25bff2d0e0986901f019ff3401..0ffdaa21f42db41415fd1fba7a9b9ebab019858f 100644 (file)
@@ -164,4 +164,32 @@ int run_break_tests()
 
        return cmocka_run_group_tests(break_tests, NULL, NULL);
 }
+#endif
+
+#ifndef BEFORE_AUG_2026
+void six_to_nine_hour_thirdy_minutes_break_test(time_t worktime)
+{
+       const time_t breaktime = get_break_time(worktime);
+
+       assert_int_equal(breaktime, 1800);
+}
+
+void six_to_nine_hour_thirdy_minutes_break_tests()
+{
+       const time_t six_hour = 21600;
+       const time_t nine_hour = 32400;
+
+       for (time_t i = six_hour; i < nine_hour; i++) {
+               six_to_nine_hour_thirdy_minutes_break_test(i);
+       }
+}
+
+int run_break_tests()
+{
+       const struct CMUnitTest break_tests[] = {
+               cmocka_unit_test(six_to_nine_hour_thirdy_minutes_break_tests)
+       };
+
+       return cmocka_run_group_tests(break_tests, NULL, NULL);
+}
 #endif
\ No newline at end of file