[RFC PATCH 1/9] ntdll/tests: Add tests for iswctype.

Jeff Smith whydoubt at gmail.com
Thu Jan 9 10:36:37 CST 2020


On Thu, Jan 9, 2020 at 8:56 AM Jacek Caban <jacek at codeweavers.com> wrote:
>
> Hi Jeff,
>
> On 09.01.2020 07:53, Jeff Smith wrote:
> > @@ -1501,6 +1515,63 @@ static void test_sscanf(void)
> >       ok(d == 0.0, "d = %lf\n", f);
> >   }
> >
> > +static void test_iswctype(void)
> > +{
> > +    unsigned int c, i;
> > +    unsigned short types = 0;
> > +    unsigned short base_wctype[65536];
> > +    static const struct
> > +    {
> > +        unsigned int c;
> > +        unsigned int wctype;
> > +    }
> > +    iswctype_tests[] =
> > +    {
> > +        { '\t', C1_CNTRL | C1_SPACE | C1_BLANK },
> > +        { 0xa0, C1_SPACE | C1_BLANK },
> > +        { 0x85, C1_CNTRL },
> > +        { 0xad, C1_PUNCT },
> > +        { 0xaa, C1_PUNCT },
> > +        { 0xb5, C1_PUNCT },
> > +        { 0xba, C1_PUNCT },
> > +        { 0xb2, C1_PUNCT | C1_DIGIT },
> > +        { 0xb3, C1_PUNCT | C1_DIGIT },
> > +        { 0xb9, C1_PUNCT | C1_DIGIT },
> > +    };
> > +
> > +    for (c = 0; c <= 0xff; c++)
> > +    {
> > +        base_wctype[c] = p_iswctype(c, 0xffff);
> > +        types |= base_wctype[c];
> > +    }
> > +    todo_wine ok(types == 0x1ff, "Unexpected wctype bits present\n");

Hi Jacek,

> How about copying NTDLL_wctype to tests so that you can test exact
> return values for 0..255 ranges? You wouldn't need base_wctype array.
> You could just iterate all values and compare iswctype result to the
> value from wctype array. Also, it would be nice to test return values of
> isw* functions for those characters.

I like that idea for checking the whole table.  Adding the isw tests shouldn't
be too hard to do as well.

Thanks,
Jeff



More information about the wine-devel mailing list