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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [24_iterators/] [istreambuf_iterator/] [2627.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// 1999-06-28 bkoz
2
 
3
// Copyright (C) 1999, 2001, 2003, 2009 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 3, or (at your option)
9
// any later version.
10
 
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
 
16
// You should have received a copy of the GNU General Public License along
17
// with this library; see the file COPYING3.  If not see
18
// <http://www.gnu.org/licenses/>.
19
 
20
// 24.5.3 template class istreambuf_iterator
21
 
22
#include <sstream>
23
#include <iterator>
24
#include <testsuite_hooks.h>
25
 
26
// libstdc++/2627
27
void test03()
28
{
29
  bool test __attribute__((unused)) = true;
30
  const std::string s("free the vieques");
31
 
32
  // 1
33
  std::string res_postfix;
34
  std::istringstream iss01(s);
35
  std::istreambuf_iterator<char> isbufit01(iss01);
36
  for (std::size_t j = 0; j < s.size(); ++j, isbufit01++)
37
    res_postfix += *isbufit01;
38
 
39
  // 2
40
  std::string res_prefix;
41
  std::istringstream iss02(s);
42
  std::istreambuf_iterator<char> isbufit02(iss02);
43
  for (std::size_t j = 0; j < s.size(); ++j, ++isbufit02)
44
    res_prefix += *isbufit02;
45
 
46
  // 3 mixed
47
  std::string res_mixed;
48
  std::istringstream iss03(s);
49
  std::istreambuf_iterator<char> isbufit03(iss03);
50
  for (std::size_t j = 0; j < (s.size() / 2); ++j)
51
    {
52
      res_mixed += *isbufit03;
53
      ++isbufit03;
54
      res_mixed += *isbufit03;
55
      isbufit03++;
56
    }
57
 
58
  VERIFY ( res_postfix == res_prefix );
59
  VERIFY ( res_mixed == res_prefix );
60
}
61
 
62
int main()
63
{
64
  test03();
65
  return 0;
66
}

powered by: WebSVN 2.1.0

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