Implemented test_token_string_value test helper function
This commit is contained in:
parent
1cf292d3e5
commit
03ca3411d0
|
|
@ -26,6 +26,11 @@ typedef struct {
|
|||
size_t length;
|
||||
} ArrayStringValues;
|
||||
|
||||
typedef struct {
|
||||
Boolean (*token_handler)(LexerTest *, LexerResult, size_t, size_t, Token *, void *);
|
||||
void *value;
|
||||
} TokenStringValue;
|
||||
|
||||
// Test start and end helpers
|
||||
|
||||
static LexerTest start_up_test(const char *test_name, const char *test_code) {
|
||||
|
|
@ -511,16 +516,22 @@ static Boolean test_array_struct_inline_value(LexerTest *test, LexerResult resul
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static Boolean test_token_string_value(LexerTest *test, LexerResult result, size_t i, void *value) {
|
||||
static Boolean test_token_string_value(LexerTest *test, LexerResult result, size_t i, size_t number_of_tokens, TokenStringValue *values) {
|
||||
static const TokenType token_type = TOKEN_TOKEN_STRING;
|
||||
LexerTokenResult *head = get_token(result.result, i);
|
||||
if (test_token_type(test, result, i, token_type)) {
|
||||
return TRUE;
|
||||
}
|
||||
error_test(test, result, (SlsError) { .message = "Test case not implemented!", .code = 984, });
|
||||
// TODO
|
||||
} if (head->result.token_string.length != number_of_tokens) {
|
||||
logic_fail_test(test, result, integer_value_should_be(i + 1, number_of_tokens, head->result.token_string.length));
|
||||
return TRUE;
|
||||
}
|
||||
for (int j = 0; j < number_of_tokens; j++) {
|
||||
if (values[j].token_handler(test, result, i, j, head->result.token_string.tokens[j], values[j].value)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Boolean test_type_tuple_value(LexerTest *test, LexerResult result, size_t i, ArrayStringValues *input_values, size_t input_length, ArrayStringValues *output_values, size_t output_length) {
|
||||
static const TokenType token_type = TOKEN_TYPE_TUPLE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue