Adds the equivalentTo test utility.

Change-Id: I1999a2e7434cc5919e628b906a13ec0edea04b8d
This commit is contained in:
Felix Raimundo
2016-04-11 16:45:10 +02:00
parent b13fb99653
commit 07fdfacd5b
2 changed files with 24 additions and 0 deletions

View File

@@ -64,3 +64,26 @@ bool identical_to(const char * input_string, const char * expected_string) {
return isIdentical;
}
bool equivalent_to(const char * input_string, const char * expected_string) {
Expression * input = Expression::parse(input_string);
assert(input != nullptr);
#if POINCARE_TESTS_PRINT_EXPRESSIONS
cout << "Input = " << endl;
print_expression(input);
#endif
Expression * expected = Expression::parse(expected_string);
assert(expected != nullptr);
#if POINCARE_TESTS_PRINT_EXPRESSIONS
cout << "Expected = " << endl;
print_expression(expected);
#endif
bool isEquivalent = input->isEquivalentTo(expected);
delete expected;
delete input;
return isEquivalent;
}

View File

@@ -6,5 +6,6 @@ bool simplifies_to(const char * input_string, const char * expected_string);
/* Tests that the first expression is identical to the second. */
bool identical_to(const char * input_string, const char * expected_string);
bool equivalent_to(const char * input_string, const char * expected_string);
#endif // POINCARE_TEST_SIMPLIFY_UTILS_H