Skip to content

Commit

Permalink
Test printing terms and predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Adda0 committed Nov 21, 2022
1 parent 19927f0 commit 6b7348b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/smt/theory_str_noodler/inclusion_graph_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ namespace smt::noodler {
return predicate.to_string();
}

std::ostream& operator<<(std::ostream& os, const Predicate& predicate) {
os << predicate.to_string();
return os;
}

static bool operator==(const Predicate& lhs, const Predicate& rhs) { return lhs.equals(rhs); }
static bool operator!=(const Predicate& lhs, const Predicate& rhs) { return !(lhs == rhs); }

Expand Down
7 changes: 7 additions & 0 deletions src/test/noodler/inclusion-graph-node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,12 @@ TEST_CASE("Conversion to strings") {
} } };

CHECK(pred.to_string() == "Equation: . \"4\" (Literal) . x_42 (Variable) = . xyz (Variable) . y_58 (Variable)");

auto pred_ineq{ Predicate{ PredicateType::Inequation, {
{ { BasicTermType::Literal, "4" }, { BasicTermType::Variable, "x_42" } } ,
{ { BasicTermType::Variable, "xyz" }, { BasicTermType::Variable, "y_58" } },
} } };

CHECK(pred_ineq.to_string() == "Inequation: . \"4\" (Literal) . x_42 (Variable) != . xyz (Variable) . y_58 (Variable)");
}

0 comments on commit 6b7348b

Please sign in to comment.