#include #include "../src/Parser.hpp" class ParserTest { public: explicit ParserTest() {} virtual ~ParserTest() {} void test_parse(std::string const& oracle, std::string const& source) { auto node = m_parser.parse(source); REQUIRE(oracle == node->string()); } protected: fk::Loc m_loc {"tests/parser"}; fk::Lexer m_lexer { m_loc }; fk::Parser m_parser { m_lexer }; }; TEST_CASE_METHOD(ParserTest, "Parser_empty") { test_parse("MODULE", ""); } TEST_CASE_METHOD(ParserTest, "Parser_builtins") { test_parse("MODULE(INT[4],FLOAT[3.0],BOOL[false],STRING['salut'])", "4 3. false 'salut'"); }