Esempio n. 1
0
 def testcase_00(self):
     a = NOrGate(2)
     self.assertEqual(False, a.get_input(0),
                      "Class NOrGate Testcase 0 failed.")
     self.assertEqual(False, a.get_input(1),
                      "Class NOrGate Testcase 0 failed.")
     self.assertEqual(True, a.get_output(0),
                      "Class NOrGate Testcase 0 failed.")
Esempio n. 2
0
 def testcase_03(self):
     a = NOrGate(2)
     a.set_input(0, True)
     a.set_input(1, False)
     a.execute()
     self.assertEqual(False, a.get_output(0),
                      "Class NOrGate Testcase 3 failed.")
Esempio n. 3
0
 def testcase_05(self):
     a = NOrGate(3)
     testdatas = [[False, False, False, True], [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, 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 NOrGate Testcase 5 failed: " + testdata.__str__())