[poincare] Add tests on composed functions

This commit is contained in:
Émilie Feral
2018-11-16 09:42:35 +01:00
parent 28189aadac
commit 140ccbfa77

View File

@@ -183,3 +183,17 @@ QUIZ_CASE(poincare_store_circular_variables_and_functions) {
Ion::Storage::sharedStorage()->recordNamed("a.exp").destroy();
Ion::Storage::sharedStorage()->recordNamed("b.exp").destroy();
}
QUIZ_CASE(poincare_store_composed_functions) {
// f: x->x^2
assert_simplify("x^2>f(x)");
// g: x->f(x-2)
assert_simplify("f(x-2)>g(x)");
assert_parsed_expression_evaluates_to<double>("f(2)", "4");
assert_parsed_expression_evaluates_to<double>("g(3)", "1");
assert_parsed_expression_evaluates_to<double>("g(5)", "9");
// Clean the storage for other tests
Ion::Storage::sharedStorage()->recordNamed("f.func").destroy();
Ion::Storage::sharedStorage()->recordNamed("g.func").destroy();
}