Home | History | Annotate | Download | only in locale.ctype.members
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <locale>
     11 
     12 // template <class charT> class ctype;
     13 
     14 // bool is(mask m, charT c) const;
     15 
     16 #include <locale>
     17 #include <cassert>
     18 
     19 int main()
     20 {
     21     std::locale l = std::locale::classic();
     22     {
     23         typedef std::ctype<wchar_t> F;
     24         const F& f = std::use_facet<F>(l);
     25 
     26         assert(f.is(F::space, L' '));
     27         assert(!f.is(F::space, L'A'));
     28 
     29         assert(f.is(F::print, L' '));
     30         assert(!f.is(F::print, L'\x07'));
     31 
     32         assert(f.is(F::cntrl, L'\x07'));
     33         assert(!f.is(F::cntrl, L' '));
     34 
     35         assert(f.is(F::upper, L'A'));
     36         assert(!f.is(F::upper, L'a'));
     37 
     38         assert(f.is(F::lower, L'a'));
     39         assert(!f.is(F::lower, L'A'));
     40 
     41         assert(f.is(F::alpha, L'a'));
     42         assert(!f.is(F::alpha, L'1'));
     43 
     44         assert(f.is(F::digit, L'1'));
     45         assert(!f.is(F::digit, L'a'));
     46 
     47         assert(f.is(F::punct, L'.'));
     48         assert(!f.is(F::punct, L'a'));
     49 
     50         assert(f.is(F::xdigit, L'a'));
     51         assert(!f.is(F::xdigit, L'g'));
     52 
     53         assert(f.is(F::alnum, L'a'));
     54         assert(!f.is(F::alnum, L'.'));
     55 
     56         assert(f.is(F::graph, L'.'));
     57         assert(!f.is(F::graph,  L'\x07'));
     58     }
     59 }
     60