[PATCH 1/2] ws2_32/tests: Put WSAStringToAddress tests in a table

Alex Henrie alexhenrie24 at gmail.com
Sun May 17 01:15:08 CDT 2020


On Fri, May 15, 2020 at 9:19 AM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> On 5/15/20 9:54 AM, Alex Henrie wrote:
> > +            ok( WSAGetLastError() == ipv6_tests[j].error,
> > +                "WSAStringToAddress(%s) gave error %d, expected %d\n",
> > +                wine_dbgstr_a( ipv6_tests[j].input ), WSAGetLastError(), ipv6_tests[j].error );
> > +            ok( WSAGetLastError() == ipv6_tests[j].error,
> > +                "WSAStringToAddress(%s) gave error %d, expected %d\n",
> > +                wine_dbgstr_a( ipv6_tests[j].input ), WSAGetLastError(), ipv6_tests[j].error );
>
> I think you accidentally duplicated this line.

Good catch, thanks!

> > +todo_wine_if(ipv6_tests[j].error)
> > +            ok( sockaddr6.sin6_family == expected_family,
> > +                "WSAStringToAddress(%s) gave family %d, expected %d\n",
> > +                wine_dbgstr_a( ipv4_tests[j].input ), sockaddr6.sin6_family );
> > +todo_wine_if(ipv6_tests[j].error)
> > +            ok( sockaddr6.sin6_addr.s6_words[0] == ipv6_tests[j].address[0] &&
> > +                sockaddr6.sin6_addr.s6_words[1] == ipv6_tests[j].address[1] &&
> > +                sockaddr6.sin6_addr.s6_words[2] == ipv6_tests[j].address[2] &&
> > +                sockaddr6.sin6_addr.s6_words[3] == ipv6_tests[j].address[3] &&
> > +                sockaddr6.sin6_addr.s6_words[4] == ipv6_tests[j].address[4] &&
> > +                sockaddr6.sin6_addr.s6_words[5] == ipv6_tests[j].address[5] &&
> > +                sockaddr6.sin6_addr.s6_words[6] == ipv6_tests[j].address[6] &&
> > +                sockaddr6.sin6_addr.s6_words[7] == ipv6_tests[j].address[7],
>
> Could this just be memcmp()? (Could the whole structure be compared that
> way?)

Yes, the address comparison could just use memcmp. I will send an
updated version with that change. I don't want to compare the entire
structure with memcmp though because it would result in repeating
{AF_INET6, 0, 0, {<address>}} a lot in the test table to represent the
address family, port, and flowinfo.

-Alex



More information about the wine-devel mailing list