def testcase_04(self): a = AndGate(2) a.set_input(0, True) a.set_input(1, True) a.execute() self.assertEqual(True, a.get_output(0), "Class AndGate Testcase 4 failed.")
def testcase_01(self): a = AndGate(2) a.set_input(0, False) a.set_input(1, False) a.execute() self.assertEqual(False, a.get_output(0), "Class AndGate Testcase 1 failed.")
def testcase_05(self): a = AndGate(3) testdatas = [[False, False, False, False], [False, False, True, False], [False, True, False, False], [False, True, True, False], [True, False, False, False], [True, False, True, False], [True, True, False, False], [True, True, True, True]] for testdata in testdatas: for i in range(0, 3): a.set_input(i, testdata[i]) a.execute() self.assertEqual( testdata[3], a.get_output(0), "Class AndGate Testcase 5 failed: " + testdata.__str__())