Skip to content

Commit

Permalink
deal with unit test failure cases, fixes Z3Prover#132 Z3Prover#133
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <[email protected]>
  • Loading branch information
NikolajBjorner authored and Christoph M. Wintersteiger committed Jun 24, 2015
1 parent 1bdedec commit 22c0a59
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/muz/fp/datalog_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ class line_reader {
resize_data(0);
#if _WINDOWS
errno_t err = fopen_s(&m_file, fname, "rb");
m_ok = err == 0;
m_ok = (m_file != NULL) && (err == 0);
#else
m_file = fopen(fname, "rb");
m_ok = (m_file != NULL);
#endif
}
~line_reader() {
Expand Down
3 changes: 2 additions & 1 deletion src/test/dl_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ void dl_context_saturate_file(params_ref & params, const char * f) {
ctx.updt_params(params);

datalog::parser * parser = datalog::parser::create(ctx, m);
if (!parser->parse_file(f)) {
if (!parser || !parser->parse_file(f)) {
warning_msg("ERROR: failed to parse file");
dealloc(parser);
return;
}
dealloc(parser);
Expand Down
2 changes: 1 addition & 1 deletion src/test/dl_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void dl_query_test(ast_manager & m, smt_params & fparams, params_ref& params,
ctx_q.updt_params(params);
{
parser* p = parser::create(ctx_q,m);
bool ok = p->parse_file(problem_file);
bool ok = p && p->parse_file(problem_file);
dealloc(p);
if (!ok) {
std::cout << "Could not parse: " << problem_file << "\n";
Expand Down
6 changes: 3 additions & 3 deletions src/test/pdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct test_model_search {
};

ast_manager m;
smt_params smt_params;
smt_params m_smt_params;
fixedpoint_params fp_params;
context ctx;
manager pm;
Expand All @@ -40,8 +40,8 @@ struct test_model_search {


test_model_search():
ctx(smt_params, fp_params, m),
pm(smt_params, 10, m),
ctx(m_smt_params, fp_params, m),
pm(m_smt_params, 10, m),
fn(m),
initt(fn),
pt(ctx, pm, fn),
Expand Down

0 comments on commit 22c0a59

Please sign in to comment.