Unicode symbol modifications to hopefully make log easier to parse visually.
This commit is contained in:
parent
b712ae4047
commit
54fa2e5b23
1 changed files with 5 additions and 5 deletions
|
@ -53,7 +53,7 @@ static bool match_string(const std::string & input, llama_grammar* grammar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_grammar(const std::string & test_desc, const std::string & grammar_str, const std::vector<std::string> & passing_strings, const std::vector<std::string> & failing_strings) {
|
static void test_grammar(const std::string & test_desc, const std::string & grammar_str, const std::vector<std::string> & passing_strings, const std::vector<std::string> & failing_strings) {
|
||||||
fprintf(stderr, "⚪ Testing %s. Grammar: %s\n", test_desc.c_str(), grammar_str.c_str());
|
fprintf(stderr, "⚫ Testing %s. Grammar: %s\n", test_desc.c_str(), grammar_str.c_str());
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
auto grammar = build_grammar(grammar_str);
|
auto grammar = build_grammar(grammar_str);
|
||||||
|
@ -61,7 +61,7 @@ static void test_grammar(const std::string & test_desc, const std::string & gram
|
||||||
// Save the original grammar stacks so that we can reset after every new string we want to test
|
// Save the original grammar stacks so that we can reset after every new string we want to test
|
||||||
auto original_stacks = grammar->stacks;
|
auto original_stacks = grammar->stacks;
|
||||||
|
|
||||||
fprintf(stderr, " Valid strings:\n");
|
fprintf(stderr, " 🔵 Valid strings:\n");
|
||||||
|
|
||||||
// Passing strings
|
// Passing strings
|
||||||
for (const auto & test_string : passing_strings) {
|
for (const auto & test_string : passing_strings) {
|
||||||
|
@ -82,7 +82,7 @@ static void test_grammar(const std::string & test_desc, const std::string & gram
|
||||||
grammar->stacks = original_stacks;
|
grammar->stacks = original_stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, " Invalid strings:\n");
|
fprintf(stderr, " 🟠 Invalid strings:\n");
|
||||||
|
|
||||||
// Failing strings
|
// Failing strings
|
||||||
for (const auto & test_string : failing_strings) {
|
for (const auto & test_string : failing_strings) {
|
||||||
|
@ -282,7 +282,7 @@ static void test_quantifiers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_failure_missing_root() {
|
static void test_failure_missing_root() {
|
||||||
fprintf(stderr, "⚪ Testing missing root node:\n");
|
fprintf(stderr, "⚫ Testing missing root node:\n");
|
||||||
// Test case for a grammar that is missing a root rule
|
// Test case for a grammar that is missing a root rule
|
||||||
const std::string grammar_str = R"""(rot ::= expr
|
const std::string grammar_str = R"""(rot ::= expr
|
||||||
expr ::= term ("+" term)*
|
expr ::= term ("+" term)*
|
||||||
|
@ -300,7 +300,7 @@ number ::= [0-9]+)""";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_failure_missing_reference() {
|
static void test_failure_missing_reference() {
|
||||||
fprintf(stderr, "⚪ Testing missing reference node:\n");
|
fprintf(stderr, "⚫ Testing missing reference node:\n");
|
||||||
|
|
||||||
// Test case for a grammar that is missing a referenced rule
|
// Test case for a grammar that is missing a referenced rule
|
||||||
const std::string grammar_str =
|
const std::string grammar_str =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue