def testcase_01(self): a = NAndGate(2) a.set_input(0, False) a.set_input(1, False) a.execute() self.assertEqual(True, a.get_output(0), "Class NAndGate Testcase 1 failed.")
def testcase_04(self): a = NAndGate(2) a.set_input(0, True) a.set_input(1, True) a.execute() self.assertEqual(False, a.get_output(0), "Class NAndGate Testcase 4 failed.")
def assert_test_case(self, in0, in1, out, test_id): a = NAndGate() a.set_inputs([in0, in1]) a.execute() if out: self.assertTrue(a.get_output_at(0), "Class NAndGate: " + test_id + " failed") else: self.assertFalse(a.get_output_at(0), "Class NAndGate: " + test_id + " failed")
def testcase_05(self): a = NAndGate(3) testdatas = [[False, False, False, True], [False, False, True, True], [False, True, False, True], [False, True, True, True], [True, False, False, True], [True, False, True, True], [True, True, False, True], [True, True, True, False]] 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 NAndGate Testcase 5 failed: " + testdata.__str__())
def testcase_04(self): a = NAndGate() a.Input0 = True a.Input1 = True a.execute() self.assertEqual(False, a.Output, "Class NAndGate Testcase 4 failed.")
def testcase_01(self): a = NAndGate() a.Input0 = False a.Input1 = False a.execute() self.assertEqual(True, a.Output, "Class NAndGate Testcase 1 failed.")
def testcase_01(self): a = NAndGate() a.setInput0(False) a.setInput1(False) a.execute() self.assertTrue(a._Output, "Class NAndGate: TestCase01 failed")
def testcase_04(self): a = NAndGate() a.setInput0(True) a.setInput1(True) a.execute() self.assertFalse(a._Output, "Class NAndGate: TestCase04 failed")