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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
 
3
// Copyright (C) 2009, 2010, 2011 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
// 25.3.4 [lib.alg.merge]
21
 
22
#include <algorithm>
23
#include <testsuite_hooks.h>
24
#include <testsuite_iterators.h>
25
#include <testsuite_rvalref.h>
26
 
27
using __gnu_test::test_container;
28
using __gnu_test::bidirectional_iterator_wrapper;
29
using __gnu_test::rvalstruct;
30
 
31
typedef test_container<rvalstruct, bidirectional_iterator_wrapper> container;
32
 
33
void
34
test01()
35
{
36
  bool test __attribute__((unused)) = true;
37
 
38
  int array1[]={0,2,4,1,3,5};
39
  rvalstruct rv_array1[6];
40
  std::copy(array1, array1 + 6, rv_array1);
41
  container con1(rv_array1, rv_array1 + 6);
42
  std::inplace_merge(con1.begin(), con1.it(3), con1.end());
43
  VERIFY( rv_array1[0] == 0 && rv_array1[1] == 1 && rv_array1[2] == 2
44
          && rv_array1[3] == 3 && rv_array1[4] == 4 && rv_array1[5] == 5 );
45
 
46
  int array2[]={0,2,4,5,1,3};
47
  rvalstruct rv_array2[6];
48
  std::copy(array2, array2 + 6, rv_array2);
49
  container con2(rv_array2, rv_array2 + 6);
50
  std::inplace_merge(con2.begin(), con2.it(4), con2.end());
51
  VERIFY( rv_array2[0] == 0 && rv_array2[1] == 1 && rv_array2[2] == 2
52
          && rv_array2[3] == 3 && rv_array2[4] == 4 && rv_array2[5] == 5 );
53
 
54
  int array3[]={1,1,1,2,2,2};
55
  rvalstruct rv_array3[6];
56
  std::copy(array3, array3 + 6, rv_array3);
57
  container con3(rv_array3, rv_array3 + 6);
58
  std::inplace_merge(con3.begin(), con3.it(3), con3.end());
59
  VERIFY( rv_array3[0] == 1 && rv_array3[1] == 1 && rv_array3[2] == 1
60
          && rv_array3[3] == 2 && rv_array3[4] == 2 && rv_array3[5] == 2 );
61
 
62
  int array4[]={1,1,1,1,2,2};
63
  rvalstruct rv_array4[6];
64
  std::copy(array4, array4 + 6, rv_array4);
65
  container con4(rv_array4, rv_array4 + 6);
66
  std::inplace_merge(con4.begin(), con4.it(4), con4.end());
67
  VERIFY( rv_array4[0] == 1 && rv_array4[1] == 1 && rv_array4[2] == 1
68
          && rv_array4[3] == 1 && rv_array4[4] == 2 && rv_array4[5] == 2 );
69
 
70
  int array5[]={3,3,3,3};
71
  rvalstruct rv_array5[4];
72
  std::copy(array5, array5 + 4, rv_array5);
73
  container con5(rv_array5, rv_array5 + 4);
74
  std::inplace_merge(con5.begin(), con5.it(2), con5.end());
75
  VERIFY( rv_array5[0] == 3 && rv_array5[1] == 3 && rv_array5[2] == 3
76
          && rv_array5[3] == 3 );
77
 
78
  int array6[]={3,3,3};
79
  rvalstruct rv_array6[3];
80
  std::copy(array6, array6 + 3, rv_array6);
81
  container con6(rv_array6, rv_array6 + 3);
82
  std::inplace_merge(con6.begin(), con6.it(0), con6.end());
83
  VERIFY( rv_array6[0] == 3 && rv_array6[1] == 3 && rv_array6[2] == 3 );
84
 
85
  int array7[]={3,3};
86
  rvalstruct rv_array7[2];
87
  std::copy(array7, array7 + 2, rv_array7);
88
  container con7(rv_array7, rv_array7 + 2);
89
  std::inplace_merge(con7.begin(), con7.it(2), con7.end());
90
  VERIFY( rv_array7[0] == 3 && rv_array7[1] == 3 );
91
}
92
 
93
int
94
main()
95
{
96
  test01();
97
  return 0;
98
}

powered by: WebSVN 2.1.0

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