timestring = NULL;
}
+void get_five_hour_fourty_five()
+{
+ time_t time = 20700;
+ char* timestring = malloc(sizeof(char) * 7);
+ memset(timestring, 0, 7);
+
+ get_time_str(time, timestring);
+
+ assert_string_equal(timestring, "05:45");
+
+ free(timestring);
+ timestring = NULL;
+}
+
+void get_minus_five_minutes()
+{
+ time_t time = -300;
+ char* timestring = malloc(sizeof(char) * 7);
+ memset(timestring, 0, 7);
+
+ get_time_str(time, timestring);
+
+ assert_string_equal(timestring, "-00:05");
+
+ free(timestring);
+ timestring = NULL;
+}
+
int main()
{
const struct CMUnitTest tests[] = {
- cmocka_unit_test(get_zero_hour_and_fifteen_minutes)
+ cmocka_unit_test(get_zero_hour_and_fifteen_minutes),
+ cmocka_unit_test(get_five_hour_fourty_five),
+ cmocka_unit_test(get_minus_five_minutes)
};
return cmocka_run_group_tests(tests, NULL, NULL);