Fixing whitespace errors and cleaning error message alert to be clearer.
This commit is contained in:
parent
345eae3021
commit
b7264d6efd
1 changed files with 6 additions and 4 deletions
|
@ -30,12 +30,14 @@ expr ::= term ("+" term)*
|
||||||
term ::= numero
|
term ::= numero
|
||||||
number ::= [0-9]+)""";
|
number ::= [0-9]+)""";
|
||||||
|
|
||||||
|
fprintf(stderr, "NOTE: Error message (\"error parsing grammar\") expected on following line during successful test:\n");
|
||||||
|
|
||||||
grammar_parser::parse_state parsed_grammar = grammar_parser::parse(grammar_str.c_str());
|
grammar_parser::parse_state parsed_grammar = grammar_parser::parse(grammar_str.c_str());
|
||||||
|
|
||||||
// Ensure we did NOT parsed correctly
|
// Ensure we did NOT parsed correctly
|
||||||
assert(parsed_grammar.rules.empty());
|
assert(parsed_grammar.rules.empty());
|
||||||
|
|
||||||
fprintf(stderr, "^ If previous line displays an error, then this test passed.\n");
|
fprintf(stderr, "End of expected error message. Test successful.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_simple_grammar() {
|
static void test_simple_grammar() {
|
||||||
|
@ -80,7 +82,7 @@ number ::= [0-9]+)""";
|
||||||
|
|
||||||
assert(completed_grammar);
|
assert(completed_grammar);
|
||||||
|
|
||||||
// Clean up allocated memory
|
// Clean up allocated memory
|
||||||
llama_grammar_free(grammar);
|
llama_grammar_free(grammar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +224,7 @@ ws ::= [ \t\n\r]?)""";
|
||||||
grammar->stacks = original_stacks;
|
grammar->stacks = original_stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up allocated memory
|
// Clean up allocated memory
|
||||||
llama_grammar_free(grammar);
|
llama_grammar_free(grammar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,4 +235,4 @@ int main() {
|
||||||
test_failure_missing_reference();
|
test_failure_missing_reference();
|
||||||
// Add more test cases as needed
|
// Add more test cases as needed
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue