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