test prevector::swap
- add a swap operation to prevector tests (fails due to broken prevector::swap) - fix 2 prevector test operation conditions that were impossible (cherry picked from commit 4ed41a2b611dfd328fe6f72312d6c596650f03f8)
This commit is contained in:
parent
d5844a45d5
commit
6e582e2792
|
@ -20,9 +20,11 @@ template<unsigned int N, typename T>
|
||||||
class prevector_tester {
|
class prevector_tester {
|
||||||
typedef std::vector<T> realtype;
|
typedef std::vector<T> realtype;
|
||||||
realtype real_vector;
|
realtype real_vector;
|
||||||
|
realtype real_vector_alt;
|
||||||
|
|
||||||
typedef prevector<N, T> pretype;
|
typedef prevector<N, T> pretype;
|
||||||
pretype pre_vector;
|
pretype pre_vector;
|
||||||
|
pretype pre_vector_alt;
|
||||||
|
|
||||||
typedef typename pretype::size_type Size;
|
typedef typename pretype::size_type Size;
|
||||||
FastRandomContext rand_cache;
|
FastRandomContext rand_cache;
|
||||||
|
@ -152,6 +154,12 @@ public:
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swap() {
|
||||||
|
real_vector.swap(real_vector_alt);
|
||||||
|
pre_vector.swap(pre_vector_alt);
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
|
||||||
prevector_tester() {
|
prevector_tester() {
|
||||||
seed_insecure_rand();
|
seed_insecure_rand();
|
||||||
rand_cache = insecure_rand_ctx;
|
rand_cache = insecure_rand_ctx;
|
||||||
|
@ -211,12 +219,15 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
|
||||||
if (test.size() > 0) {
|
if (test.size() > 0) {
|
||||||
test.update(insecure_rand() % test.size(), insecure_rand());
|
test.update(insecure_rand() % test.size(), insecure_rand());
|
||||||
}
|
}
|
||||||
if (((r >> 11) & 1024) == 11) {
|
if (((r >> 11) % 1024) == 11) {
|
||||||
test.clear();
|
test.clear();
|
||||||
}
|
}
|
||||||
if (((r >> 21) & 512) == 12) {
|
if (((r >> 21) % 512) == 12) {
|
||||||
test.assign(insecure_rand() % 32, insecure_rand());
|
test.assign(insecure_rand() % 32, insecure_rand());
|
||||||
}
|
}
|
||||||
|
if (((r >> 15) % 64) == 3) {
|
||||||
|
test.swap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue