diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index e4775fb..157eb0b 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -4,6 +4,21 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// +TEST(UtilsTests, ParseSimple) +{ + std::stringstream stream("identifier 5 \n-51\t expected unexpected 100 -100"); + + ASSERT_EQ(plasp::utils::parse(stream), "identifier"); + ASSERT_EQ(plasp::utils::parse(stream), 5); + ASSERT_EQ(plasp::utils::parse(stream), -51); + ASSERT_NO_THROW(plasp::utils::parseExpected(stream, "expected")); + ASSERT_THROW(plasp::utils::parseExpected(stream, "expected"), plasp::utils::ParserException); + ASSERT_NO_THROW(plasp::utils::parseExpected(stream, 100)); + ASSERT_THROW(plasp::utils::parseExpected(stream, 100), plasp::utils::ParserException); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + TEST(UtilsTests, EscapeASP) { const std::string predicate = "action(stack_on(block-1, block-2, value@3, value@4))";