# Path: tt/definitions/operators.py
# BINARY_OPERATORS = {
#     TT_AND_OP,
#     TT_IMPL_OP,
#     TT_NAND_OP,
#     TT_NOR_OP,
#     TT_OR_OP,
#     TT_XNOR_OP,
#     TT_XOR_OP
# }
# 
# NON_PRIMITIVE_OPERATORS = BINARY_OPERATORS - {TT_AND_OP, TT_OR_OP}
# 
# TT_IMPL_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                              lambda a, b: (not a) or b,
#                              '->', 'impl')
# 
# TT_XOR_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                             lambda a, b: a != b,
#                             None, 'xor')
# 
# TT_XNOR_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                              lambda a, b: a == b,
#                              None, 'xnor')
# 
# TT_AND_OP = BooleanOperator(_PRECEDENCE['LOW'],
#                             lambda a, b: a and b,
#                             '/\\', 'and')
# 
# TT_NAND_OP = BooleanOperator(_PRECEDENCE['LOW'],
#                              lambda a, b: not(a and b),
#                              None, 'nand')
# 
# TT_OR_OP = BooleanOperator(_PRECEDENCE['ZERO'],
#                            lambda a, b: a or b,
#                            '\\/', 'or')
# 
# TT_NOR_OP = BooleanOperator(_PRECEDENCE['ZERO'],
#                             lambda a, b: not(a or b),
#                             None, 'nor')


import unittest
from tt.definitions import (
    BINARY_OPERATORS,
    NON_PRIMITIVE_OPERATORS,
    TT_AND_OP,
    TT_IMPL_OP,
    TT_NAND_OP,
    TT_NOR_OP,
    TT_OR_OP,
    TT_XNOR_OP,
    TT_XOR_OP)
"""Tests for the pre-defined sets of operators."""




class TestDefinedOperatorSets(unittest.TestCase):

    def test_binary_operators_is_proper_size(self):
        """Ensure the set is of the expected size."""
        self.assertEqual(7, len(BINARY_OPERATORS))

    def test_binary_operators_contains_expected_operators(self):
        """Ensure the set contains all operators."""
        self.assertTrue(TT_AND_OP in BINARY_OPERATORS)
        self.assertTrue(TT_IMPL_OP in BINARY_OPERATORS)
        self.assertTrue(TT_NAND_OP in BINARY_OPERATORS)
        self.assertTrue(TT_NOR_OP in BINARY_OPERATORS)
        self.assertTrue(TT_OR_OP in BINARY_OPERATORS)

# Path: tt/definitions/operators.py
# BINARY_OPERATORS = {
#     TT_AND_OP,
#     TT_IMPL_OP,
#     TT_NAND_OP,
#     TT_NOR_OP,
#     TT_OR_OP,
#     TT_XNOR_OP,
#     TT_XOR_OP
# }
# 
# NON_PRIMITIVE_OPERATORS = BINARY_OPERATORS - {TT_AND_OP, TT_OR_OP}
# 
# TT_IMPL_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                              lambda a, b: (not a) or b,
#                              '->', 'impl')
# 
# TT_XOR_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                             lambda a, b: a != b,
#                             None, 'xor')
# 
# TT_XNOR_OP = BooleanOperator(_PRECEDENCE['MEDIUM'],
#                              lambda a, b: a == b,
#                              None, 'xnor')
# 
# TT_AND_OP = BooleanOperator(_PRECEDENCE['LOW'],
#                             lambda a, b: a and b,
#                             '/\\', 'and')
# 
# TT_NAND_OP = BooleanOperator(_PRECEDENCE['LOW'],
#                              lambda a, b: not(a and b),
#                              None, 'nand')
# 
# TT_OR_OP = BooleanOperator(_PRECEDENCE['ZERO'],
#                            lambda a, b: a or b,
#                            '\\/', 'or')
# 
# TT_NOR_OP = BooleanOperator(_PRECEDENCE['ZERO'],
#                             lambda a, b: not(a or b),
#                             None, 'nor')


# Path: tt/tests/unit/definitions/test_defined_operator_sets.py
import unittest
from tt.definitions import (
    BINARY_OPERATORS,
    NON_PRIMITIVE_OPERATORS,
    TT_AND_OP,
    TT_IMPL_OP,
    TT_NAND_OP,
    TT_NOR_OP,
    TT_OR_OP,
    TT_XNOR_OP,
    TT_XOR_OP)

"""Tests for the pre-defined sets of operators."""




class TestDefinedOperatorSets(unittest.TestCase):

    def test_binary_operators_is_proper_size(self):
        """Ensure the set is of the expected size."""
        self.assertEqual(7, len(BINARY_OPERATORS))

    def test_binary_operators_contains_expected_operators(self):
        """Ensure the set contains all operators."""
        self.assertTrue(TT_AND_OP in BINARY_OPERATORS)
        self.assertTrue(TT_IMPL_OP in BINARY_OPERATORS)
        self.assertTrue(TT_NAND_OP in BINARY_OPERATORS)
        self.assertTrue(TT_NOR_OP in BINARY_OPERATORS)
        self.assertTrue(TT_OR_OP in BINARY_OPERATORS)

        self.assertTrue(TT_XNOR_OP in BINARY_OPERATORS)