Skip to content

Commit

Permalink
✅ Add tests for simplifying multilinear polynomials
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Jul 1, 2023
1 parent fd7aed7 commit 226f175
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/python/katas/py4kyu/simplifying_multilinear_polynomials.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,12 @@ def simplify(poly: str) -> str:
return format_polynomial(monomials)


if __name__ == '__main__':
print(simplify("0a+3b-4c"))
def test_simplify():
assert simplify("dc+dcba") == "cd+abcd"
assert simplify("-a+5ab+3a-c-2a") == "-c+5ab"
assert simplify("-abc+3a+2ac") == "3a+2ac-abc"
assert simplify("xyz-xz") == "-xz+xyz"
assert simplify("a+ca-ab") == "a-ab+ac"
assert simplify("xzy+zby") == "byz+xyz"
assert simplify("-y+x") == "x-y"
assert simplify("y-x") == "-x+y"

0 comments on commit 226f175

Please sign in to comment.