Beispiel #1
0
    def test_from_stream(self):
        ae = self.assertEqual

        data_le = b"\xBD\x42\x57\xAE"
        data_be = b"\xAE\x57\x42\xBD"

        stream = ByteIStream(data_le)
        hresult1 = HRESULT.from_stream(stream, byte_order=LITTLE_ENDIAN)
        hresult2 = HRESULT.from_stream(stream, 0, byte_order=LITTLE_ENDIAN)

        stream = ByteIStream(data_be)
        hresult3 = HRESULT.from_stream(stream, byte_order=BIG_ENDIAN)
        hresult4 = HRESULT.from_stream(stream, 0, byte_order=BIG_ENDIAN)

        ae(hresult1.s, 1)
        ae(hresult1.r, 0)
        ae(hresult1.c, 1)
        ae(hresult1.n, 0)
        ae(hresult1.x, 1)
        ae(hresult1.facility, 0x0657)
        ae(hresult1.code, 0x42BD)

        ae(hresult2.s, 1)
        ae(hresult2.r, 0)
        ae(hresult2.c, 1)
        ae(hresult2.n, 0)
        ae(hresult2.x, 1)
        ae(hresult2.facility, 0x0657)
        ae(hresult2.code, 0x42BD)

        ae(hresult3.s, 1)
        ae(hresult3.r, 0)
        ae(hresult3.c, 1)
        ae(hresult3.n, 0)
        ae(hresult3.x, 1)
        ae(hresult3.facility, 0x0657)
        ae(hresult3.code, 0x42BD)

        ae(hresult4.s, 1)
        ae(hresult4.r, 0)
        ae(hresult4.c, 1)
        ae(hresult4.n, 0)
        ae(hresult4.x, 1)
        ae(hresult4.facility, 0x0657)
        ae(hresult4.code, 0x42BD)
Beispiel #2
0
    def test_from_stream(self):
        ae = self.assertEqual

        data_le = b"\xBD\x42\x57\xAE"
        data_be = b"\xAE\x57\x42\xBD"

        stream = ByteIStream(data_le)
        hresult1 = HRESULT.from_stream(stream, byte_order=LITTLE_ENDIAN)
        hresult2 = HRESULT.from_stream(stream, 0, byte_order=LITTLE_ENDIAN)

        stream = ByteIStream(data_be)
        hresult3 = HRESULT.from_stream(stream, byte_order=BIG_ENDIAN)
        hresult4 = HRESULT.from_stream(stream, 0, byte_order=BIG_ENDIAN)

        ae(hresult1.s, 1)
        ae(hresult1.r, 0)
        ae(hresult1.c, 1)
        ae(hresult1.n, 0)
        ae(hresult1.x, 1)
        ae(hresult1.facility, 0x0657)
        ae(hresult1.code, 0x42BD)

        ae(hresult2.s, 1)
        ae(hresult2.r, 0)
        ae(hresult2.c, 1)
        ae(hresult2.n, 0)
        ae(hresult2.x, 1)
        ae(hresult2.facility, 0x0657)
        ae(hresult2.code, 0x42BD)

        ae(hresult3.s, 1)
        ae(hresult3.r, 0)
        ae(hresult3.c, 1)
        ae(hresult3.n, 0)
        ae(hresult3.x, 1)
        ae(hresult3.facility, 0x0657)
        ae(hresult3.code, 0x42BD)

        ae(hresult4.s, 1)
        ae(hresult4.r, 0)
        ae(hresult4.c, 1)
        ae(hresult4.n, 0)
        ae(hresult4.x, 1)
        ae(hresult4.facility, 0x0657)
        ae(hresult4.code, 0x42BD)