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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [25_algorithms/] [remove/] [moveable.cc] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 424 jeremybenn
// { dg-options "-std=gnu++0x" }
2
 
3
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
4
// Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the
8
// terms of the GNU General Public License as published by the
9
// Free Software Foundation; either version 3, or (at your option)
10
// any later version.
11
 
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
// GNU General Public License for more details.
16
 
17
// You should have received a copy of the GNU General Public License along
18
// with this library; see the file COPYING3.  If not see
19
// <http://www.gnu.org/licenses/>.
20
 
21
// 25.2.4 remove
22
 
23
#undef _GLIBCXX_CONCEPT_CHECKS
24
 
25
// XXX FIXME:  parallel-mode should deal correctly with moveable-only types
26
// per C++0x, at minimum smoothly fall back to serial.
27
#undef _GLIBCXX_PARALLEL
28
 
29
#include <algorithm>
30
#include <testsuite_hooks.h>
31
#include <testsuite_iterators.h>
32
#include <testsuite_rvalref.h>
33
 
34
using __gnu_test::test_container;
35
using __gnu_test::forward_iterator_wrapper;
36
using __gnu_test::rvalstruct;
37
 
38
typedef test_container<rvalstruct, forward_iterator_wrapper> Container;
39
 
40
void
41
test1()
42
{
43
  int intarray[] = {1};
44
  rvalstruct array[1];
45
  std::copy(intarray, intarray + 1, array);
46
  Container con(array, array + 1);
47
  rvalstruct remove_val0(0);
48
  rvalstruct remove_val1(1);
49
  VERIFY(std::remove(con.begin(), con.end(), remove_val0).ptr == array + 1);
50
  VERIFY(std::remove(con.begin(), con.end(), remove_val1).ptr == array);
51
}
52
 
53
void
54
test2()
55
{
56
  int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1};
57
  rvalstruct array[8];
58
  std::copy(intarray, intarray + 8, array);
59
  Container con(array, array + 8);
60
  rvalstruct remove_val(1);
61
  VERIFY(std::remove(con.begin(), con.end(), remove_val).ptr == array + 4);
62
  VERIFY(array[0].val == 0 && array[1].val == 0 && array[2].val == 0 &&
63
         array[3].val == 0);
64
}
65
 
66
int
67
main()
68
{
69
  test1();
70
  test2();
71
}

powered by: WebSVN 2.1.0

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