]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix tests for std::clamp
authorJonathan Wakely <jwakely@redhat.com>
Thu, 21 Sep 2017 09:59:55 +0000 (10:59 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 21 Sep 2017 09:59:55 +0000 (10:59 +0100)
* testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
expected results when using predicate defining reverse order.
* testsuite/25_algorithms/clamp/constexpr.cc: Likewise.

From-SVN: r253051

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc

index 9be1db75bf79e359f867235bb69fc28838380b8b..b2a8653c8b75ffe63581b66f5a7e1b32203f5080 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-21  Jonathan Wakely  <jwakely@redhat.com>
+
+       * testsuite/25_algorithms/clamp/1.cc: Fix order of arguments and
+       expected results when using predicate defining reverse order.
+       * testsuite/25_algorithms/clamp/constexpr.cc: Likewise.
+
 2017-09-20  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/79162
index 991b10d1fe3c38592f8c0596bc2c80cb11186a49..655c241e9a25128c122d790f9583e7a3c9974e2b 100644 (file)
@@ -30,12 +30,12 @@ void test01()
   VERIFY( y == 3 );
   VERIFY( z == 4 );
 
-  const int xc = std::clamp(1, 2, 4, std::greater<int>());
-  const int yc = std::clamp(3, 2, 4, std::greater<int>());
-  const int zc = std::clamp(5, 2, 4, std::greater<int>());
-  VERIFY( xc == 4 );
-  VERIFY( yc == 2 );
-  VERIFY( zc == 2 );
+  const int xc = std::clamp(1, 4, 2, std::greater<int>());
+  const int yc = std::clamp(3, 4, 2, std::greater<int>());
+  const int zc = std::clamp(5, 4, 2, std::greater<int>());
+  VERIFY( xc == 2 );
+  VERIFY( yc == 3 );
+  VERIFY( zc == 4 );
 }
 
 int
index 0864b8e1d30edf613598cfce4d6bc254d2af1bc5..606748ec68990e4e190dcd107f0a9ec566a00748 100644 (file)
@@ -27,5 +27,5 @@
 # error "Feature-test macro for clamp has wrong value"
 #endif
 
-static_assert(std::clamp(2, 0, 1) == 1, "");
-static_assert(std::clamp(2, 0, 1, std::greater<int>()) == 0, "");
+static_assert(std::clamp(2, 0, 1) == 1);
+static_assert(std::clamp(2, 1, 0, std::greater<int>()) == 1);