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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [25_algorithms/] [remove_if/] [moveable.cc] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
 
3
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
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
#include <algorithm>
26
#include <testsuite_hooks.h>
27
#include <testsuite_iterators.h>
28
#include <testsuite_rvalref.h>
29
 
30
using __gnu_test::test_container;
31
using __gnu_test::forward_iterator_wrapper;
32
using __gnu_test::rvalstruct;
33
 
34
typedef test_container<rvalstruct, forward_iterator_wrapper> Container;
35
 
36
bool equal1(rvalstruct& in) { return in.val == 1; }
37
bool equal0(rvalstruct& in) { return in.val == 0; }
38
 
39
void
40
test1()
41
{
42
  int intarray[] = {1};
43
  rvalstruct array[1];
44
  std::copy(intarray, intarray + 1, array);
45
  Container con(array, array + 1);
46
  VERIFY(std::remove_if(con.begin(), con.end(), equal0).ptr == array + 1);
47
  VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array);
48
}
49
 
50
void
51
test2()
52
{
53
  int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1};
54
  rvalstruct array[8];
55
  std::copy(intarray, intarray + 8, array);
56
  Container con(array, array + 8);
57
  VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array + 4);
58
  VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 &&
59
         array[3] == 0);
60
}
61
 
62
int
63
main()
64
{
65
  test1();
66
  test2();
67
}

powered by: WebSVN 2.1.0

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