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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [25_algorithms/] [iter_swap/] [20577.cc] - Blame information for rev 746

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

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
2
//
3
// This file is part of the GNU ISO C++ Library.  This library is free
4
// software; you can redistribute it and/or modify it under the
5
// terms of the GNU General Public License as published by the
6
// Free Software Foundation; either version 3, or (at your option)
7
// any later version.
8
 
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
 
14
// You should have received a copy of the GNU General Public License along
15
// with this library; see the file COPYING3.  If not see
16
// <http://www.gnu.org/licenses/>.
17
 
18
#include <algorithm>
19
#include <vector>
20
#include <testsuite_hooks.h>
21
 
22
void
23
test1()
24
{
25
  bool test __attribute__((unused)) = true;
26
 
27
  std::vector<bool> v;
28
  v.push_back(true);
29
  v.push_back(false);
30
  std::iter_swap(v.begin(), v.begin() + 1);
31
  VERIFY( v[0] == false && v[1] == true );
32
}
33
 
34
void
35
test2()
36
{
37
  bool test __attribute__((unused)) = true;
38
 
39
  std::vector<int> v;
40
  v.push_back(1);
41
  v.push_back(2);
42
  std::iter_swap(v.begin(), v.begin() + 1);
43
  VERIFY( v[0] == 2 && v[1] == 1 );
44
}
45
 
46
int int_swap_count;
47
 
48
struct X {};
49
void swap(X&, X&)
50
{ ++int_swap_count; }
51
 
52
void
53
test3()
54
{
55
  bool test __attribute__((unused)) = true;
56
 
57
  int_swap_count = 0;
58
  X i, j;
59
  std::iter_swap(&i, &j);
60
  VERIFY( int_swap_count == 1 );
61
}
62
 
63
// libstdc++/20577
64
int main()
65
{
66
  test1();
67
  test2();
68
  test3();
69
  return 0;
70
}

powered by: WebSVN 2.1.0

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