Skip to content
Snippets Groups Projects
Commit bd6d26a6 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Some code coverage fixes.

parent 2eb3b7cb
No related branches found
No related tags found
No related merge requests found
......@@ -155,22 +155,19 @@ def match_variable_power(node):
evars = find_variables(exponent)
x = get_derivation_variable(node, rvars | evars)
if x in rvars and x in evars:
return [P(node, power_rule)]
if x in rvars:
if x in evars:
return [P(node, power_rule)]
if root.is_variable():
return [P(node, variable_root)]
return [P(node, chain_rule, (root, variable_root, ()))]
if x in evars:
if exponent.is_variable():
return [P(node, variable_exponent)]
if exponent.is_variable():
return [P(node, variable_exponent)]
return [P(node, chain_rule, (exponent, variable_exponent, ()))]
return []
return [P(node, chain_rule, (exponent, variable_exponent, ()))]
def power_rule(root, args):
......
......@@ -132,13 +132,20 @@ class TestRulesIntegrals(RulesTestCase):
])
def test_match_function_integral(self):
root0, root1, root2 = tree('int ln x, int sin x, int cos x')
self.assertEqualPos(match_function_integral(root0),
[P(root0, logarithm_integral)])
self.assertEqualPos(match_function_integral(root1),
[P(root1, sinus_integral)])
self.assertEqualPos(match_function_integral(root2),
[P(root2, cosinus_integral)])
root = tree('int ln x')
self.assertEqualPos(match_function_integral(root),
[P(root, logarithm_integral)])
root = tree('int sin x')
self.assertEqualPos(match_function_integral(root),
[P(root, sinus_integral)])
root = tree('int cos x')
self.assertEqualPos(match_function_integral(root),
[P(root, cosinus_integral)])
root = tree('int sqrt x')
self.assertEqualPos(match_function_integral(root), [])
def test_logarithm_integral(self):
root, expect = tree('int ln x, (xlnx - x) / ln e + c')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment