OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [ext/] [enc_filebuf/] [char/] [13598.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Before Solaris 11, iconv -f ISO-8859-1 -t ISO-8859-1 fails with
2
// Not supported ISO-8859-1 to ISO-8859-1
3
//
4
// { dg-do run { xfail *-*-solaris2.[89] *-*-solaris2.10 } }
5
// { dg-require-iconv "ISO-8859-1" }
6
 
7
// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation
8
//
9
// This file is part of the GNU ISO C++ Library.  This library is free
10
// software; you can redistribute it and/or modify it under the
11
// terms of the GNU General Public License as published by the
12
// Free Software Foundation; either version 3, or (at your option)
13
// any later version.
14
 
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
// GNU General Public License for more details.
19
 
20
// You should have received a copy of the GNU General Public License along
21
// with this library; see the file COPYING3.  If not see
22
// <http://www.gnu.org/licenses/>.
23
 
24
#include <locale>
25
#include <cstring>
26
#include <cstddef>
27
#include <testsuite_hooks.h>
28
#include <ext/enc_filebuf.h>
29
 
30
int main()
31
{
32
  bool test __attribute__((unused)) = true;
33
  typedef char char_type;
34
  typedef __gnu_cxx::enc_filebuf<char_type> filebuf_type;
35
  typedef filebuf_type::state_type state_type;
36
 
37
  const char* str = "Hello, world!\n";
38
  std::locale loc(std::locale::classic(),
39
                  new std::codecvt<char, char, __gnu_cxx::encoding_state>());
40
  state_type st("ISO-8859-1", "ISO-8859-1");
41
  filebuf_type fb(st);
42
  fb.pubimbue(loc);
43
 
44
  fb.open("tmp_13598", std::ios_base::out);
45
  std::streamsize n = fb.sputn(str, std::strlen(str));
46
  int s = fb.pubsync();
47
  fb.close();
48
 
49
  VERIFY( std::size_t(n) == std::strlen(str) );
50
  VERIFY( s == 0 );
51
 
52
  return 0;
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.