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: r253053
This commit is contained in:
parent
f7d5449279
commit
6445b688e5
@ -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>
|
2017-09-20 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
Backport from mainline
|
Backport from mainline
|
||||||
|
@ -30,12 +30,12 @@ void test01()
|
|||||||
VERIFY( y == 3 );
|
VERIFY( y == 3 );
|
||||||
VERIFY( z == 4 );
|
VERIFY( z == 4 );
|
||||||
|
|
||||||
const int xc = std::clamp(1, 2, 4, std::greater<int>());
|
const int xc = std::clamp(1, 4, 2, std::greater<int>());
|
||||||
const int yc = std::clamp(3, 2, 4, std::greater<int>());
|
const int yc = std::clamp(3, 4, 2, std::greater<int>());
|
||||||
const int zc = std::clamp(5, 2, 4, std::greater<int>());
|
const int zc = std::clamp(5, 4, 2, std::greater<int>());
|
||||||
VERIFY( xc == 4 );
|
VERIFY( xc == 2 );
|
||||||
VERIFY( yc == 2 );
|
VERIFY( yc == 3 );
|
||||||
VERIFY( zc == 2 );
|
VERIFY( zc == 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -27,5 +27,5 @@
|
|||||||
# error "Feature-test macro for clamp has wrong value"
|
# error "Feature-test macro for clamp has wrong value"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static_assert(std::clamp(2, 0, 1) == 1, "");
|
static_assert(std::clamp(2, 0, 1) == 1);
|
||||||
static_assert(std::clamp(2, 0, 1, std::greater<int>()) == 0, "");
|
static_assert(std::clamp(2, 1, 0, std::greater<int>()) == 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user