def testcase_04(self): a=NandGate() a.Input0=True a.Input1=True a.execute() self.assertFalse(a.Output,"Class NandGate: TestCase 1 failed.")
def testcase_00(self): a = NandGate() self.assertEqual(False, a.Input0, "Class OrGate Testcase 0 failed.") self.assertEqual(False, a.Input1, "Class OrGate Testcase 0 failed.") self.assertEqual(True, a.Output, "Class OrGate Testcase 0 failed.")
from AndGate import AndGate from OrGate import OrGate from NandGate import NandGate #AndGate n = AndGate(True, False, "AndGate") n.execute() n.showInfo() #OrGate o = OrGate(False, True, "OrGate") o.execute() o.showInfo() #NandGate nand = NandGate(True, True, "NandGate") nand.execute() nand.showInfo()
from AndGate import AndGate from OrGate import OrGate from NotGate import NotGate from NorGate import NorGate from XorGate import XorGate from NandGate import NandGate from Connector import Connector g1 = AndGate("G1") g2 = AndGate("G2") g3 = OrGate("G3") g4 = NotGate("G4") g5 = NorGate("G5") g6 = XorGate("G6") g7 = NandGate("G7") g8 = OrGate("G8") c1 = Connector(g1, g3) c2 = Connector(g2, g3) c3 = Connector(g3, g4) c4 = Connector(g5, g7) c5 = Connector(g6, g7) c6 = Connector(g4, g8) c7 = Connector(g7, g8) print(g8.getOutput())