StudyPlanner/src/test.c

41 lines
823 B
C
Raw Normal View History

#include "config.h"
#include "db.h"
#include "iCal.h"
#include "llist.h"
#include "planner.h" // for subject and event structs
#include "ui.h"
#include <stdio.h>
#include <stdlib.h>
int main() {
time_t now = time(NULL);
Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0);
Task t2 = {
.name = "Phys", .created = now, .deadline = now + days(2), .priority = 7};
printf("%s\n", ctime(&now));
// new llist test
llist *list1 = llistNew(t1, cmpTask);
llistAppend(list1, &t2);
// print test tasks
serialize(t1);
serialize(&t2);
// find in list & modify
Task search = {.name = "Phys"};
llist *found = llistGet(list1, &search);
if (found != NULL) {
((Task *)found->data)->deadline = time(NULL) + days(10);
serialize(found->data);
}
serialize(&t2);
free(t1);
return 0;
}