11541Srgrimes// { dg-require-namedlocale "" } 21541Srgrimes 31541Srgrimes// 2004-02-05 Paolo Carlini <pcarlini@suse.de> 41541Srgrimes 51541Srgrimes// Copyright (C) 2004, 2005, 2009 Free Software Foundation 61541Srgrimes// 71541Srgrimes// This file is part of the GNU ISO C++ Library. This library is free 81541Srgrimes// software; you can redistribute it and/or modify it under the 91541Srgrimes// terms of the GNU General Public License as published by the 101541Srgrimes// Free Software Foundation; either version 3, or (at your option) 111541Srgrimes// any later version. 121541Srgrimes 131541Srgrimes// This library is distributed in the hope that it will be useful, 141541Srgrimes// but WITHOUT ANY WARRANTY; without even the implied warranty of 151541Srgrimes// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 161541Srgrimes// GNU General Public License for more details. 171541Srgrimes 181541Srgrimes// You should have received a copy of the GNU General Public License along 191541Srgrimes// with this library; see the file COPYING3. If not see 201541Srgrimes// <http://www.gnu.org/licenses/>. 211541Srgrimes 221541Srgrimes// 22.2.6.1.1 money_get members 231541Srgrimes 241541Srgrimes#include <locale> 251541Srgrimes#include <sstream> 261541Srgrimes#include <testsuite_hooks.h> 271541Srgrimes 281541Srgrimes// No thousands-sep allowed after the decimal-point. 291541Srgrimesvoid test01() 301541Srgrimes{ 311541Srgrimes using namespace std; 321541Srgrimes bool test __attribute__((unused)) = true; 331541Srgrimes 341541Srgrimes typedef istreambuf_iterator<char> iterator_type; 351541Srgrimes 3622521Sdyson // basic construction 371541Srgrimes locale loc_c = locale::classic(); 3822521Sdyson locale loc_de = locale("de_DE@euro"); 3922521Sdyson VERIFY( loc_c != loc_de ); 4022521Sdyson 4122521Sdyson iterator_type end01, end02; 4222521Sdyson istringstream iss; 4350477Speter iss.imbue(loc_de); 441541Srgrimes // cache the money_get facet 451541Srgrimes const money_get<char>& mon_get = use_facet<money_get<char> >(iss.getloc()); 461541Srgrimes 471541Srgrimes iss.str("500,1.0 "); 481541Srgrimes iterator_type is_it01(iss); 4977130Sru long double result1; 501541Srgrimes ios_base::iostate err01 = ios_base::goodbit; 5196755Strhodes end01 = mon_get.get(is_it01, end01, true, iss, err01, result1); 521541Srgrimes VERIFY( err01 == ios_base::failbit ); 5396755Strhodes VERIFY( *end01 == '.' ); 541541Srgrimes 5535256Sdes iss.str("500,1.0 "); 561541Srgrimes iterator_type is_it02(iss); 571541Srgrimes long double result2; 581541Srgrimes ios_base::iostate err02 = ios_base::goodbit; 591541Srgrimes end02 = mon_get.get(is_it02, end02, false, iss, err02, result2); 6096755Strhodes VERIFY( err02 == ios_base::failbit ); 611541Srgrimes VERIFY( *end02 == '.' ); 621541Srgrimes} 6396755Strhodes 641541Srgrimesint main() 651541Srgrimes{ 661541Srgrimes test01(); 671541Srgrimes return 0; 681541Srgrimes} 691541Srgrimes