1219820Sjeff// { dg-require-namedlocale "" } 2219820Sjeff 3219820Sjeff// 2004-08-25 Paolo Carlini <pcarlini@suse.de> 4219820Sjeff 5219820Sjeff// Copyright (C) 2004, 2005, 2006 Free Software Foundation 6219820Sjeff// 7219820Sjeff// This file is part of the GNU ISO C++ Library. This library is free 8219820Sjeff// software; you can redistribute it and/or modify it under the 9219820Sjeff// terms of the GNU General Public License as published by the 10219820Sjeff// Free Software Foundation; either version 2, or (at your option) 11219820Sjeff// any later version. 12219820Sjeff 13219820Sjeff// This library is distributed in the hope that it will be useful, 14219820Sjeff// but WITHOUT ANY WARRANTY; without even the implied warranty of 15219820Sjeff// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16219820Sjeff// GNU General Public License for more details. 17219820Sjeff 18219820Sjeff// You should have received a copy of the GNU General Public License along 19219820Sjeff// with this library; see the file COPYING. If not, write to the Free 20219820Sjeff// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 21219820Sjeff// USA. 22219820Sjeff 23219820Sjeff// 22.2.5.3.1 time_put members 24219820Sjeff 25219820Sjeff#include <locale> 26219820Sjeff#include <sstream> 27219820Sjeff#include <testsuite_hooks.h> 28219820Sjeff 29219820Sjeff// libstdc++/17038 30219820Sjeffvoid test01() 31219820Sjeff{ 32219820Sjeff using namespace std; 33219820Sjeff typedef ostreambuf_iterator<wchar_t> iterator_type; 34219820Sjeff 35219820Sjeff bool test __attribute__((unused)) = true; 36219820Sjeff 37219820Sjeff // create "C" time objects 38219820Sjeff const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0); 39219820Sjeff 40219820Sjeff // basic construction 41219820Sjeff locale loc_c = locale::classic(); 42219820Sjeff locale loc_in = locale("ta_IN"); 43219820Sjeff VERIFY( loc_in != loc_c ); 44219820Sjeff 45219820Sjeff // create an ostream-derived object, cache the time_put facet 46219820Sjeff wostringstream oss; 47219820Sjeff oss.imbue(loc_in); 48219820Sjeff const time_put<wchar_t>& tim_put = 49219820Sjeff use_facet<time_put<wchar_t> >(oss.getloc()); 50219820Sjeff 51219820Sjeff iterator_type os_it01 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'c'); 52219820Sjeff wstring result1 = oss.str(); 53219820Sjeff 54219820Sjeff wchar_t time_buffer[128]; 55219820Sjeff setlocale(LC_ALL, "ta_IN"); 56219820Sjeff VERIFY( wcsftime(time_buffer, 128, L"%c", &time1) ); 57219820Sjeff 58219820Sjeff VERIFY( result1 == time_buffer ); 59219820Sjeff} 60219820Sjeff 61219820Sjeffint main() 62219820Sjeff{ 63219820Sjeff test01(); 64219820Sjeff return 0; 65219820Sjeff} 66219820Sjeff