Example #1
0
 def test_combine_generation_no_new_generation(self):
     #test the combine generation with a generation that does not result in offspring
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     #expected pass test case
     self.assertEqual(qm.combine_generation([['_00_'], ['_0_1'], ['__11']]),
                      [])
Example #2
0
 def test_combine_generation_wrong(self):
     #test the combine generation with an empty generation
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     #expected pass test case
     self.assertNotEqual(
         qm.combine_generation([['_00_'], ['_0_1'], ['__11']]), [['____']])
Example #3
0
 def test_combine_generation_no_dash(self):
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     #expected pass test case
     self.assertEqual(
         qm.combine_generation([['0000'], ['0001', '1000'],
                                ['0011', '1001', '1100'], ['0111', '1011'],
                                ['1111']]),
         [['000_', '_000'], ['00_1', '_001', '100_', '1_00'],
          ['0_11', '_011', '10_1'], ['_111', '1_11']])
Example #4
0
 def test_combine_generation_dash(self):
     #test the combine generation with a generation that has dashes
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     #expected pass test case
     self.assertEqual(
         qm.combine_generation([['000_', '_000'],
                                ['00_1', '_001', '100_', '1_00'],
                                ['0_11', '_011', '10_1'], ['_111',
                                                           '1_11']]),
         [['_00_'], ['_0_1'], ['__11']])
Example #5
0
 def test_combine_generation_empty_generation(self):
     #test the combine generation with an empty generation
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     #expected pass test case
     self.assertEqual(qm.combine_generation([]), [])