def test_two_gate_loop(self): a = Nand() b = Nand() a.o[0].connect(b.i[0]) is_loop = creates_loop(b.o[0],a.i[0]) self.assertTrue(is_loop)
def test_three_gate_non_loop(self): a = Nand() b = Nand() c = Nand() a.o[0].connect(b.i[0]) is_loop = creates_loop(b.o[0],c.i[0]) self.assertFalse(is_loop)
def test_simple_loop(self): a = Nand() is_loop = creates_loop(a.o[0],a.i[0]) self.assertTrue(is_loop)