Home | History | Annotate | Download | only in ios_fmtflags
      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 // <ios>
     11 
     12 // class ios_base
     13 
     14 // static const fmtflags boolalpha;
     15 // static const fmtflags dec;
     16 // static const fmtflags fixed;
     17 // static const fmtflags hex;
     18 // static const fmtflags internal;
     19 // static const fmtflags left;
     20 // static const fmtflags oct;
     21 // static const fmtflags right;
     22 // static const fmtflags scientific;
     23 // static const fmtflags showbase;
     24 // static const fmtflags showpoint;
     25 // static const fmtflags showpos;
     26 // static const fmtflags skipws;
     27 // static const fmtflags unitbuf;
     28 // static const fmtflags uppercase;
     29 // static const fmtflags adjustfield = left | right | internal;
     30 // static const fmtflags basefield   = dec | oct | hex;
     31 // static const fmtflags floatfield  = scientific | fixed;
     32 
     33 #include <ios>
     34 #include <cassert>
     35 
     36 int main()
     37 {
     38     assert(std::ios_base::boolalpha);
     39     assert(std::ios_base::dec);
     40     assert(std::ios_base::fixed);
     41     assert(std::ios_base::hex);
     42     assert(std::ios_base::internal);
     43     assert(std::ios_base::left);
     44     assert(std::ios_base::oct);
     45     assert(std::ios_base::right);
     46     assert(std::ios_base::scientific);
     47     assert(std::ios_base::showbase);
     48     assert(std::ios_base::showpoint);
     49     assert(std::ios_base::showpos);
     50     assert(std::ios_base::skipws);
     51     assert(std::ios_base::unitbuf);
     52     assert(std::ios_base::uppercase);
     53 
     54     assert
     55     (
     56         ( std::ios_base::boolalpha
     57         & std::ios_base::dec
     58         & std::ios_base::fixed
     59         & std::ios_base::hex
     60         & std::ios_base::internal
     61         & std::ios_base::left
     62         & std::ios_base::oct
     63         & std::ios_base::right
     64         & std::ios_base::scientific
     65         & std::ios_base::showbase
     66         & std::ios_base::showpoint
     67         & std::ios_base::showpos
     68         & std::ios_base::skipws
     69         & std::ios_base::unitbuf
     70         & std::ios_base::uppercase) == 0
     71     );
     72 
     73     assert(std::ios_base::adjustfield == (std::ios_base::left
     74                                         | std::ios_base::right
     75                                         | std::ios_base::internal));
     76     assert(std::ios_base::basefield == (std::ios_base::dec
     77                                       | std::ios_base::oct
     78                                       | std::ios_base::hex));
     79     assert(std::ios_base::floatfield == (std::ios_base::scientific
     80                                        | std::ios_base::fixed));
     81 }
     82