aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-09-21 10:59:55 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2017-09-21 10:59:55 +0100
commitf3f08c3f03f2cf096aaac5d4a24b729796e22a4b (patch)
treee537875641bb84916122c7a17b0feda401232fe6
parenta4f65ca8cb3847ff62185f535f191a4e1e46fedf (diff)
downloadgcc-f3f08c3f03f2cf096aaac5d4a24b729796e22a4b.zip
gcc-f3f08c3f03f2cf096aaac5d4a24b729796e22a4b.tar.gz
gcc-f3f08c3f03f2cf096aaac5d4a24b729796e22a4b.tar.bz2
Fix tests for std::clamp
* 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
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/clamp/1.cc12
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc4
3 files changed, 14 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9be1db7..b2a8653 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
index 991b10d..655c241 100644
--- a/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/clamp/1.cc
@@ -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
diff --git a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
index 0864b8e..606748e 100644
--- a/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/clamp/constexpr.cc
@@ -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);