3 \details This is a testing driver for the IR system of APC.
6 ----------------------------------------------------------------------------*/
8 #include <stdio.h> //print
10 #include <errno.h> //lib errors
12 #include <apc/parser.tab.h>
17 int scanner_init(void);
19 void scanner_quit(void);
27 /* Ansi Term Colors */
28 #define RED "\x1b[31m"
29 #define GREEN "\x1b[32m"
30 #define YELLOW "\x1b[33m"
31 #define BLUE "\x1b[34m"
32 #define MAGENTA "\x1b[35m"
33 #define CYAN "\x1b[36m"
34 #define CLRC "\x1b[0m" //clear current color
41 const char* cargs
['Z'] = {0};
45 #define PRINTFAIL(U) printf(RED $(U) " FAILED\n" CLRC)
46 #define PRINTPASS(U) printf(GREEN $(U) " PASSED\n" CLRC)
47 #define PRINTINFO(S) printf(YELLOW S CLRC)
48 #define RUN_UNIT(U,T) \
57 { cargs
['d'] = "../../src";
58 RUN_UNIT(test_scan
,"Scanning\n");
64 { static int scanned_total
= 0;
73 if ((lexed
= test_lex()) == 0)
74 { printf("No tokens to parse\n");
78 { printf("Parsed %i Token%c\n", lexed
, lexed
> 1 ? 's' : ' ');
87 while ((tok_val
= lexer()) || yylval
.val
)
90 printf("[T:%4i|Y:%4i]",tok_val
,yylval
.val
);