summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std')
-rw-r--r--libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp8
-rw-r--r--libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp5
-rw-r--r--libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp8
-rw-r--r--libcxx/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp4
4 files changed, 19 insertions, 6 deletions
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
index a14ccf9e5e6..e24598a9bc1 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
@@ -17,6 +17,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
int ia[] = {1, 2, 3, 4};
@@ -24,7 +26,9 @@ int main()
int ia2[] = {4, 1, 2, 3};
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
std::random_shuffle(ia, ia+sa);
- assert(std::equal(ia, ia+sa, ia1));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
std::random_shuffle(ia, ia+sa);
- assert(std::equal(ia, ia+sa, ia2));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia2));
+ assert(std::is_permutation(ia, ia+sa, ia2));
}
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
index b944c89e351..967b6e37762 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
@@ -18,6 +18,8 @@
#include <algorithm>
#include <cassert>
+#include "test_macros.h"
+
struct gen
{
int operator()(int n)
@@ -33,5 +35,6 @@ int main()
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
gen r;
std::random_shuffle(ia, ia+sa, r);
- assert(std::equal(ia, ia+sa, ia1));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
}
diff --git a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
index 343ae90101f..0c35ed73ee4 100644
--- a/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_urng.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@@ -25,7 +27,9 @@ int main()
const unsigned sa = sizeof(ia)/sizeof(ia[0]);
std::minstd_rand g;
std::shuffle(ia, ia+sa, g);
- assert(std::equal(ia, ia+sa, ia1));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia1));
+ assert(std::is_permutation(ia, ia+sa, ia1));
std::shuffle(ia, ia+sa, g);
- assert(std::equal(ia, ia+sa, ia2));
+ LIBCPP_ASSERT(std::equal(ia, ia+sa, ia2));
+ assert(std::is_permutation(ia, ia+sa, ia2));
}
diff --git a/libcxx/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp b/libcxx/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
index 426586007c1..c6d24e6334d 100644
--- a/libcxx/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.predef/default_random_engine.pass.cpp
@@ -14,9 +14,11 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
std::default_random_engine e;
e.discard(9999);
- assert(e() == 399268537u);
+ LIBCPP_ASSERT(e() == 399268537u);
}
OpenPOWER on IntegriCloud