Add unit tests for most eventhandlerset script sequences

This commit is contained in:
Jan committed 2021-11-14 18:17:13 +01:00
1 parent 252dee03ba
commit 109955b8f2
3 files changed
+833 -26

No files matched your search

@@ -29,7 +29,7 @@ namespace menu
{
}
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptNumeric() const
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptStrictNumeric() const
{
return Or({
Type(SimpleParserValueType::INTEGER).Transform([](const token_list_t& tokens)-> SimpleParserValue
@@ -41,7 +41,14 @@ namespace menu
{
const auto& firstToken = tokens[0].get();
return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.FloatingPointValue())));
}),
})
});
}
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptNumeric() const
{
return Or({
ScriptStrictNumeric(),
Or({
Type(SimpleParserValueType::CHARACTER),
Type(SimpleParserValueType::STRING),
@@ -97,10 +104,10 @@ namespace menu
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> ScriptColor() const
{
return And({
Optional(ScriptNumeric()),
Optional(ScriptNumeric()),
Optional(ScriptNumeric()),
Optional(ScriptNumeric())
ScriptStrictNumeric(),
Optional(ScriptStrictNumeric()),
Optional(ScriptStrictNumeric()),
Optional(ScriptStrictNumeric())
});
}
};