]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 25_algorithms / search_n / iterator.cc
index 1cc8e875a0423a3eecb7b6a62866593fc66852f0..8fcf45ea85381d31603a35cb314b364ce3a04d9d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004-2024 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 2, or (at your option)
+// 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,
@@ -12,9 +12,8 @@
 // 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 COPYING.  If not, write to the Free
-// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-// USA.
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
 
 // { dg-options "-DTEST_DEPTH=10" { target simulator } }
 
 int array1[11] = {0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0};
 int array2[TEST_DEPTH];
 
+int pred_count;
 bool 
 pred(int i, int j)
 {
+  ++pred_count;
   return i == j;
 }
 
@@ -91,16 +92,22 @@ int main()
 
            int* t1 = search_n(forwardcon.begin(),
                               forwardcon.end(), j, 1).ptr;
+           pred_count = 0;
            int* t2 = search_n(forwardcon.begin(),
                               forwardcon.end(), j, 1, pred).ptr;
+           VERIFY(pred_count <= i);
            int* t3 = search_n(bidircon.begin(),
                               bidircon.end(), j, 1).ptr;
+           pred_count = 0;
            int* t4 = search_n(bidircon.begin(),
                               bidircon.end(), j, 1, pred).ptr;
+           VERIFY(pred_count <= i);
            int* t5 = search_n(randomcon.begin(),
                               randomcon.end(), j, 1).ptr;
+           pred_count = 0;
            int* t6 = search_n(randomcon.begin(),
                               randomcon.end(), j, 1, pred).ptr;
+           VERIFY(pred_count <= i);
            VERIFY((t1 == t2) && (t2 == t3) && (t3 == t4) &&
                   (t4 == t5) && (t5 == t6));
          }