all unit tests successful, might have fixed bug
This commit is contained in:
@ -1,7 +1,38 @@
|
||||
#include "../src/date_time_handling.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
int main() {
|
||||
// 1
|
||||
char* pdt = pretty_date_time("20251215T080000Z");
|
||||
|
||||
assert(!strcmp(pdt, "2025-12-15 08:00:00"));
|
||||
|
||||
free(pdt);
|
||||
|
||||
// 2
|
||||
char* pdt2 = pretty_date_time("20251215T080000");
|
||||
|
||||
assert(!strcmp(pdt2, "2025-12-15 08:00:00"));
|
||||
|
||||
free(pdt2);
|
||||
|
||||
// 3
|
||||
char* pdt3 = pretty_date_time("");
|
||||
|
||||
assert(!strcmp(pdt3, ""));
|
||||
|
||||
free(pdt3);
|
||||
|
||||
// 4
|
||||
char* pdt4 = pretty_date_time("20251215");
|
||||
|
||||
assert(!strcmp(pdt4, "2025-12-15"));
|
||||
|
||||
free(pdt4);
|
||||
|
||||
// 5
|
||||
char current_date[] = "20240710T103000";
|
||||
|
||||
printf("current_date: %s\n", current_date);
|
||||
@ -13,6 +44,7 @@ int main() {
|
||||
printf("strlen(current_date): %ld\n", strlen(current_date));
|
||||
|
||||
pretty_print_date_time("20251215T080000Z");
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ int main() {
|
||||
// initialize empty list
|
||||
struct event *head = NULL;
|
||||
|
||||
// 1
|
||||
printf("\nTesting tests/failed_cal.ics:\n\n");
|
||||
char *current_date = "20240710T113000";
|
||||
|
||||
printf("DEBUG - current_date: %s\n\n", current_date);
|
||||
@ -13,4 +15,10 @@ int main() {
|
||||
parse_ics_file("../../tests/failed_cal.ics", &head);
|
||||
|
||||
print_upcoming(head, current_date, 0);
|
||||
|
||||
// 2
|
||||
printf("\nTesting tests/calendar.ics:\n\n");
|
||||
parse_ics_file("../../tests/calendar.ics", &head);
|
||||
|
||||
print_upcoming(head, current_date, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user