コード例 #1
0
 def test_length_convert_to_binary(self):
     #check if the number of bits in each binary string is the same for
     #all
     minterms = [1, 2, 3, 4, 5, 6, 15]
     qm = QM(minterms)
     conversion = qm.to_binary(minterms)
     for term in conversion:
         self.assertEqual(len(term), 4)
コード例 #2
0
    def test_convert_binary(self):

        #test if the strings are the actual binary representations
        #for each of the strings
        minterms = [1, 2, 3, 4, 5, 6, 15]
        qm = QM(minterms)
        conversion = qm.to_binary(minterms)
        expected_conversion = [
            '0001', '0010', '0011', '0100', '0101', '0110', '1111'
        ]
        self.assertEqual(conversion, expected_conversion)
コード例 #3
0
ファイル: test_qm.py プロジェクト: tml104/bot_irori
 def test_to_binary(self):
     
     #test if the strings are the actual binary representations
     #for each of the strings
     minterms = [1,2,3,4,5,6,15]
     qm =  QM(minterms)
     expected_conversion = ['0001','0010','0011','0100','0101','0110','1111']
     conversion = qm.to_binary(minterms)
     self.assertEqual(conversion,expected_conversion)
     
     #check if the number of bits in each binary string is the same for 
     #all
     for term in conversion:
         self.assertEqual(len(term),4)