Skip to content

Commit

Permalink
fix #6535
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jan 13, 2023
1 parent 0d46787 commit d289434
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/test/smt2print_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void test_parseprint(char const* spec) {
void test_eval(Z3_context ctx, Z3_string spec, bool shouldFail) {
std::cout << "spec:\n" << spec << "\n";

Z3_string resp;
std::string resp;
bool failed = false;
try {
resp = Z3_eval_smtlib2_string(ctx, spec);
Expand All @@ -76,6 +76,10 @@ void test_eval(Z3_context ctx, Z3_string spec, bool shouldFail) {
resp = e.what();
failed = true;
}
catch (...) {
resp = "unknown exception";
failed = true;
}

std::cout << "response:\n" << resp << "\n";

Expand Down Expand Up @@ -141,15 +145,21 @@ void test_repeated_eval() {
Z3_set_error_handler(ctx, throwError);
std::cout << "testing Z3_eval_smtlib2_string\n";

test_eval(ctx, spec1, false);
std::cout << "successful call after successful call\n";
test_eval(ctx, spec2, false);
std::cout << "failing call after successful call\n";
test_eval(ctx, spec3, true);
std::cout << "failing call after failing call\n";
test_eval(ctx, spec4, true);
std::cout << "successful call after failing call\n";
test_eval(ctx, spec1, false);
try {
test_eval(ctx, spec1, false);
std::cout << "successful call after successful call\n";
test_eval(ctx, spec2, false);
std::cout << "failing call after successful call\n";
test_eval(ctx, spec3, true);
std::cout << "failing call after failing call\n";
test_eval(ctx, spec4, true);
std::cout << "successful call after failing call\n";
test_eval(ctx, spec1, false);
}
catch(...) {
std::cout << "Error: uncaught exception\n";
throw;
}

std::cout << "done evaluating\n";

Expand Down

0 comments on commit d289434

Please sign in to comment.