proof of concept planner
This commit is contained in:
1 parent
6c91fb7d60
commit
7c16f20bc2
5 files changed
+149
-26
No files matched your search
+15
-4
@@ -4,6 +4,7 @@
|
||||
#include "llist.h"
|
||||
#include "planner.h" // for subject and event structs
|
||||
#include "ui.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -14,20 +15,29 @@ int main() {
|
||||
// create new task named LinAlg with priority 3, created now with deadline in
|
||||
// 5 days sp is currently unused spare var
|
||||
Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0);
|
||||
assert(t1 != NULL);
|
||||
|
||||
// Stack Allocated vars only for local use!
|
||||
Task t2 = {
|
||||
.name = "Phys", .created = now, .deadline = now + days(2), .priority = 7};
|
||||
Task *t2 = newTask("Phys", now, now + days(2), 7, 0);
|
||||
assert(t2 != NULL);
|
||||
Task *t3 = newTask("Analysis", now, now + days(10), 5, 0);
|
||||
assert(t3 != NULL);
|
||||
Task *t4 = newTask("TM1", now, now + days(1), 9, 0);
|
||||
assert(t4 != NULL);
|
||||
|
||||
printf("%s\n", ctime(&now));
|
||||
|
||||
// new llist test
|
||||
llist *list1 = llistNew(t1, cmpTaskN);
|
||||
llistAppend(list1, &t2);
|
||||
llistAppend(list1, t2);
|
||||
llistAppend(list1, t3);
|
||||
llistAppend(list1, t4);
|
||||
|
||||
genPlan(list1);
|
||||
|
||||
// print test tasks
|
||||
printTask(t1);
|
||||
printTask(&t2);
|
||||
printTask(t2);
|
||||
|
||||
// find in list & modify
|
||||
Task search = {.name = "Phys"}; // key to look for. cmpTask only compares
|
||||
@@ -46,6 +56,7 @@ int main() {
|
||||
free(t1Str);
|
||||
|
||||
free(t1);
|
||||
free(t2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user