def test_20(self, x: Variable, env: Environment) -> None: try: assert IsEqual(Logarithm(x, x), Integer(1)).evaluate(env) except EvaluationError: pass
def test_18(self, x: Variable, env: Environment) -> None: assert IsEqual(x**0, Integer(1)).evaluate(env)
def test_19(self, x: Variable, y: Variable, env: Environment) -> None: try: assert IsEqual((x + y)**2, x**2 + y**2 + 2 * x * y).evaluate(env) except EvaluationError: pass
def test_2(self, x: Variable, y: Variable, z: Variable, env: Environment) -> None: assert IsEqual((x + y) + z, x + (y + z)).evaluate(env)
def test_17(self, x: Variable, env: Environment) -> None: assert (IsEqual(x**1, x) | IsEqual(x, Integer(0))).evaluate(env)
def test_or(self, x: Variable, y: Variable, env: Environment) -> None: assert IsEqual(Or(x, y), Nand(Not(x), Not(y))).evaluate(env)
def test_4(self, x: Variable, env: Environment) -> None: assert IsEqual(Negate(Negate(x)), x).evaluate(env)
def test_10(self, x: Variable, y: Variable, z: Variable, env: Environment) -> None: try: assert IsEqual(x * (y + z), x * y + x * z).evaluate(env) except EvaluationError: pass
def test_13(self, x: Variable, env: Environment) -> None: if x.evaluate(env) != 0: assert IsEqual(x * Invert(x), Integer(1)).evaluate(env)
def test_8(self, x: Variable, y: Variable, env: Environment) -> None: assert IsEqual(x * y, y * x).evaluate(env)
def test_9(self, x: Variable, y: Variable, z: Variable, env: Environment) -> None: try: assert IsEqual((x * y) * z, x * (y * z)).evaluate(env) except EvaluationError: pass
def test_7(self, x: Variable, env: Environment) -> None: assert IsEqual(x + x, x * 2).evaluate(env)
def test_5(self, x: Variable, y: Variable, env: Environment) -> None: assert IsEqual(x + -y, x - y).evaluate(env)
def test_4(self, x: Variable, env: Environment) -> None: assert IsEqual(x + -x, Integer(0)).evaluate(env)
def test_not(self, x: Variable, env: Environment) -> None: assert IsEqual(Not(x), Nand(x, x)).evaluate(env)
def test_14(self, x: Variable, y: Variable, env: Environment) -> None: try: if y.evaluate(env) != 0: assert IsEqual(x * Invert(y), x / y).evaluate(env) except EvaluationError: pass
def test_and(self, x: Variable, y: Variable, env: Environment) -> None: assert IsEqual(And(x, y), Not(Nand(x, y))).evaluate(env)
def test_15(self, x: Variable, env: Environment) -> None: assert IsEqual(x / 1, x).evaluate(env)
def test_xor(self, x: Variable, y: Variable, env: Environment) -> None: assert IsEqual(Xor(x, y), And(Or(x, y), Nand(x, y))).evaluate(env)
def test_16(self, x: Variable, env: Environment) -> None: try: assert IsEqual(x * x, x**2).evaluate(env) except EvaluationError: pass
def test_5(self, x: Variable, env: Environment) -> None: assert IsEqual(Absolute(Negate(x)), Absolute(x)).evaluate(env)
def test_equality(val1: Node, val2: Node) -> None: assert IsEqual(val1, val2).evaluate() == (val1.evaluate() == val2.evaluate())