Skip to content

Commit

Permalink
Add unit tests for ParserException (cvc5#10189)
Browse files Browse the repository at this point in the history
  • Loading branch information
mudathirmahgoub authored Dec 1, 2023
1 parent b737fab commit 73b299d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/unit/api/cpp/input_parser_black.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "options/base_options.h"
#include "options/language.h"
#include "options/options.h"
#include <cvc5/cvc5_parser.h>
#include "test_parser.h"

using namespace cvc5::parser;
Expand Down Expand Up @@ -203,5 +202,28 @@ TEST_F(TestInputParserBlack, multipleParsers)
CVC5ApiException);
}

TEST_F(TestInputParserBlack, ParserExceptions)
{
ParserException defaultConstructor;
std::string message = "error";
const char* cMessage = "error";
std::string filename = "file.smt2";
ParserException stringConstructor(message);
ParserException cStringConstructor(cMessage);
ParserException exception(message, filename, 10, 11);
std::stringstream ss;
exception.toStream(ss);
ASSERT_EQ(message, exception.getMessage());
ASSERT_EQ(message, exception.getMessage());
ASSERT_EQ(filename, exception.getFilename());
ASSERT_EQ(10, exception.getLine());
ASSERT_EQ(11, exception.getColumn());

ParserEndOfFileException eofDefault;
ParserException eofString(message);
ParserException eofCMessage(cMessage);
ParserException eof(message, filename, 10, 11);
}

} // namespace test
} // namespace cvc5::internal

0 comments on commit 73b299d

Please sign in to comment.