Decaf Compiler
testsuite.h
Go to the documentation of this file.
1 
6 #include <stdbool.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <stdint.h>
10 #include <assert.h>
11 #include <time.h>
12 
13 #include <check.h>
14 
15 #include "p1-lexer.h"
16 #include "p2-parser.h"
17 #include "p3-analysis.h"
18 #include "p4-codegen.h"
19 
23 #define ERROR_RETURN_CODE (-9999)
24 
28 #define TEST_PROGRAM(NAME,RVAL,TEXT) START_TEST (NAME) \
29 { ck_assert_int_eq (run_program(TEXT), RVAL); } \
30 END_TEST
31 
35 #define TEST_MAIN(NAME,RVAL,TEXT) START_TEST (NAME) \
36 { ck_assert_int_eq (run_main(TEXT), RVAL); } \
37 END_TEST
38 
42 #define TEST_EXPRESSION(NAME,RVAL,TEXT) START_TEST (NAME) \
43 { ck_assert_int_eq (run_expression(TEXT), RVAL); } \
44 END_TEST
45 
49 #define TEST_BOOL_EXPRESSION(NAME,RVAL,TEXT) START_TEST (NAME) \
50 { ck_assert_int_eq (run_bool_expression(TEXT), RVAL); } \
51 END_TEST
52 
56 #define TEST(NAME) tcase_add_test (tc, NAME)
57 
64 int run_program (char* text);
65 
72 int run_main (char* text);
73 
81 int run_expression (char* text);
82 
90 int run_bool_expression (char* text);
p4-codegen.h
Interface for Project 4 (Code Generation)
p2-parser.h
Interface for Project 2 (Parser)
run_main
int run_main(char *text)
Run lexer, parser, analysis, and code generation on given 'main' function.
Definition: testsuite.c:33
p3-analysis.h
Interface for Project 3 (Analysis)
run_program
int run_program(char *text)
Run lexer, parser, analysis, and code generation on given program.
Definition: testsuite.c:10
run_bool_expression
int run_bool_expression(char *text)
Run lexer, parser, analysis, and code generation on given boolean expression.
Definition: testsuite.c:47
p1-lexer.h
Interface for Project 1 (Lexer)
run_expression
int run_expression(char *text)
Run lexer, parser, analysis, and code generation on given integer expression.
Definition: testsuite.c:40