From: Dejan Jovanović Date: Fri, 18 Dec 2009 17:25:25 +0000 (+0000) Subject: Changes to the parser tests to make them compile. X-Git-Tag: cvc5-1.0.0~9352 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00dd2bdb8225db08746b80c97e0522fbf419943e;p=cvc5.git Changes to the parser tests to make them compile. --- diff --git a/test/unit/parser/cvc/cvc_parser_black.h b/test/unit/parser/cvc/cvc_parser_black.h index 4679d358c..8c7dfb683 100644 --- a/test/unit/parser/cvc/cvc_parser_black.h +++ b/test/unit/parser/cvc/cvc_parser_black.h @@ -19,7 +19,7 @@ #include "expr/expr.h" #include "expr/expr_manager.h" -#include "parser/cvc/cvc_parser.h" +#include "parser/parser.h" using namespace CVC4; using namespace CVC4::parser; @@ -70,21 +70,24 @@ const string badBooleanExprs[] = { class CvcParserBlack : public CxxTest::TestSuite { private: ExprManager *d_exprManager; + Parser::InputLanguage d_lang; public: void setUp() { d_exprManager = new ExprManager(); + d_lang = Parser::LANG_CVC4; } void testGoodInputs() { // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(goodInputs); ++i) { istringstream stream(goodInputs[i]); - CvcParser cvcParser(d_exprManager, stream); - TS_ASSERT( !cvcParser.done() ); - while(!cvcParser.done()) { - TS_ASSERT( cvcParser.parseNextCommand() != NULL ); + Parser* cvcParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT( !cvcParser->done() ); + while(!cvcParser->done()) { + TS_ASSERT( cvcParser->parseNextCommand() != NULL ); } + delete cvcParser; } } @@ -92,8 +95,9 @@ public: // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(badInputs); ++i) { istringstream stream(badInputs[i]); - CvcParser cvcParser(d_exprManager, stream); - TS_ASSERT_THROWS( cvcParser.parseNextCommand(), ParserException ); + Parser* cvcParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT_THROWS( cvcParser->parseNextCommand(), ParserException ); + delete cvcParser; } } @@ -101,11 +105,12 @@ public: // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(goodBooleanExprs); ++i) { istringstream stream(goodBooleanExprs[i]); - CvcParser cvcParser(d_exprManager, stream); - TS_ASSERT( !cvcParser.done() ); - while(!cvcParser.done()) { - TS_ASSERT( !cvcParser.parseNextExpression().isNull() ); + Parser* cvcParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT( !cvcParser->done() ); + while(!cvcParser->done()) { + TS_ASSERT( !cvcParser->parseNextExpression().isNull() ); } + delete cvcParser; } } @@ -113,8 +118,9 @@ public: // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(badBooleanExprs); ++i) { istringstream stream(badBooleanExprs[i]); - CvcParser cvcParser(d_exprManager, stream); - TS_ASSERT_THROWS( cvcParser.parseNextExpression(), ParserException ); + Parser* cvcParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT_THROWS( cvcParser->parseNextExpression(), ParserException ); + delete cvcParser; } } diff --git a/test/unit/parser/smt/smt_parser_black.h b/test/unit/parser/smt/smt_parser_black.h index 7ec46b16c..0f1e03f6c 100644 --- a/test/unit/parser/smt/smt_parser_black.h +++ b/test/unit/parser/smt/smt_parser_black.h @@ -19,7 +19,7 @@ #include "expr/expr.h" #include "expr/expr_manager.h" -#include "parser/smt/smt_parser.h" +#include "parser/parser.h" using namespace CVC4; using namespace CVC4::parser; @@ -66,21 +66,23 @@ const string badBooleanExprs[] = { class SmtParserBlack : public CxxTest::TestSuite { private: ExprManager *d_exprManager; - + Parser::InputLanguage d_lang; public: void setUp() { d_exprManager = new ExprManager(); + d_lang = Parser::LANG_SMTLIB; } void testGoodInputs() { // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(goodInputs); ++i) { istringstream stream(goodInputs[i]); - SmtParser smtParser(d_exprManager, stream); - TS_ASSERT( !smtParser.done() ); - while(!smtParser.done()) { - TS_ASSERT( smtParser.parseNextCommand() != NULL ); + Parser* smtParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT( !smtParser->done() ); + while(!smtParser->done()) { + TS_ASSERT( smtParser->parseNextCommand() != NULL ); } + delete smtParser; } } @@ -88,8 +90,9 @@ public: // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(badInputs); ++i) { istringstream stream(badInputs[i]); - SmtParser smtParser(d_exprManager, stream); - TS_ASSERT_THROWS( smtParser.parseNextCommand(), ParserException ); + Parser* smtParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT_THROWS( smtParser->parseNextCommand(), ParserException ); + delete smtParser; } } @@ -97,11 +100,12 @@ public: // cout << "In testGoodInputs()\n"; for(int i = 0; i < sizeof(goodBooleanExprs); ++i) { istringstream stream(goodBooleanExprs[i]); - SmtParser smtParser(d_exprManager, stream); - TS_ASSERT( !smtParser.done() ); - while(!smtParser.done()) { - TS_ASSERT( !smtParser.parseNextExpression().isNull() ); + Parser* smtParser = Parser::getNewParser(d_exprManager, d_lang, stream); + TS_ASSERT( !smtParser->done() ); + while(!smtParser->done()) { + TS_ASSERT( !smtParser->parseNextExpression().isNull() ); } + delete smtParser; } }