Exemple #1
0
    def test_set(self):
        ''' Test that the set bit operation is correct '''
        barray = BitArray(array=[0xEC])
        for pos in [0, 1, 4]: barray.set(pos)
        self.assertEqual([0xFF], barray.to_byte_list())

        barray = BitArray(array=[0x00])
        for pos in [0, 1, 4]: barray.set(pos)
        self.assertEqual([0x13], barray.to_byte_list())