Esempio n. 1
0
    def test_from_stream(self):
        ae = self.assertEqual

        stream = ByteIStream(bytes([x for x in range(17)]))
        uuid1 = CLSIDToUUID.from_stream(stream, byte_order=LITTLE_ENDIAN)
        uuid2 = CLSIDToUUID.from_stream(stream, 1, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        uuid3 = CLSIDToUUID.from_stream(stream, byte_order=BIG_ENDIAN)
        uuid4 = CLSIDToUUID.from_stream(stream, 1, byte_order=BIG_ENDIAN)

        ae(uuid1, UUID(bytes_le=bytes([x for x in range(16)])))
        ae(uuid2, UUID(bytes_le=bytes([x for x in range(1, 17)])))
        ae(uuid3, UUID(bytes=bytes([x for x in range(16)])))
        ae(uuid4, UUID(bytes=bytes([x for x in range(1, 17)])))
Esempio n. 2
0
    def test_from_stream(self):
        ae = self.assertEqual

        stream = ByteIStream(bytes([x for x in range(17)]))
        uuid1 = CLSIDToUUID.from_stream(stream, byte_order=LITTLE_ENDIAN)
        uuid2 = CLSIDToUUID.from_stream(stream, 1, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        uuid3 = CLSIDToUUID.from_stream(stream, byte_order=BIG_ENDIAN)
        uuid4 = CLSIDToUUID.from_stream(stream, 1, byte_order=BIG_ENDIAN)

        ae(uuid1, UUID(bytes_le=bytes([x for x in range(16)])))
        ae(uuid2, UUID(bytes_le=bytes([x for x in range(1, 17)])))
        ae(uuid3, UUID(bytes=bytes([x for x in range(16)])))
        ae(uuid4, UUID(bytes=bytes([x for x in range(1, 17)])))
Esempio n. 3
0
    def test_from_stream(self):
        ae = self.assertEqual

        data = b"\x00\x01\x02\x03"

        stream = ByteIStream(data)
        coord1 = COORD.from_stream(stream, byte_order=LITTLE_ENDIAN)
        coord2 = COORD.from_stream(stream, 0, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        coord3 = COORD.from_stream(stream, byte_order=BIG_ENDIAN)
        coord4 = COORD.from_stream(stream, 0, byte_order=BIG_ENDIAN)

        ae(coord1.x, 0x0100)
        ae(coord1.y, 0x0302)
        ae(coord2.x, 0x0100)
        ae(coord2.y, 0x0302)
        ae(coord3.x, 0x0001)
        ae(coord3.y, 0x0203)
        ae(coord4.x, 0x0001)
        ae(coord4.y, 0x0203)
Esempio n. 4
0
    def test_from_stream(self):
        ae = self.assertEqual

        data = b"\x00\x01\x02\x03"

        stream = ByteIStream(data)
        coord1 = COORD.from_stream(stream, byte_order=LITTLE_ENDIAN)
        coord2 = COORD.from_stream(stream, 0, byte_order=LITTLE_ENDIAN)

        stream.seek(0, SEEK_SET)
        coord3 = COORD.from_stream(stream, byte_order=BIG_ENDIAN)
        coord4 = COORD.from_stream(stream, 0, byte_order=BIG_ENDIAN)

        ae(coord1.x, 0x0100)
        ae(coord1.y, 0x0302)
        ae(coord2.x, 0x0100)
        ae(coord2.y, 0x0302)
        ae(coord3.x, 0x0001)
        ae(coord3.y, 0x0203)
        ae(coord4.x, 0x0001)
        ae(coord4.y, 0x0203)