Home | History | Annotate | Download | only in locale.money.get.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 // XFAIL: apple-darwin
     11 
     12 // Failure related to GLIBC's use of U00A0 as mon_thousands_sep
     13 // and U002E as mon_decimal_point.
     14 // TODO: U00A0 should be investigated.
     15 // Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
     16 // XFAIL: linux
     17 
     18 // REQUIRES: locale.ru_RU.UTF-8
     19 
     20 // <locale>
     21 
     22 // class money_get<charT, InputIterator>
     23 
     24 // iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
     25 //               ios_base::iostate& err, long double& v) const;
     26 
     27 #include <locale>
     28 #include <ios>
     29 #include <streambuf>
     30 #include <cassert>
     31 #include "test_iterators.h"
     32 
     33 #include "platform_support.h" // locale name macros
     34 
     35 typedef std::money_get<char, input_iterator<const char*> > Fn;
     36 
     37 class my_facet
     38     : public Fn
     39 {
     40 public:
     41     explicit my_facet(std::size_t refs = 0)
     42         : Fn(refs) {}
     43 };
     44 
     45 typedef std::money_get<wchar_t, input_iterator<const wchar_t*> > Fw;
     46 
     47 class my_facetw
     48     : public Fw
     49 {
     50 public:
     51     explicit my_facetw(std::size_t refs = 0)
     52         : Fw(refs) {}
     53 };
     54 
     55 int main()
     56 {
     57     std::ios ios(0);
     58     std::string loc_name(LOCALE_ru_RU_UTF_8);
     59     ios.imbue(std::locale(ios.getloc(),
     60                           new std::moneypunct_byname<char, false>(loc_name)));
     61     ios.imbue(std::locale(ios.getloc(),
     62                           new std::moneypunct_byname<char, true>(loc_name)));
     63     ios.imbue(std::locale(ios.getloc(),
     64                           new std::moneypunct_byname<wchar_t, false>(loc_name)));
     65     ios.imbue(std::locale(ios.getloc(),
     66                           new std::moneypunct_byname<wchar_t, true>(loc_name)));
     67     {
     68         const my_facet f(1);
     69         // char, national
     70         {   // zero
     71             std::string v = "0,00 ";
     72             typedef input_iterator<const char*> I;
     73             long double ex;
     74             std::ios_base::iostate err = std::ios_base::goodbit;
     75             I iter = f.get(I(v.data()), I(v.data() + v.size()),
     76                                                 false, ios, err, ex);
     77             assert(iter.base() == v.data() + v.size());
     78             assert(err == std::ios_base::eofbit);
     79             assert(ex == 0);
     80         }
     81         {   // negative one
     82             std::string v = "-0,01 ";
     83             typedef input_iterator<const char*> I;
     84             long double ex;
     85             std::ios_base::iostate err = std::ios_base::goodbit;
     86             I iter = f.get(I(v.data()), I(v.data() + v.size()),
     87                                                 false, ios, err, ex);
     88             assert(iter.base() == v.data() + v.size());
     89             assert(err == std::ios_base::eofbit);
     90             assert(ex == -1);
     91         }
     92         {   // positive
     93             std::string v = "1 234 567,89 ";
     94             typedef input_iterator<const char*> I;
     95             long double ex;
     96             std::ios_base::iostate err = std::ios_base::goodbit;
     97             I iter = f.get(I(v.data()), I(v.data() + v.size()),
     98                                                 false, ios, err, ex);
     99             assert(iter.base() == v.data() + v.size());
    100             assert(err == std::ios_base::eofbit);
    101             assert(ex == 123456789);
    102         }
    103         {   // negative
    104             std::string v = "-1 234 567,89 ";
    105             typedef input_iterator<const char*> I;
    106             long double ex;
    107             std::ios_base::iostate err = std::ios_base::goodbit;
    108             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    109                                                 false, ios, err, ex);
    110             assert(iter.base() == v.data() + v.size());
    111             assert(err == std::ios_base::eofbit);
    112             assert(ex == -123456789);
    113         }
    114         {   // negative
    115             std::string v = "-1234567,89 ";
    116             typedef input_iterator<const char*> I;
    117             long double ex;
    118             std::ios_base::iostate err = std::ios_base::goodbit;
    119             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    120                                                 false, ios, err, ex);
    121             assert(iter.base() == v.data() + v.size());
    122             assert(err == std::ios_base::eofbit);
    123             assert(ex == -123456789);
    124         }
    125         {   // zero, showbase
    126             std::string v = "0,00 \xD1\x80\xD1\x83\xD0\xB1"".";
    127             typedef input_iterator<const char*> I;
    128             long double ex;
    129             std::ios_base::iostate err = std::ios_base::goodbit;
    130             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    131                                                 false, ios, err, ex);
    132             assert(iter.base() == v.data() + 5);
    133             assert(err == std::ios_base::goodbit);
    134             assert(ex == 0);
    135         }
    136         {   // zero, showbase
    137             std::string v = "0,00 \xD1\x80\xD1\x83\xD0\xB1"".";
    138             showbase(ios);
    139             typedef input_iterator<const char*> I;
    140             long double ex;
    141             std::ios_base::iostate err = std::ios_base::goodbit;
    142             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    143                                                 false, ios, err, ex);
    144             assert(iter.base() == v.data() + v.size());
    145             assert(err == std::ios_base::eofbit);
    146             assert(ex == 0);
    147             noshowbase(ios);
    148         }
    149         {   // negative one, showbase
    150             std::string v = "-0,01 \xD1\x80\xD1\x83\xD0\xB1"".";
    151             typedef input_iterator<const char*> I;
    152             long double ex;
    153             std::ios_base::iostate err = std::ios_base::goodbit;
    154             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    155                                                 false, ios, err, ex);
    156             assert(iter.base() == v.data() + 6);
    157             assert(err == std::ios_base::goodbit);
    158             assert(ex == -1);
    159         }
    160         {   // negative one, showbase
    161             std::string v = "-0,01 \xD1\x80\xD1\x83\xD0\xB1"".";
    162             showbase(ios);
    163             typedef input_iterator<const char*> I;
    164             long double ex;
    165             std::ios_base::iostate err = std::ios_base::goodbit;
    166             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    167                                                 false, ios, err, ex);
    168             assert(iter.base() == v.data() + v.size());
    169             assert(err == std::ios_base::eofbit);
    170             assert(ex == -1);
    171             noshowbase(ios);
    172         }
    173         {   // positive, showbase
    174             std::string v = "1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
    175             typedef input_iterator<const char*> I;
    176             long double ex;
    177             std::ios_base::iostate err = std::ios_base::goodbit;
    178             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    179                                                 false, ios, err, ex);
    180             assert(iter.base() == v.data() + 13);
    181             assert(err == std::ios_base::goodbit);
    182             assert(ex == 123456789);
    183         }
    184         {   // positive, showbase
    185             std::string v = "1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
    186             showbase(ios);
    187             typedef input_iterator<const char*> I;
    188             long double ex;
    189             std::ios_base::iostate err = std::ios_base::goodbit;
    190             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    191                                                 false, ios, err, ex);
    192             assert(iter.base() == v.data() + v.size());
    193             assert(err == std::ios_base::eofbit);
    194             assert(ex == 123456789);
    195             noshowbase(ios);
    196         }
    197         {   // negative, showbase
    198             std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
    199             showbase(ios);
    200             typedef input_iterator<const char*> I;
    201             long double ex;
    202             std::ios_base::iostate err = std::ios_base::goodbit;
    203             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    204                                                 false, ios, err, ex);
    205             assert(iter.base() == v.data() + v.size());
    206             assert(err == std::ios_base::eofbit);
    207             assert(ex == -123456789);
    208             noshowbase(ios);
    209         }
    210         {   // negative, showbase
    211             std::string v = "-1 234 567,89 RUB ";
    212             showbase(ios);
    213             typedef input_iterator<const char*> I;
    214             long double ex;
    215             std::ios_base::iostate err = std::ios_base::goodbit;
    216             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    217                                                 false, ios, err, ex);
    218             assert(iter.base() == v.data() + 14);
    219             assert(err == std::ios_base::failbit);
    220             noshowbase(ios);
    221         }
    222         {   // negative, showbase
    223             std::string v = "-1 234 567,89 RUB ";
    224             typedef input_iterator<const char*> I;
    225             long double ex;
    226             std::ios_base::iostate err = std::ios_base::goodbit;
    227             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    228                                                 false, ios, err, ex);
    229             assert(iter.base() == v.data() + 14);
    230             assert(err == std::ios_base::goodbit);
    231             assert(ex == -123456789);
    232         }
    233     }
    234     {
    235         const my_facet f(1);
    236         // char, international
    237         {   // zero
    238             std::string v = "0,00";
    239             typedef input_iterator<const char*> I;
    240             long double ex;
    241             std::ios_base::iostate err = std::ios_base::goodbit;
    242             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    243                                                 true, ios, err, ex);
    244             assert(iter.base() == v.data() + v.size());
    245             assert(err == std::ios_base::eofbit);
    246             assert(ex == 0);
    247         }
    248         {   // negative one
    249             std::string v = "-0,01 ";
    250             typedef input_iterator<const char*> I;
    251             long double ex;
    252             std::ios_base::iostate err = std::ios_base::goodbit;
    253             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    254                                                 true, ios, err, ex);
    255             assert(iter.base() == v.data() + v.size());
    256             assert(err == std::ios_base::eofbit);
    257             assert(ex == -1);
    258         }
    259         {   // positive
    260             std::string v = "1 234 567,89 ";
    261             typedef input_iterator<const char*> I;
    262             long double ex;
    263             std::ios_base::iostate err = std::ios_base::goodbit;
    264             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    265                                                 true, ios, err, ex);
    266             assert(iter.base() == v.data() + v.size());
    267             assert(err == std::ios_base::eofbit);
    268             assert(ex == 123456789);
    269         }
    270         {   // negative
    271             std::string v = "-1 234 567,89 ";
    272             typedef input_iterator<const char*> I;
    273             long double ex;
    274             std::ios_base::iostate err = std::ios_base::goodbit;
    275             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    276                                                 true, ios, err, ex);
    277             assert(iter.base() == v.data() + v.size());
    278             assert(err == std::ios_base::eofbit);
    279             assert(ex == -123456789);
    280         }
    281         {   // negative
    282             std::string v = "-1234567,89 ";
    283             typedef input_iterator<const char*> I;
    284             long double ex;
    285             std::ios_base::iostate err = std::ios_base::goodbit;
    286             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    287                                                 true, ios, err, ex);
    288             assert(iter.base() == v.data() + v.size());
    289             assert(err == std::ios_base::eofbit);
    290             assert(ex == -123456789);
    291         }
    292         {   // zero, showbase
    293             std::string v = "0,00 RUB ";
    294             typedef input_iterator<const char*> I;
    295             long double ex;
    296             std::ios_base::iostate err = std::ios_base::goodbit;
    297             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    298                                                 true, ios, err, ex);
    299             assert(iter.base() == v.data() + 5);
    300             assert(err == std::ios_base::goodbit);
    301             assert(ex == 0);
    302         }
    303         {   // zero, showbase
    304             std::string v = "0,00 RUB ";
    305             showbase(ios);
    306             typedef input_iterator<const char*> I;
    307             long double ex;
    308             std::ios_base::iostate err = std::ios_base::goodbit;
    309             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    310                                                 true, ios, err, ex);
    311             assert(iter.base() == v.data() + v.size());
    312             assert(err == std::ios_base::eofbit);
    313             assert(ex == 0);
    314             noshowbase(ios);
    315         }
    316         {   // negative one, showbase
    317             std::string v = "-0,01 RUB ";
    318             typedef input_iterator<const char*> I;
    319             long double ex;
    320             std::ios_base::iostate err = std::ios_base::goodbit;
    321             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    322                                                 true, ios, err, ex);
    323             assert(iter.base() == v.data() + 6);
    324             assert(err == std::ios_base::goodbit);
    325             assert(ex == -1);
    326         }
    327         {   // negative one, showbase
    328             std::string v = "-0,01 RUB ";
    329             showbase(ios);
    330             typedef input_iterator<const char*> I;
    331             long double ex;
    332             std::ios_base::iostate err = std::ios_base::goodbit;
    333             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    334                                                 true, ios, err, ex);
    335             assert(iter.base() == v.data() + v.size());
    336             assert(err == std::ios_base::eofbit);
    337             assert(ex == -1);
    338             noshowbase(ios);
    339         }
    340         {   // positive, showbase
    341             std::string v = "1 234 567,89 RUB ";
    342             typedef input_iterator<const char*> I;
    343             long double ex;
    344             std::ios_base::iostate err = std::ios_base::goodbit;
    345             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    346                                                 true, ios, err, ex);
    347             assert(iter.base() == v.data() + 13);
    348             assert(err == std::ios_base::goodbit);
    349             assert(ex == 123456789);
    350         }
    351         {   // positive, showbase
    352             std::string v = "1 234 567,89 RUB ";
    353             showbase(ios);
    354             typedef input_iterator<const char*> I;
    355             long double ex;
    356             std::ios_base::iostate err = std::ios_base::goodbit;
    357             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    358                                                 true, ios, err, ex);
    359             assert(iter.base() == v.data() + v.size());
    360             assert(err == std::ios_base::eofbit);
    361             assert(ex == 123456789);
    362             noshowbase(ios);
    363         }
    364         {   // negative, showbase
    365             std::string v = "-1 234 567,89 RUB ";
    366             showbase(ios);
    367             typedef input_iterator<const char*> I;
    368             long double ex;
    369             std::ios_base::iostate err = std::ios_base::goodbit;
    370             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    371                                                 true, ios, err, ex);
    372             assert(iter.base() == v.data() + v.size());
    373             assert(err == std::ios_base::eofbit);
    374             assert(ex == -123456789);
    375             noshowbase(ios);
    376         }
    377         {   // negative, showbase
    378             std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
    379             showbase(ios);
    380             typedef input_iterator<const char*> I;
    381             long double ex;
    382             std::ios_base::iostate err = std::ios_base::goodbit;
    383             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    384                                                 true, ios, err, ex);
    385             assert(iter.base() == v.data() + 14);
    386             assert(err == std::ios_base::failbit);
    387             noshowbase(ios);
    388         }
    389         {   // negative, showbase
    390             std::string v = "-1 234 567,89 \xD1\x80\xD1\x83\xD0\xB1"".";
    391             typedef input_iterator<const char*> I;
    392             long double ex;
    393             std::ios_base::iostate err = std::ios_base::goodbit;
    394             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    395                                                 true, ios, err, ex);
    396             assert(iter.base() == v.data() + 14);
    397             assert(err == std::ios_base::goodbit);
    398             assert(ex == -123456789);
    399         }
    400     }
    401     {
    402         const my_facetw f(1);
    403         // wchar_t, national
    404         {   // zero
    405             std::wstring v = L"0,00";
    406             typedef input_iterator<const wchar_t*> I;
    407             long double ex;
    408             std::ios_base::iostate err = std::ios_base::goodbit;
    409             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    410                                                 false, ios, err, ex);
    411             assert(iter.base() == v.data() + v.size());
    412             assert(err == std::ios_base::eofbit);
    413             assert(ex == 0);
    414         }
    415         {   // negative one
    416             std::wstring v = L"-0,01 ";
    417             typedef input_iterator<const wchar_t*> I;
    418             long double ex;
    419             std::ios_base::iostate err = std::ios_base::goodbit;
    420             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    421                                                 false, ios, err, ex);
    422             assert(iter.base() == v.data() + v.size());
    423             assert(err == std::ios_base::eofbit);
    424             assert(ex == -1);
    425         }
    426         {   // positive
    427             std::wstring v = L"1 234 567,89 ";
    428             typedef input_iterator<const wchar_t*> I;
    429             long double ex;
    430             std::ios_base::iostate err = std::ios_base::goodbit;
    431             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    432                                                 false, ios, err, ex);
    433             assert(iter.base() == v.data() + v.size());
    434             assert(err == std::ios_base::eofbit);
    435             assert(ex == 123456789);
    436         }
    437         {   // negative
    438             std::wstring v = L"-1 234 567,89 ";
    439             typedef input_iterator<const wchar_t*> I;
    440             long double ex;
    441             std::ios_base::iostate err = std::ios_base::goodbit;
    442             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    443                                                 false, ios, err, ex);
    444             assert(iter.base() == v.data() + v.size());
    445             assert(err == std::ios_base::eofbit);
    446             assert(ex == -123456789);
    447         }
    448         {   // negative
    449             std::wstring v = L"-1234567,89 ";
    450             typedef input_iterator<const wchar_t*> I;
    451             long double ex;
    452             std::ios_base::iostate err = std::ios_base::goodbit;
    453             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    454                                                 false, ios, err, ex);
    455             assert(iter.base() == v.data() + v.size());
    456             assert(err == std::ios_base::eofbit);
    457             assert(ex == -123456789);
    458         }
    459         {   // zero, showbase
    460             std::wstring v = L"0,00 \x440\x443\x431"".";
    461             typedef input_iterator<const wchar_t*> I;
    462             long double ex;
    463             std::ios_base::iostate err = std::ios_base::goodbit;
    464             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    465                                                 false, ios, err, ex);
    466             assert(iter.base() == v.data() + 5);
    467             assert(err == std::ios_base::goodbit);
    468             assert(ex == 0);
    469         }
    470         {   // zero, showbase
    471             std::wstring v = L"0,00 \x440\x443\x431"".";
    472             showbase(ios);
    473             typedef input_iterator<const wchar_t*> I;
    474             long double ex;
    475             std::ios_base::iostate err = std::ios_base::goodbit;
    476             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    477                                                 false, ios, err, ex);
    478             assert(iter.base() == v.data() + v.size());
    479             assert(err == std::ios_base::eofbit);
    480             assert(ex == 0);
    481             noshowbase(ios);
    482         }
    483         {   // negative one, showbase
    484             std::wstring v = L"-0,01 \x440\x443\x431"".";
    485             typedef input_iterator<const wchar_t*> I;
    486             long double ex;
    487             std::ios_base::iostate err = std::ios_base::goodbit;
    488             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    489                                                 false, ios, err, ex);
    490             assert(iter.base() == v.data() + 6);
    491             assert(err == std::ios_base::goodbit);
    492             assert(ex == -1);
    493         }
    494         {   // negative one, showbase
    495             std::wstring v = L"-0,01 \x440\x443\x431"".";
    496             showbase(ios);
    497             typedef input_iterator<const wchar_t*> I;
    498             long double ex;
    499             std::ios_base::iostate err = std::ios_base::goodbit;
    500             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    501                                                 false, ios, err, ex);
    502             assert(iter.base() == v.data() + v.size());
    503             assert(err == std::ios_base::eofbit);
    504             assert(ex == -1);
    505             noshowbase(ios);
    506         }
    507         {   // positive, showbase
    508             std::wstring v = L"1 234 567,89 \x440\x443\x431"".";
    509             typedef input_iterator<const wchar_t*> I;
    510             long double ex;
    511             std::ios_base::iostate err = std::ios_base::goodbit;
    512             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    513                                                 false, ios, err, ex);
    514             assert(iter.base() == v.data() + 13);
    515             assert(err == std::ios_base::goodbit);
    516             assert(ex == 123456789);
    517         }
    518         {   // positive, showbase
    519             std::wstring v = L"1 234 567,89 \x440\x443\x431"".";
    520             showbase(ios);
    521             typedef input_iterator<const wchar_t*> I;
    522             long double ex;
    523             std::ios_base::iostate err = std::ios_base::goodbit;
    524             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    525                                                 false, ios, err, ex);
    526             assert(iter.base() == v.data() + v.size());
    527             assert(err == std::ios_base::eofbit);
    528             assert(ex == 123456789);
    529             noshowbase(ios);
    530         }
    531         {   // negative, showbase
    532             std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
    533             showbase(ios);
    534             typedef input_iterator<const wchar_t*> I;
    535             long double ex;
    536             std::ios_base::iostate err = std::ios_base::goodbit;
    537             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    538                                                 false, ios, err, ex);
    539             assert(iter.base() == v.data() + v.size());
    540             assert(err == std::ios_base::eofbit);
    541             assert(ex == -123456789);
    542             noshowbase(ios);
    543         }
    544         {   // negative, showbase
    545             std::wstring v = L"-1 234 567,89 RUB ";
    546             showbase(ios);
    547             typedef input_iterator<const wchar_t*> I;
    548             long double ex;
    549             std::ios_base::iostate err = std::ios_base::goodbit;
    550             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    551                                                 false, ios, err, ex);
    552             assert(iter.base() == v.data() + 14);
    553             assert(err == std::ios_base::failbit);
    554             noshowbase(ios);
    555         }
    556         {   // negative, showbase
    557             std::wstring v = L"-1 234 567,89 RUB ";
    558             typedef input_iterator<const wchar_t*> I;
    559             long double ex;
    560             std::ios_base::iostate err = std::ios_base::goodbit;
    561             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    562                                                 false, ios, err, ex);
    563             assert(iter.base() == v.data() + 14);
    564             assert(err == std::ios_base::goodbit);
    565             assert(ex == -123456789);
    566         }
    567     }
    568     {
    569         const my_facetw f(1);
    570         // wchar_t, international
    571         {   // zero
    572             std::wstring v = L"0,00";
    573             typedef input_iterator<const wchar_t*> I;
    574             long double ex;
    575             std::ios_base::iostate err = std::ios_base::goodbit;
    576             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    577                                                 true, ios, err, ex);
    578             assert(iter.base() == v.data() + v.size());
    579             assert(err == std::ios_base::eofbit);
    580             assert(ex == 0);
    581         }
    582         {   // negative one
    583             std::wstring v = L"-0,01 ";
    584             typedef input_iterator<const wchar_t*> I;
    585             long double ex;
    586             std::ios_base::iostate err = std::ios_base::goodbit;
    587             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    588                                                 true, ios, err, ex);
    589             assert(iter.base() == v.data() + v.size());
    590             assert(err == std::ios_base::eofbit);
    591             assert(ex == -1);
    592         }
    593         {   // positive
    594             std::wstring v = L"1 234 567,89 ";
    595             typedef input_iterator<const wchar_t*> I;
    596             long double ex;
    597             std::ios_base::iostate err = std::ios_base::goodbit;
    598             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    599                                                 true, ios, err, ex);
    600             assert(iter.base() == v.data() + v.size());
    601             assert(err == std::ios_base::eofbit);
    602             assert(ex == 123456789);
    603         }
    604         {   // negative
    605             std::wstring v = L"-1 234 567,89 ";
    606             typedef input_iterator<const wchar_t*> I;
    607             long double ex;
    608             std::ios_base::iostate err = std::ios_base::goodbit;
    609             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    610                                                 true, ios, err, ex);
    611             assert(iter.base() == v.data() + v.size());
    612             assert(err == std::ios_base::eofbit);
    613             assert(ex == -123456789);
    614         }
    615         {   // negative
    616             std::wstring v = L"-1234567,89 ";
    617             typedef input_iterator<const wchar_t*> I;
    618             long double ex;
    619             std::ios_base::iostate err = std::ios_base::goodbit;
    620             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    621                                                 true, ios, err, ex);
    622             assert(iter.base() == v.data() + v.size());
    623             assert(err == std::ios_base::eofbit);
    624             assert(ex == -123456789);
    625         }
    626         {   // zero, showbase
    627             std::wstring v = L"0,00 RUB ";
    628             typedef input_iterator<const wchar_t*> I;
    629             long double ex;
    630             std::ios_base::iostate err = std::ios_base::goodbit;
    631             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    632                                                 true, ios, err, ex);
    633             assert(iter.base() == v.data() + 5);
    634             assert(err == std::ios_base::goodbit);
    635             assert(ex == 0);
    636         }
    637         {   // zero, showbase
    638             std::wstring v = L"0,00 RUB ";
    639             showbase(ios);
    640             typedef input_iterator<const wchar_t*> I;
    641             long double ex;
    642             std::ios_base::iostate err = std::ios_base::goodbit;
    643             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    644                                                 true, ios, err, ex);
    645             assert(iter.base() == v.data() + v.size());
    646             assert(err == std::ios_base::eofbit);
    647             assert(ex == 0);
    648             noshowbase(ios);
    649         }
    650         {   // negative one, showbase
    651             std::wstring v = L"-0,01 RUB ";
    652             typedef input_iterator<const wchar_t*> I;
    653             long double ex;
    654             std::ios_base::iostate err = std::ios_base::goodbit;
    655             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    656                                                 true, ios, err, ex);
    657             assert(iter.base() == v.data() + 6);
    658             assert(err == std::ios_base::goodbit);
    659             assert(ex == -1);
    660         }
    661         {   // negative one, showbase
    662             std::wstring v = L"-0,01 RUB ";
    663             showbase(ios);
    664             typedef input_iterator<const wchar_t*> I;
    665             long double ex;
    666             std::ios_base::iostate err = std::ios_base::goodbit;
    667             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    668                                                 true, ios, err, ex);
    669             assert(iter.base() == v.data() + v.size());
    670             assert(err == std::ios_base::eofbit);
    671             assert(ex == -1);
    672             noshowbase(ios);
    673         }
    674         {   // positive, showbase
    675             std::wstring v = L"1 234 567,89 RUB ";
    676             typedef input_iterator<const wchar_t*> I;
    677             long double ex;
    678             std::ios_base::iostate err = std::ios_base::goodbit;
    679             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    680                                                 true, ios, err, ex);
    681             assert(iter.base() == v.data() + 13);
    682             assert(err == std::ios_base::goodbit);
    683             assert(ex == 123456789);
    684         }
    685         {   // positive, showbase
    686             std::wstring v = L"1 234 567,89 RUB ";
    687             showbase(ios);
    688             typedef input_iterator<const wchar_t*> I;
    689             long double ex;
    690             std::ios_base::iostate err = std::ios_base::goodbit;
    691             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    692                                                 true, ios, err, ex);
    693             assert(iter.base() == v.data() + v.size());
    694             assert(err == std::ios_base::eofbit);
    695             assert(ex == 123456789);
    696             noshowbase(ios);
    697         }
    698         {   // negative, showbase
    699             std::wstring v = L"-1 234 567,89 RUB ";
    700             showbase(ios);
    701             typedef input_iterator<const wchar_t*> I;
    702             long double ex;
    703             std::ios_base::iostate err = std::ios_base::goodbit;
    704             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    705                                                 true, ios, err, ex);
    706             assert(iter.base() == v.data() + v.size());
    707             assert(err == std::ios_base::eofbit);
    708             assert(ex == -123456789);
    709             noshowbase(ios);
    710         }
    711         {   // negative, showbase
    712             std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
    713             showbase(ios);
    714             typedef input_iterator<const wchar_t*> I;
    715             long double ex;
    716             std::ios_base::iostate err = std::ios_base::goodbit;
    717             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    718                                                 true, ios, err, ex);
    719             assert(iter.base() == v.data() + 14);
    720             assert(err == std::ios_base::failbit);
    721             noshowbase(ios);
    722         }
    723         {   // negative, showbase
    724             std::wstring v = L"-1 234 567,89 \x440\x443\x431"".";
    725             typedef input_iterator<const wchar_t*> I;
    726             long double ex;
    727             std::ios_base::iostate err = std::ios_base::goodbit;
    728             I iter = f.get(I(v.data()), I(v.data() + v.size()),
    729                                                 true, ios, err, ex);
    730             assert(iter.base() == v.data() + 14);
    731             assert(err == std::ios_base::goodbit);
    732             assert(ex == -123456789);
    733         }
    734     }
    735 }
    736