|
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"Go to the source code of this file.
Macros | |
| #define | TEST_VALID(NAME, TEXT) |
| Define a test case with a valid program. More... | |
| #define | TEST_INVALID(NAME, TEXT) |
| Define a test case with an invalid program. More... | |
| #define | TEST_VALID_MAIN(NAME, TEXT) |
| Define a test case with a valid main function. More... | |
| #define | TEST_INVALID_MAIN(NAME, TEXT) |
| Define a test case with an invalid main function. More... | |
| #define | TEST(NAME) tcase_add_test (tc, NAME) |
| Add a test to the test suite. | |
Functions | |
| ErrorList * | run_analysis (char *text) |
| Run lexer, parser, and analysis on given text. More... | |
| bool | invalid_program (char *text) |
| Run lexer and parser on given text and verify that it throws an exception. More... | |
| bool | valid_program (char *text) |
| Run lexer and parser on given text and verify that it returns an AST and does not throw an exception. More... | |
Testing utility functions.
| #define TEST_INVALID | ( | NAME, | |
| TEXT | |||
| ) |
Define a test case with an invalid program.
| #define TEST_INVALID_MAIN | ( | NAME, | |
| TEXT | |||
| ) |
Define a test case with an invalid main function.
| #define TEST_VALID | ( | NAME, | |
| TEXT | |||
| ) |
Define a test case with a valid program.
| #define TEST_VALID_MAIN | ( | NAME, | |
| TEXT | |||
| ) |
Define a test case with a valid main function.
| bool invalid_program | ( | char * | text | ) |
Run lexer and parser on given text and verify that it throws an exception.
| text | Code to lex and parse |
| ErrorList* run_analysis | ( | char * | text | ) |
Run lexer, parser, and analysis on given text.
| text | Code to lex, parse, and analyze |
NULL if there was an error | bool valid_program | ( | char * | text | ) |
Run lexer and parser on given text and verify that it returns an AST and does not throw an exception.
| text | Code to lex and parse |
1.8.16