Re: [PATCH 1/6] reg.exe/tests: Parameterise error messages
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-10-20 22:24, schrieb Jonathan Vollebregt:
- ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); - ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); + ok(type == REG_DWORD, "got wrong type %u, expected %u\n", type, REG_DWORD); + ok(size == sizeof(DWORD), "got wrong size %u, expected %u\n", size, (DWORD)sizeof(DWORD)); I don't know if this is the canonical way to handle this. My gut feeling is that a cast to unsigned int would be nicer than a cast of DWORD, but I hope others can give a better answer.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJURiJmAAoJEN0/YqbEcdMw3HEP/1MBp8qA+CyiaauJYQiiQ7+s Ixo1oO/cBewMzYwbqf+4luIxtWPl2v3ocRecHVrns7SRoOrLnsdfp/Tjf5pzx3GL 0mjDrXjKJCPEsY6tTTx3uHKnGhMt7coYymef4LPpZHVwYdy8DuwhCaCiZWwxY54M /apfZ3sFieiMqO4aXPAMR02mKcyPDIarLn0t2A1pJWV10iSJ1BunyM+tBNV0523B V98UknVYqlBUoqwqywbMKMCCnCCvN/Z7gtUiydodQdHlkPTgWFSwNvLTrEgSclXo 1L04NH9JzvTYlIN2oHSELNpdiZycEaBS7xTaYk0DjdnvXYG3jS/zsgYBURjnuWJr oFz86pFOnEeirvkixEfAtPy5RwKfJKvgXVKH3eP75g9pLpGJ7L5+2hS/VMYbV40O ENK4D/U41L4ldJVDo/3GQUyiU8Me0OukgIFbHS+axygKgp5YWcH7HDhAgwG3xTu9 LLeAgLnWxeQ0RHVSohPLrVVNSOlwFyLQQsc6Jh+ZbcnxetF0mFJtvVPfRfkWjzkV nC6AamdvpnZlxfrqP66VB3ZKaSScMiqvlUvP/JRRd9bto6Hp5wbnD/1g9sAV8Iyl 6cSOH44kDB5qdFg8IWr+Dsh8PpQVUai1HzBioKrDA3av6XVgV/rwCSaoRhwkdjTS MmjNbHDCXnNMlx7S7dQe =3Os0 -----END PGP SIGNATURE-----
On 21 October 2014 11:07, Stefan Dösinger <stefandoesinger(a)gmail.com> wrote:
Am 2014-10-20 22:24, schrieb Jonathan Vollebregt:
- ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); - ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); + ok(type == REG_DWORD, "got wrong type %u, expected %u\n", type, REG_DWORD); + ok(size == sizeof(DWORD), "got wrong size %u, expected %u\n", size, (DWORD)sizeof(DWORD)); I don't know if this is the canonical way to handle this. My gut feeling is that a cast to unsigned int would be nicer than a cast of DWORD, but I hope others can give a better answer.
I'd just go with + ok(size == sizeof(DWORD), "Got unexpected size %u.\n", size); The only tests that really need to print the expected value are ones where it's not constant, and those should be fairly rare.
participants (2)
-
Henri Verbeet -
Stefan Dösinger