|
Decaf Compiler
|
Testing utility functions. More...
#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <assert.h>#include <time.h>#include <check.h>#include "p1-lexer.h"#include "p2-parser.h"#include "p3-analysis.h"#include "p4-codegen.h"Go to the source code of this file.
Macros | |
| #define | ERROR_RETURN_CODE (-9999) |
| Return value indicating an error. | |
| #define | TEST_PROGRAM(NAME, RVAL, TEXT) |
| Define a test case with an entire program. More... | |
| #define | TEST_MAIN(NAME, RVAL, TEXT) |
| Define a test case with only a 'main' function. More... | |
| #define | TEST_EXPRESSION(NAME, RVAL, TEXT) |
| Define a test case with a single integer expression. More... | |
| #define | TEST_BOOL_EXPRESSION(NAME, RVAL, TEXT) |
| Define a test case with a single boolean expression. More... | |
| #define | TEST(NAME) tcase_add_test (tc, NAME) |
| Add a test to the test suite. | |
Functions | |
| int | run_program (char *text) |
| Run lexer, parser, analysis, and code generation on given program. More... | |
| int | run_main (char *text) |
| Run lexer, parser, analysis, and code generation on given 'main' function. More... | |
| int | run_expression (char *text) |
| Run lexer, parser, analysis, and code generation on given integer expression. More... | |
| int | run_bool_expression (char *text) |
| Run lexer, parser, analysis, and code generation on given boolean expression. More... | |
Testing utility functions.
| #define TEST_BOOL_EXPRESSION | ( | NAME, | |
| RVAL, | |||
| TEXT | |||
| ) |
Define a test case with a single boolean expression.
| #define TEST_EXPRESSION | ( | NAME, | |
| RVAL, | |||
| TEXT | |||
| ) |
Define a test case with a single integer expression.
| #define TEST_MAIN | ( | NAME, | |
| RVAL, | |||
| TEXT | |||
| ) |
Define a test case with only a 'main' function.
| #define TEST_PROGRAM | ( | NAME, | |
| RVAL, | |||
| TEXT | |||
| ) |
Define a test case with an entire program.
| int run_bool_expression | ( | char * | text | ) |
Run lexer, parser, analysis, and code generation on given boolean expression.
| text | Expression to lex, parse, analyze, and generate |
ERROR_RETURN_CODE if there was an error | int run_expression | ( | char * | text | ) |
Run lexer, parser, analysis, and code generation on given integer expression.
| text | Expression to lex, parse, analyze, and generate |
ERROR_RETURN_CODE if there was an error | int run_main | ( | char * | text | ) |
Run lexer, parser, analysis, and code generation on given 'main' function.
| text | Function code to lex, parse, analyze, and generate |
ERROR_RETURN_CODE if there was an error | int run_program | ( | char * | text | ) |
Run lexer, parser, analysis, and code generation on given program.
| text | Code to lex, parse, analyze, and generate |
ERROR_RETURN_CODE if there was an error
1.8.17