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)
def test_from_int(self): ae = self.assertEqual hresult = HRESULT.from_int(0xAE5742BD) ae(hresult.s, 1) ae(hresult.r, 0) ae(hresult.c, 1) ae(hresult.n, 0) ae(hresult.x, 1) ae(hresult.facility, 0x0657) ae(hresult.code, 0x42BD)
def test_from_ctype(self): ae = self.assertEqual data_le = b"\xBD\x42\x57\xAE" hresult = hresult_le.from_buffer_copy(data_le) hresult = HRESULT.from_ctype(hresult) ae(hresult.s, 1) ae(hresult.r, 0) ae(hresult.c, 1) ae(hresult.n, 0) ae(hresult.x, 1) ae(hresult.facility, 0x0657) ae(hresult.code, 0x42BD)