-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_actionlist.c
45 lines (35 loc) · 1.19 KB
/
test_actionlist.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 2013 - Ryan Leonard <[email protected]>
#include "actionlist.h"
#include "action.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv){
char *fileName[1] = {
"./testFiles/testactionlist.config"
};
int ret;
struct ActionList *p_actionList;
printf("===\nRunning Test Set for ActionList.\n===\n\n");
// Test how parsing a config file goes
ret = initActionList(fileName[0], &p_actionList);
if (ret < 0)
printf("motherfuckin issues!\n");
// Print all of the actions in the ActionList
// Notice that this is the general way to iterate through the list
struct ActionList *pal = p_actionList;
struct Action *p_action;
do{
ret = getAction(&p_action, &pal);
if (ret < 0)
printf("motherfuckin issues!\n");
ret = nextAction(&pal);
if (ret < 0)
printf("motherfuckin issues!\n");
printf("%d, %d, %d\n", p_action->actionType, p_action->paramType, p_action->param.uid);
} while ( pal != p_actionList );
// Lets see if the free function works
ret = freeActionList(&p_actionList);
if (ret < 0)
printf("motherfuckin issues!\n");
return 0;
}