parser: add more tests

This commit is contained in:
djcb
2017-10-28 14:12:50 +03:00
parent a4fefc7256
commit 0e5e8b6bce
6 changed files with 118 additions and 30 deletions

View File

@ -92,12 +92,35 @@ test_complex ()
},
{ "(a or b) and c",
R"#((and(or(value "" "a")(value "" "b"))(value "" "c")))#"
},
{ "a b", // implicit and
R"#((and(value "" "a")(value "" "b")))#"
},
{ "a not b", // implicit and not
R"#((andnot(value "" "a")(value "" "b")))#"
},
{ "not b", // implicit and not
R"#((not(value "" "b")))#"
}
};
test_cases (cases);
}
static void
test_range ()
{
CaseVec cases = {
{ "range:a..b", // implicit and
R"#((range "range" "a" "b"))#"
},
};
test_cases (cases);
}
static void
test_flatten ()
{
@ -115,6 +138,7 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/basic", test_basic);
g_test_add_func ("/parser/complex", test_complex);
g_test_add_func ("/parser/range", test_range);
g_test_add_func ("/parser/flatten", test_flatten);
return g_test_run ();