mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-30 04:00:02 +02:00
Adds the equivalentTo test utility.
Change-Id: I1999a2e7434cc5919e628b906a13ec0edea04b8d
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user