Feat: add test on what doesn't work!

This commit is contained in:
Bertrand Benjamin 2020-12-15 14:36:39 +01:00
parent 48088762be
commit a1608a20d1
1 changed files with 8 additions and 16 deletions

View File

@ -108,13 +108,12 @@ x^7
(6 + 6) * x + 4x^2 + 9 (6 + 6) * x + 4x^2 + 9
4x^2 + 12x + 9 4x^2 + 12x + 9
>>> e = Expression.from_str("(2x+3)(-x+1)") >>> e = Expression.from_str("(2x-3)(-x+2)")
>>> e_simplified = e.simplify() >>> e_simplified = e.simplify()
>>> e_simplified >>> e_simplified
<Quadratic - 2x^2 - x + 3> <Quadratic - 2x^2 + 7x - 6>
>>> for s in e_simplified.explain(): >>> for s in e_simplified.explain():
... print(s) ... print(s)
""" """
from .expression import Expression from .expression import Expression
@ -155,19 +154,12 @@ def set_render(render):
if __name__ == "__main__": if __name__ == "__main__":
e = Expression.from_str("1+2/3/4/5") e = Expression.from_str("(2x-3)(-x+2)")
et = e._typing() e_simplified = e.simplify()
print("typing") e_simplified
print(e._tree) for s in e_simplified.explain():
e = et._order() print(s._tree.map_on_leaf(lambda x: type(x)))
print("order") print(s)
print(e._tree)
e = e._optimize()
print("then optimize")
print(e._tree)
e = et._optimize()
print("optimize without order")
print(e._tree)
# ----------------------------- # -----------------------------
# Reglages pour 'vim' # Reglages pour 'vim'