Decaf Compiler
Loading...
Searching...
No Matches
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); } \
30END_TEST
31
35#define TEST_MAIN(NAME,RVAL,TEXT) START_TEST (NAME) \
36{ ck_assert_int_eq (run_main(TEXT), RVAL); } \
37END_TEST
38
42#define TEST_EXPRESSION(NAME,RVAL,TEXT) START_TEST (NAME) \
43{ ck_assert_int_eq (run_expression(TEXT), RVAL); } \
44END_TEST
45
49#define TEST_BOOL_EXPRESSION(NAME,RVAL,TEXT) START_TEST (NAME) \
50{ ck_assert_int_eq (run_bool_expression(TEXT), RVAL); } \
51END_TEST
52
56#define TEST(NAME) tcase_add_test (tc, NAME)
57
64int run_program (char* text);
65
72int run_main (char* text);
73
81int run_expression (char* text);
82
90int run_bool_expression (char* text);
Interface for Project 1 (Lexer)
Interface for Project 2 (Parser)
Interface for Project 3 (Analysis)
Interface for Project 4 (Code Generation)
int run_expression(char *text)
Run lexer, parser, analysis, and code generation on given integer expression.
Definition testsuite.c:40
int run_bool_expression(char *text)
Run lexer, parser, analysis, and code generation on given boolean expression.
Definition testsuite.c:47
int run_main(char *text)
Run lexer, parser, analysis, and code generation on given 'main' function.
Definition testsuite.c:33
int run_program(char *text)
Run lexer, parser, analysis, and code generation on given program.
Definition testsuite.c:10