ctype_base.pass.cpp revision bc8d3f97eb5c958007f2713238472e0c1c8fe02c
1//===----------------------------------------------------------------------===// 2// 3// ��������������������The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <locale> 11 12// class ctype_base 13// { 14// public: 15// typedef T mask; 16// 17// // numeric values are for exposition only. 18// static const mask space = 1 << 0; 19// static const mask print = 1 << 1; 20// static const mask cntrl = 1 << 2; 21// static const mask upper = 1 << 3; 22// static const mask lower = 1 << 4; 23// static const mask alpha = 1 << 5; 24// static const mask digit = 1 << 6; 25// static const mask punct = 1 << 7; 26// static const mask xdigit = 1 << 8; 27// static const mask alnum = alpha | digit; 28// static const mask graph = alnum | punct; 29// }; 30 31#include <locale> 32#include <cassert> 33 34int main() 35{ 36 assert(std::ctype_base::space); 37 assert(std::ctype_base::print); 38 assert(std::ctype_base::cntrl); 39 assert(std::ctype_base::upper); 40 assert(std::ctype_base::lower); 41 assert(std::ctype_base::alpha); 42 assert(std::ctype_base::digit); 43 assert(std::ctype_base::punct); 44 assert(std::ctype_base::xdigit); 45 assert( 46 ( std::ctype_base::space 47 & std::ctype_base::print 48 & std::ctype_base::cntrl 49 & std::ctype_base::upper 50 & std::ctype_base::lower 51 & std::ctype_base::alpha 52 & std::ctype_base::digit 53 & std::ctype_base::punct 54 & std::ctype_base::xdigit) == 0); 55 assert(std::ctype_base::alnum == (std::ctype_base::alpha | std::ctype_base::digit)); 56 assert(std::ctype_base::graph == (std::ctype_base::alnum | std::ctype_base::punct)); 57}