libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

cwctype.pass.cpp (2473B)


      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 // <cwctype>
     11 
     12 #include <cwctype>
     13 #include <type_traits>
     14 
     15 #include "test_macros.h"
     16 
     17 
     18 #ifndef WEOF
     19 #error WEOF not defined
     20 #endif
     21 
     22 #ifdef iswalnum
     23 #error iswalnum defined
     24 #endif
     25 
     26 #ifdef iswalpha
     27 #error iswalpha defined
     28 #endif
     29 
     30 #ifdef iswblank
     31 #error iswblank defined
     32 #endif
     33 
     34 #ifdef iswcntrl
     35 #error iswcntrl defined
     36 #endif
     37 
     38 #ifdef iswdigit
     39 #error iswdigit defined
     40 #endif
     41 
     42 #ifdef iswgraph
     43 #error iswgraph defined
     44 #endif
     45 
     46 #ifdef iswlower
     47 #error iswlower defined
     48 #endif
     49 
     50 #ifdef iswprint
     51 #error iswprint defined
     52 #endif
     53 
     54 #ifdef iswpunct
     55 #error iswpunct defined
     56 #endif
     57 
     58 #ifdef iswspace
     59 #error iswspace defined
     60 #endif
     61 
     62 #ifdef iswupper
     63 #error iswupper defined
     64 #endif
     65 
     66 #ifdef iswxdigit
     67 #error iswxdigit defined
     68 #endif
     69 
     70 #ifdef iswctype
     71 #error iswctype defined
     72 #endif
     73 
     74 #ifdef wctype
     75 #error wctype defined
     76 #endif
     77 
     78 #ifdef towlower
     79 #error towlower defined
     80 #endif
     81 
     82 #ifdef towupper
     83 #error towupper defined
     84 #endif
     85 
     86 #ifdef towctrans
     87 #error towctrans defined
     88 #endif
     89 
     90 #ifdef wctrans
     91 #error wctrans defined
     92 #endif
     93 
     94 int main()
     95 {
     96     std::wint_t w = 0;
     97     ASSERT_SAME_TYPE(int, decltype(std::iswalnum(w)));
     98     ASSERT_SAME_TYPE(int, decltype(std::iswalpha(w)));
     99     ASSERT_SAME_TYPE(int, decltype(std::iswblank(w)));
    100     ASSERT_SAME_TYPE(int, decltype(std::iswcntrl(w)));
    101     ASSERT_SAME_TYPE(int, decltype(std::iswdigit(w)));
    102     ASSERT_SAME_TYPE(int, decltype(std::iswgraph(w)));
    103     ASSERT_SAME_TYPE(int, decltype(std::iswlower(w)));
    104     ASSERT_SAME_TYPE(int, decltype(std::iswprint(w)));
    105     ASSERT_SAME_TYPE(int, decltype(std::iswpunct(w)));
    106     ASSERT_SAME_TYPE(int, decltype(std::iswspace(w)));
    107     ASSERT_SAME_TYPE(int, decltype(std::iswupper(w)));
    108     ASSERT_SAME_TYPE(int, decltype(std::iswxdigit(w)));
    109 
    110     ASSERT_SAME_TYPE(int, decltype(std::iswctype(w, std::wctype_t())));
    111     
    112     ASSERT_SAME_TYPE(std::wctype_t,  decltype(std::wctype("")));
    113     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towlower(w)));
    114     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towupper(w)));
    115     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towctrans(w, std::wctrans_t())));
    116     ASSERT_SAME_TYPE(std::wctrans_t, decltype(std::wctrans("")));
    117 }