MCPcopy Create free account
hub / github.com/qilingframework/qiling / test_wchar_array

Method test_wchar_array

tests/test_struct.py:186–199  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

184
185 @unittest.skip('broken wchar implementation')
186 def test_wchar_array(self):
187 wchar_enc = self.WCHAR_ENC
188 wchar_size = len('\x00'.encode(wchar_enc))
189
190 field_elems = 16
191 field_type = ctypes.c_wchar * field_elems # TODO: replace ctypes.c_wchar with an alternate implementation
192 field_data = 'unicode sucks'
193 self.assertEqual(field_elems * wchar_size, ctypes.sizeof(field_type))
194
195 obj = field_type(*field_data)
196 self.assertEqual(field_data, obj.value)
197
198 obj_bytes = bytes(obj)
199 self.assertEqual(field_data.ljust(field_elems, '\x00').encode(wchar_enc), obj_bytes)
200
201
202class StructTestLinux(Wrapper.StructTest, Wrapper.WCharTest):

Callers

nothing calls this directly

Calls 1

sizeofMethod · 0.80

Tested by

no test coverage detected