modification
parent
baf4cf5a23
commit
503debfeb8
|
@ -33,6 +33,8 @@ std::optional<Row> static ParseConditional(const std::string& token) {
|
||||||
// can throw exception
|
// can throw exception
|
||||||
row.push_back(std::stod(s));
|
row.push_back(std::stod(s));
|
||||||
}
|
}
|
||||||
|
// if we ended with a '/' then return false
|
||||||
|
if (token.back() == '/') return false;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,16 @@ TEST(SimpleParser, Gibberish) {
|
||||||
|
|
||||||
// If Gibberish is in the middle, it should not parse.
|
// If Gibberish is in the middle, it should not parse.
|
||||||
TEST(SimpleParser, GibberishInMiddle) {
|
TEST(SimpleParser, GibberishInMiddle) {
|
||||||
SignatureParser::Table expectedTable{{1, 1}, {2, 3}};
|
|
||||||
const auto table = SignatureParser::Parse("1/1 2/3 sdf 1/4");
|
const auto table = SignatureParser::Parse("1/1 2/3 sdf 1/4");
|
||||||
EXPECT(!table);
|
EXPECT(!table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A test with slash in the end
|
||||||
|
TEST(SimpleParser, SlashInEnd) {
|
||||||
|
const auto table = SignatureParser::parse("1/1 2/");
|
||||||
|
EXPECT(!table);
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
Loading…
Reference in New Issue