mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
// max_element(Iter first, Iter last);
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -40,7 +43,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
|
@@ -16,11 +16,14 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -42,7 +45,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
|
@@ -15,10 +15,13 @@
|
||||
// min_element(Iter first, Iter last);
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -40,7 +43,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
|
@@ -16,11 +16,14 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -42,7 +45,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
|
@@ -15,10 +15,13 @@
|
||||
// minmax_element(Iter first, Iter last);
|
||||
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -46,7 +49,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
@@ -66,7 +69,7 @@ test()
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = 5;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N));
|
||||
assert(base(p.first) == a);
|
||||
assert(base(p.second) == a+N-1);
|
||||
|
@@ -16,11 +16,14 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "test_iterators.h"
|
||||
|
||||
std::mt19937 randomness;
|
||||
|
||||
template <class Iter>
|
||||
void
|
||||
test(Iter first, Iter last)
|
||||
@@ -50,7 +53,7 @@ test(int N)
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = i;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
test(Iter(a), Iter(a+N));
|
||||
delete [] a;
|
||||
}
|
||||
@@ -70,7 +73,7 @@ test()
|
||||
int* a = new int[N];
|
||||
for (int i = 0; i < N; ++i)
|
||||
a[i] = 5;
|
||||
std::random_shuffle(a, a+N);
|
||||
std::shuffle(a, a+N, randomness);
|
||||
typedef std::greater<int> Compare;
|
||||
Compare comp;
|
||||
std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N), comp);
|
||||
|
Reference in New Issue
Block a user