Compare commits

...

2 Commits

Author SHA1 Message Date
9919dd77f6 Feat: Few tests for Expression generator
Some checks failed
continuous-integration/drone/push Build is failing
2021-10-10 16:40:50 +02:00
5b0d0e5d1e Fix: log -> cos for domain issues 2021-10-09 20:01:32 +02:00
2 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,15 @@
import mapytex
def test_generate_expression():
random_expression = mapytex.random.expression("{a}+{b}")
assert type(random_expression).__name__ == "Expression"
random_expression = mapytex.random.expression("{a}/{b}")
assert type(random_expression).__name__ == "Fraction"
def test_generate_expression_calculus():
random_expression = mapytex.random.expression("{a}+{a*b}")
assert type(random_expression).__name__ == "Expression"
random_expression = mapytex.random.expression("{a}/{a*b}")
assert type(random_expression).__name__ == "Fraction"
assert random_expression.denominator / random_expression.numerator >=1

View File

@ -26,9 +26,9 @@ def test_generate_list_calculus_math():
import math
a, b, gcd = mapytex.random.list(["a", "b", "gcd(a, b)"])
assert math.gcd(a, b) == gcd
a, b, exp, log = mapytex.random.list(["a", "b", "exp(a)", "log(b)"])
a, b, exp, cos = mapytex.random.list(["a", "b", "exp(a)", "cos(b)"])
assert math.exp(a) == exp
assert math.log(b) == log
assert math.cos(b) == cos
def test_generate_list_conditions():