def test_not(circuit): a, b = inputs("ab") truth_table_test( [a, b], a >> b >> not_gate, (((1, 1), (0, 0)), ((1, 0), (0, 1)), ((0, 1), (1, 0)), ((0, 0), (1, 1))), )
def test_bit(circuit): input_lines = inputs("is") truth_table_test( input_lines, input_lines >> bit, ( ((1, 1), 1), ((0, 1), 0), ((0, 0), 0), ((1, 0), 0), ((0, 0), 0), ((0, 1), 0), ((1, 1), 1), ((1, 0), 1), ((0, 0), 1), ((1, 0), 1), ((1, 1), 1), ((1, 0), 1), ((0, 1), []), ((0, 1), 0), ((1, 0), 0), ), )
def test_xor(circuit): a, b = inputs("ab") truth_table_test( [a, b], a >> b >> xor_gate, (((1, 1), 0), ((1, 0), 1), ((0, 1), 1), ((0, 0), 0)) )
def test_nand(circuit): a, b = inputs("ab") truth_table_test( [a, b], a >> b >> nand, (((1, 1), 0), ((1, 0), 1), ((0, 1), 1), ((0, 0), 1)) )