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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [27_io/] [basic_filebuf/] [imbue/] [char/] [13582-2.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-require-namedlocale "en_US" }
2
// { dg-require-namedlocale "fr_FR" }
3
// { dg-require-fork "" }
4
// { dg-require-mkfifo "" }
5
 
6
// 2004-01-11  Petur Runolfsson  <peturr02@ru.is>
7
 
8
// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
9
//
10
// This file is part of the GNU ISO C++ Library.  This library is free
11
// software; you can redistribute it and/or modify it under the
12
// terms of the GNU General Public License as published by the
13
// Free Software Foundation; either version 3, or (at your option)
14
// any later version.
15
 
16
// This library is distributed in the hope that it will be useful,
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
// GNU General Public License for more details.
20
 
21
// You should have received a copy of the GNU General Public License along
22
// with this library; see the file COPYING3.  If not see
23
// <http://www.gnu.org/licenses/>.
24
 
25
// 27.8.1.4 Overridden virtual functions
26
 
27
#include <fstream>
28
#include <locale>
29
#include <cstdlib>
30
 
31
#include <unistd.h>
32
#include <sys/types.h>
33
#include <sys/stat.h>
34
 
35
#include <testsuite_hooks.h>
36
 
37
// libstdc++/13582
38
void test01()
39
{
40
  bool test __attribute__((unused)) = true;
41
  using namespace std;
42
  using namespace __gnu_test;
43
 
44
  locale loc_en(locale("en_US"));
45
  locale loc_fr(locale("fr_FR"));
46
 
47
  const char* name = "tmp_fifo_13582-2";
48
  unlink(name);
49
  mkfifo(name, S_IRWXU);
50
 
51
  int child = fork();
52
  if (child == 0)
53
    {
54
      filebuf fbout;
55
      fbout.open(name, ios_base::out);
56
      fbout.sputn("12345", 5);
57
      fbout.pubsync();
58
      fbout.close();
59
      exit(0);
60
    }
61
 
62
  filebuf fbin;
63
  fbin.open(name, ios_base::in);
64
  filebuf::int_type n = fbin.sbumpc();
65
  VERIFY( n == '1' );
66
  fbin.pubimbue(loc_en);
67
  n = fbin.sbumpc();
68
  VERIFY( n == '2' );
69
  fbin.pubimbue(loc_fr);
70
  n = fbin.sbumpc();
71
  VERIFY( n == '3' );
72
  n = fbin.sbumpc();
73
  VERIFY( n == '4' );
74
  n = fbin.sbumpc();
75
  VERIFY( n == '5' );
76
  n = fbin.sbumpc();
77
  VERIFY( n == filebuf::traits_type::eof() );
78
}
79
 
80
int main()
81
{
82
  test01();
83
  return 0;
84
}

powered by: WebSVN 2.1.0

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