diff --git a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp --- a/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.statics/classic_table.pass.cpp @@ -12,8 +12,6 @@ // static const mask* classic_table() throw(); -// XFAIL: LIBCXX-WINDOWS-FIXME - #include #include @@ -27,6 +25,102 @@ typedef F::mask mask; const mask *p = F::classic_table(); + + // Do basic verification of properties; check that specific bits are + // set or not set, for some characters, but allow having other bits + // set too. +#define ASSERT_IS_SET(c, bit) assert((p[static_cast(c)] & (bit)) != 0) +#define ASSERT_NOT_SET(c, bit) assert((p[static_cast(c)] & (bit)) == 0) + + ASSERT_IS_SET('A', F::alpha); + ASSERT_IS_SET('A', F::print); + ASSERT_IS_SET('A', F::upper); + ASSERT_NOT_SET('A', F::lower); + ASSERT_NOT_SET('A', F::digit); + ASSERT_IS_SET('A', F::xdigit); + ASSERT_NOT_SET('A', F::space); + ASSERT_NOT_SET('A', F::punct); + ASSERT_NOT_SET('A', F::cntrl); + ASSERT_NOT_SET('A', F::blank); + + ASSERT_IS_SET('a', F::alpha); + ASSERT_IS_SET('a', F::print); + ASSERT_NOT_SET('a', F::upper); + ASSERT_IS_SET('a', F::lower); + ASSERT_NOT_SET('a', F::digit); + ASSERT_IS_SET('a', F::xdigit); + ASSERT_NOT_SET('a', F::space); + ASSERT_NOT_SET('a', F::punct); + ASSERT_NOT_SET('a', F::cntrl); + ASSERT_NOT_SET('a', F::blank); + + ASSERT_IS_SET('g', F::alpha); + ASSERT_IS_SET('g', F::print); + ASSERT_NOT_SET('g', F::upper); + ASSERT_IS_SET('g', F::lower); + ASSERT_NOT_SET('g', F::digit); + ASSERT_NOT_SET('g', F::xdigit); + ASSERT_NOT_SET('g', F::space); + ASSERT_NOT_SET('g', F::punct); + ASSERT_NOT_SET('g', F::cntrl); + ASSERT_NOT_SET('g', F::blank); + + ASSERT_NOT_SET('1', F::alpha); + ASSERT_IS_SET('1', F::print); + ASSERT_NOT_SET('1', F::upper); + ASSERT_NOT_SET('1', F::lower); + ASSERT_IS_SET('1', F::digit); + ASSERT_IS_SET('1', F::xdigit); + ASSERT_NOT_SET('1', F::space); + ASSERT_NOT_SET('1', F::punct); + ASSERT_NOT_SET('1', F::cntrl); + ASSERT_NOT_SET('1', F::blank); + + ASSERT_NOT_SET(' ', F::alpha); + ASSERT_IS_SET(' ', F::print); + ASSERT_NOT_SET(' ', F::upper); + ASSERT_NOT_SET(' ', F::lower); + ASSERT_NOT_SET(' ', F::digit); + ASSERT_NOT_SET(' ', F::xdigit); + ASSERT_IS_SET(' ', F::space); + ASSERT_NOT_SET(' ', F::punct); + ASSERT_NOT_SET(' ', F::cntrl); + ASSERT_IS_SET(' ', F::blank); + + ASSERT_NOT_SET('.', F::alpha); + ASSERT_IS_SET('.', F::print); + ASSERT_NOT_SET('.', F::upper); + ASSERT_NOT_SET('.', F::lower); + ASSERT_NOT_SET('.', F::digit); + ASSERT_NOT_SET('.', F::xdigit); + ASSERT_NOT_SET('.', F::space); + ASSERT_IS_SET('.', F::punct); + ASSERT_NOT_SET('.', F::cntrl); + ASSERT_NOT_SET('.', F::blank); + + ASSERT_NOT_SET('\n', F::alpha); + ASSERT_NOT_SET('\n', F::print); + ASSERT_NOT_SET('\n', F::upper); + ASSERT_NOT_SET('\n', F::lower); + ASSERT_NOT_SET('\n', F::digit); + ASSERT_NOT_SET('\n', F::xdigit); + ASSERT_IS_SET('\n', F::space); + ASSERT_NOT_SET('\n', F::punct); + ASSERT_IS_SET('\n', F::cntrl); + // Intentionally not checking F::blank for '\n'; MS STL has got + // F::blank as a mask consisting of 2 bits, and one of them is set + // for '\n'. libc++'s F::blank is a single bit which isn't set for '\n'. + +#ifndef _WIN32 + // On Windows, the alpha and print masks aren't individual bits that + // are set, but are only usable as masks, as they are combinations of + // the bits for upper/lower/digit/blank/punct, and the horizontal tab + // character doesn't have the blank bit set. MS STL also defines its + // bit masks slightly differently than libc++. + + // Exhaustively check the whole table, requiring all bits be set as we + // expect them to, with no other bits set. + const mask defined = F::space | F::print | F::cntrl | F::upper | F::lower | F::alpha | F::digit | F::punct | F::xdigit | F::blank; @@ -58,6 +152,7 @@ assert(( p[i] & set) == set); // all the right bits set assert(((p[i] & ~set) & defined) == 0); // no extra ones } +#endif return 0;