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;
|
size_t length;
|
||||||
} ArrayStringValues;
|
} ArrayStringValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Boolean (*token_handler)(LexerTest *, LexerResult, size_t, size_t, Token *, void *);
|
||||||
|
void *value;
|
||||||
|
} TokenStringValue;
|
||||||
|
|
||||||
// Test start and end helpers
|
// Test start and end helpers
|
||||||
|
|
||||||
static LexerTest start_up_test(const char *test_name, const char *test_code) {
|
static LexerTest start_up_test(const char *test_name, const char *test_code) {
|
||||||
|
|
@ -511,15 +516,21 @@ static Boolean test_array_struct_inline_value(LexerTest *test, LexerResult resul
|
||||||
return FALSE;
|
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;
|
static const TokenType token_type = TOKEN_TOKEN_STRING;
|
||||||
LexerTokenResult *head = get_token(result.result, i);
|
LexerTokenResult *head = get_token(result.result, i);
|
||||||
if (test_token_type(test, result, i, token_type)) {
|
if (test_token_type(test, result, i, token_type)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} 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;
|
||||||
}
|
}
|
||||||
error_test(test, result, (SlsError) { .message = "Test case not implemented!", .code = 984, });
|
for (int j = 0; j < number_of_tokens; j++) {
|
||||||
// TODO
|
if (values[j].token_handler(test, result, i, j, head->result.token_string.tokens[j], values[j].value)) {
|
||||||
return TRUE;
|
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 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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue