Slope parser test

This commit is contained in:
Takeshi Yokemura
2021-08-15 15:17:48 +09:00
parent 846133ac39
commit 252a84d618
3 changed files with 115 additions and 7 deletions

View File

@ -36,18 +36,23 @@ std::vector<int> FrameSequenceParser::parseSlope (const String& input,
// find index of "in"
int inIndex = input.indexOf ("in");
if (inIndex > input.length() - 3)
{
*error = kParseErrorMissingSlopeFinalValue;
return retval;
}
if (inIndex < 0)
{
*error = kParseErrorMissingSlopeLengthDelimiter;
return retval;
}
if (inIndex > input.length() - 3)
{
*error = kParseErrorMissingSlopeFrameCount;
return retval;
}
if (inIndex - toIndex < 3)
{
*error = kParseErrorMissingSlopeFinalValue;
return retval;
}
// get 3 substrings separated by "to" and "in" and put them into `from`, `to`, `cntStr`
String fromStr = input.substring (0, toIndex);
String toStr = input.substring (toIndex + 2, inIndex);