summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_binary_heap-62045.cc
blob: 0ed22f6aeb791682999adb1b5fd86178facf7cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2017-2018 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

// { dg-require-normal-mode "" }

#include <ext/pb_ds/priority_queue.hpp>
#include <testsuite_hooks.h>

int count = 0;

struct less
{
  bool operator()(int i, int j) const
  {
    ++count;
    return i < j;
  }
};

void
test01()
{
  __gnu_pbds::priority_queue<int, less, __gnu_pbds::binary_heap_tag> c;
  c.push(1);
  c.push(2);
  c.push(3);
  c.push(4);
  count = 0;
  c.push(5);
  VERIFY( count < c.size() );
}

int
main()
{
  test01();
}