-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2015-02-15 um 15:50 schrieb Mark Jansen:
You can make this const (or even static const, not much difference though).
Will do, I was just following the style of the RtlIpv4StringToAddressA test function.
I recommend to change it to const there as well in a separate patch.
I recommend to add a few more tests: "1.1.1.1" - without a port "256.1.1.1:1" - out of range ip "-1.1.1.1:1" - negative ip "1.1.0.1" - There's a zero in it, should still be valid though. Hex and octal IPs
There is already tests for that in the RtlIpv4StringToAddressA test, this testcase is for the port handling.
My preference would be to run the full set of tests against both functions (as far as the functionality is there of course), since it's always possible that there is subtly different behavior.
Is there a reason why you didn't just put a IN_ADDR in the test structure? You'll probably need an extra curly brackets around each member of struct S_un_b and one for the union: {{1}, {1}, {1}, {1}}
I did not do this because i followed the style of the RtlIpv4StringToAddressA function, and if i would have to guess the extra brackets are precisely the reason.
The curly brackets are not really an issue. I suspect that the author of the previous test saw the compiler warning and did not know how to fix it, so he wrote a workaround.
(That said, I have not tried to change this myself. There may be unforseen problems.)
If a direct initialization works the way I think it works sending a patch that changes the existing code would be appreciated.