On 3/29/2014 20:16, Thomas Faber wrote:
- /* output truncation */
+#define truncate_expect(len, out_len, expect_status) do { \
bytes_out = 0x55555555; \memset(buffer, 0x55, sizeof(buffer)); \status = pRtlUnicodeToUTF8N( \buffer, len, &bytes_out, \special_string, sizeof(special_string)); \ok(status == (expect_status), "status = 0x%x\n", status); \ok(bytes_out == (out_len), "bytes_out = %u\n", bytes_out); \for (i = 0; i < bytes_out; i++) \ok(buf[i] == special_expected[i], \"buffer[%d] = 0x%x\n", i, buf[i]); \for (; i < sizeof(buffer); i++) \ok(buf[i] == 0x55, "buffer[%d] = 0x%x\n", i, buf[i]); \- } while (0)
It's better to avoid large macros like this one. A common way to do that is to move code to another function and call it with a single line macro, for line information ok_() should be used.