modification

release/4.3a0
kartik arcot 2023-01-24 11:27:49 -08:00 committed by Frank Dellaert
parent baf4cf5a23
commit 503debfeb8
2 changed files with 8 additions and 1 deletions

View File

@ -33,6 +33,8 @@ std::optional<Row> static ParseConditional(const std::string& token) {
// can throw exception
row.push_back(std::stod(s));
}
// if we ended with a '/' then return false
if (token.back() == '/') return false;
} catch (...) {
return std::nullopt;
}

View File

@ -85,11 +85,16 @@ TEST(SimpleParser, Gibberish) {
// If Gibberish is in the middle, it should not parse.
TEST(SimpleParser, GibberishInMiddle) {
SignatureParser::Table expectedTable{{1, 1}, {2, 3}};
const auto table = SignatureParser::Parse("1/1 2/3 sdf 1/4");
EXPECT(!table);
}
// A test with slash in the end
TEST(SimpleParser, SlashInEnd) {
const auto table = SignatureParser::parse("1/1 2/");
EXPECT(!table);
}
/* ************************************************************************* */
int main() {