]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: slre: add more test cases
authorRasmus Villemoes <ravi@prevas.dk>
Tue, 13 May 2025 08:40:27 +0000 (10:40 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 29 May 2025 14:25:18 +0000 (08:25 -0600)
Add some tests for the "drop wrong anchored optimization". Without
the previous commit, the first, fifth and seventh of these would fail,
i.e. those:

{ "xby", "^a|b", 1},
{ "", "x*$", 1},
{ "yy", "x*$", 1},

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
test/lib/slre.c

index 51a50b269aa9906dd3ad36fa3c05deb0fd26b91e..b76d33475dd7cb094b5407271ffb2128ad964a75 100644 (file)
@@ -15,6 +15,14 @@ static const struct re_test re_test[] = {
        { "x23", "^\\d+$", 0},
        { "banana", "^([bn]a)*$", 1},
        { "panama", "^([bn]a)*$", 0},
+       { "xby", "^a|b", 1},
+       { "xby", "b|^a", 1},
+       { "xby", "b|c$", 1},
+       { "xby", "c$|b", 1},
+       { "", "x*$", 1},
+       { "", "^x*$", 1},
+       { "yy", "x*$", 1},
+       { "yy", "^x*$", 0},
        {}
 };