Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide samples of well-known, complexer domains #603

Open
learn-more opened this issue Sep 28, 2023 · 0 comments
Open

Provide samples of well-known, complexer domains #603

learn-more opened this issue Sep 28, 2023 · 0 comments

Comments

@learn-more
Copy link

An example for a well-known domain (for example, xml) would be very helpful.
The idea of xml is fairly simple, but the domain is actually pretty complex.

Without understanding everything, I gobbled together something like this:

auto XmlOpenTag() {
    return InRegexp("<[^(/><.)]+>");
}

auto XmlCloseTag() {
    return InRegexp("</[^(/><.)]+>");
}

auto XmlEmptyTag() {
    return InRegexp("<[^(/><.)]+/>");
}

FUZZ_TEST(XMLTest, XMLReadFromStringHasNoUndefinedBehavior)
    .WithDomains(OneOf(XmlOpenTag(), XmlCloseTag(), XmlEmptyTag(), Arbitrary<std::string>()))
    .WithSeeds([]() -> std::vector<std::tuple<std::string>> {
        return {
            { "<tag></tag>" },
            { "<tag><tag></tag></tag>" },
            { "<tag><tag>garbage</tag></tag>" },
            { "<tag><tag stuff=\"xxxxx\">garbage</tag></tag>" },
            { "<tag><tag><tag /></tag></tag>" },
        };
    });

But this is far from a decent implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant