Go to the documentation of this file.
20 #define TEST_INVALID(NAME,TEXT) START_TEST (NAME) \
21 { ck_assert (invalid_tokens(TEXT)); } \
27 #define TEST_0TOKENS(NAME,TEXT) START_TEST (NAME) \
28 { ck_assert (valid_0tokens(TEXT)); } \
34 #define TEST_1TOKEN(NAME,TEXT,ETYPE,ETEXT) START_TEST (NAME) \
35 { ck_assert (valid_1token(TEXT, ETYPE, ETEXT)); } \
41 #define TEST_2TOKENS(NAME,TEXT,ETYPE1,ETEXT1,ETYPE2,ETEXT2) START_TEST (NAME) \
42 { ck_assert (valid_2tokens(TEXT, ETYPE1, ETEXT1, ETYPE2, ETEXT2)); } \
48 #define TEST_TOKENS(NAME,TEXT,NTOKENS,ETOKENS) START_TEST (NAME) \
49 { ck_assert (valid_tokens(TEXT, NTOKENS, ETOKENS)); } \
55 #define TEST(NAME) tcase_add_test (tc, NAME)
123 TokenType expected_type2,
const char* expected_text2);
bool valid_tokens(char *text, size_t ntokens, Token expected_tokens[])
Run lexer on given text and verify that it returns tokens of the appropriate type.
Definition: testsuite.c:81
bool valid_1token(char *text, TokenType expected_type, const char *expected_text)
Run lexer on given text and verify that it returns a single correct token.
Definition: testsuite.c:50
Linked list of tokens.
Definition: token.h:152
Single token.
Definition: token.h:78
bool valid_2tokens(char *text, TokenType expected_type1, const char *expected_text1, TokenType expected_type2, const char *expected_text2)
Run lexer on given text and verify that it returns two correct tokens.
Definition: testsuite.c:63
TokenType
Valid token types.
Definition: token.h:69
bool valid_0tokens(char *text)
Run lexer on given text and verify that it returns no tokens (but also does not throw an exception).
Definition: testsuite.c:41
bool invalid_tokens(char *text)
Run lexer on given text and verify that it throws an exception.
Definition: testsuite.c:36
TokenQueue * run_lexer_check_size(char *text, size_t expected_length)
Run lexer on given text and check length of resulting token queue.
Definition: testsuite.c:21
Interface for Project 1 (Lexer)
TokenQueue * run_lexer(char *text)
Run lexer on given text.
Definition: testsuite.c:10