Esempio n. 1
0
 def test_interleave4(self):
     self.assertEqual(
         hex(interleave.interleave4(0xF, 0x0, 0xF, 0x0)), '0x5555'
     )
     self.assertEqual(
         hex(interleave.interleave4(0xFF, 0x00, 0xFF, 0x00)), '0x55555555'
     )
     self.assertEqual(
         hex(
             interleave.interleave4(0xFFFF, 0x0000, 0xFFFF, 0x0000)
         ), '0x5555555555555555'
     )
     integers = (3, 9, 7, 8)
     self.assertEqual(
         hex(interleave.interleave4_to_32bit(*integers)), '0xa457'
     )
Esempio n. 2
0
    def test_idempotency_4(self):
        integers = (4, 42, 36, 78)
        interleaved = interleave.interleave4(*integers)
        self.assertEqual(integers, interleave.deinterleave4(interleaved))

        interleaved = interleave.interleave4_to_32bit(*integers)
        self.assertEqual(
            integers, interleave.deinterleave4_from_32bit(interleaved)
        )
Esempio n. 3
0
    def test_interleave4_any_length_input(self):
        integers = (0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF)
        total_integer_length = sum(
            [integer.bit_length() for integer in integers]
        )
        interleaved = self.assertEqual(
            interleave.interleave4_any_length_input(*integers).bit_length(),
            total_integer_length
        )

        integers = (3, 9, 7, 8)
        self.assertEqual(
            interleave.interleave4(*integers),
            interleave.interleave4_any_length_input(*integers)
        )
Esempio n. 4
0
 def test_idempotency4(self):
     for nums in self.num_sets:
         integers = list(nums[:4])
         interleaved = interleave.interleave4(*integers)
         self.assertEqual(integers, interleave.deinterleave4(interleaved))
Esempio n. 5
0
 def test_interleave4(self):
     for nums in self.num_sets:
         self.assertEqual(interleave.interleave4(*nums[:4]),
                          interleave.interleavem_naive(*nums[:4]))
Esempio n. 6
0
 def test_idempotency4(self):
     integers = (4, 42, 442, 4442)
     interleaved = interleave.interleave4(*integers)
     self.assertEqual(integers, interleave.deinterleave4(interleaved))
Esempio n. 7
0
 def test_idempotency4(self):
     integers = (4, 42, 442, 4442)
     interleaved = interleave.interleave4(*integers)
     self.assertEqual(integers, interleave.deinterleave4(interleaved))
Esempio n. 8
0
 def test_interleave4(self):
     self.assertEqual(hex(interleave.interleave4(0x00, 0xFF, 0x00, 0xFF)), hex(2863311530))
Esempio n. 9
0
def interleave4():
    for nums in num_sets:
        interleave.interleave4(*nums),