|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-05-28 19:10:38
Author: danieljames
Date: 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
New Revision: 45881
URL: http://svn.boost.org/trac/boost/changeset/45881
Log:
Make it possible to use a custom generator in more places.
Text files modified:
branches/unordered/trunk/libs/unordered/test/unordered/bucket_tests.cpp | 4 ++--
branches/unordered/trunk/libs/unordered/test/unordered/constructor_tests.cpp | 4 ++--
branches/unordered/trunk/libs/unordered/test/unordered/copy_tests.cpp | 8 ++++----
branches/unordered/trunk/libs/unordered/test/unordered/load_factor_tests.cpp | 4 ++--
branches/unordered/trunk/libs/unordered/test/unordered/move_tests.cpp | 14 +++++++-------
branches/unordered/trunk/libs/unordered/test/unordered/rehash_tests.cpp | 4 ++--
branches/unordered/trunk/libs/unordered/test/unordered/swap_tests.cpp | 18 +++++++++---------
7 files changed, 28 insertions(+), 28 deletions(-)
Modified: branches/unordered/trunk/libs/unordered/test/unordered/bucket_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/bucket_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/bucket_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -16,11 +16,11 @@
test::seed_t seed(54635);
template <class X>
-void tests(X* = 0)
+void tests(X* = 0, test::random_generator generator = test::default_generator)
{
typedef BOOST_DEDUCED_TYPENAME X::size_type size_type;
typedef BOOST_DEDUCED_TYPENAME X::const_local_iterator const_local_iterator;
- test::random_values<X> v(1000);
+ test::random_values<X> v(1000, generator);
X x(v.begin(), v.end());
Modified: branches/unordered/trunk/libs/unordered/test/unordered/constructor_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/constructor_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/constructor_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -253,12 +253,12 @@
}
template <class T>
-void map_constructor_test(T* = 0)
+void map_constructor_test(T* = 0, test::random_generator const& generator = test::default_generator)
{
std::cerr<<"map_constructor_test\n";
typedef test::list<std::pair<BOOST_DEDUCED_TYPENAME T::key_type, BOOST_DEDUCED_TYPENAME T::mapped_type> > list;
- test::random_values<T> v(1000);
+ test::random_values<T> v(1000, generator);
list l(v.begin(), v.end());
T x(l.begin(), l.end());
Modified: branches/unordered/trunk/libs/unordered/test/unordered/copy_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/copy_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/copy_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -36,7 +36,7 @@
}
{
- test::random_values<T> v(1000);
+ test::random_values<T> v(1000, generator);
T x(v.begin(), v.end());
T y(x);
@@ -50,7 +50,7 @@
// is much lower than the load factor. The hash table is not allowed
// to rehash, but the destination container should probably allocate
// enough buckets to decrease the load factor appropriately.
- test::random_values<T> v(1000);
+ test::random_values<T> v(1000, generator);
T x(v.begin(), v.end());
x.max_load_factor(x.load_factor() / 4);
T y(x);
@@ -95,7 +95,7 @@
}
{
- test::random_values<T> v(1000);
+ test::random_values<T> v(1000, generator);
T x(v.begin(), v.end(), 0, hf, eq, al);
T y(x);
@@ -106,7 +106,7 @@
}
{
- test::random_values<T> v(500);
+ test::random_values<T> v(500, generator);
T x(v.begin(), v.end(), 0, hf, eq, al);
T y(x, al2);
Modified: branches/unordered/trunk/libs/unordered/test/unordered/load_factor_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/load_factor_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/load_factor_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -34,13 +34,13 @@
}
template <class X>
-void insert_test(X*, float mlf)
+void insert_test(X*, float mlf, test::random_generator generator = test::default_generator)
{
X x;
x.max_load_factor(mlf);
float b = x.max_load_factor();
- test::random_values<X> values(1000);
+ test::random_values<X> values(1000, generator);
for(BOOST_DEDUCED_TYPENAME test::random_values<X>::const_iterator
it = values.begin(), end = values.end(); it != end; ++it)
Modified: branches/unordered/trunk/libs/unordered/test/unordered/move_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/move_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/move_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -61,7 +61,7 @@
}
{
- test::random_values<T> v(1000);
+ test::random_values<T> v(1000, generator);
test::object_count count;
T y(create(v, count));
BOOST_CHECK(count == test::global_object_count);
@@ -71,10 +71,10 @@
}
template <class T>
- void move_assign_tests1(T* ptr, test::random_generator const& generator = test::default_generator)
+ void move_assign_tests1(T*, test::random_generator const& generator = test::default_generator)
{
{
- test::random_values<T> v(500);
+ test::random_values<T> v(500, generator);
test::object_count count;
T y;
y = create(v, count);
@@ -85,7 +85,7 @@
}
template <class T>
- void move_construct_tests2(T* ptr,
+ void move_construct_tests2(T*,
test::random_generator const& generator = test::default_generator)
{
move_construct_tests1(ptr);
@@ -98,7 +98,7 @@
test::object_count count;
{
- test::random_values<T> v(500);
+ test::random_values<T> v(500, generator);
T y(create(v, count, hf, eq, al, 0.5));
BOOST_CHECK(count == test::global_object_count);
test::check_container(y, v);
@@ -111,7 +111,7 @@
{
// TODO: To do this correctly requires the fancy new allocator stuff.
- test::random_values<T> v(500);
+ test::random_values<T> v(500, generator);
T y(create(v, count, hf, eq, al, 2.0), al2);
BOOST_CHECK(count != test::global_object_count);
test::check_container(y, v);
@@ -123,7 +123,7 @@
}
{
- test::random_values<T> v(25);
+ test::random_values<T> v(25, generator);
T y(create(v, count, hf, eq, al, 1.0), al);
#if defined(BOOST_HAS_RVALUE_REFS)
BOOST_CHECK(count == test::global_object_count);
Modified: branches/unordered/trunk/libs/unordered/test/unordered/rehash_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/rehash_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/rehash_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -33,9 +33,9 @@
}
template <class X>
-void rehash_test1(X* = 0)
+void rehash_test1(X* = 0, test::random_generator generator = test::default_generator)
{
- test::random_values<X> v(1000);
+ test::random_values<X> v(1000, generator);
test::ordered<X> tracker;
tracker.insert_range(v.begin(), v.end());
X x(v.begin(), v.end());
Modified: branches/unordered/trunk/libs/unordered/test/unordered/swap_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/swap_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/swap_tests.cpp 2008-05-28 19:10:37 EDT (Wed, 28 May 2008)
@@ -32,7 +32,7 @@
}
template <class X>
-void swap_tests1(X* = 0)
+void swap_tests1(X*, test::random_generator generator = test::default_generator)
{
{
X x;
@@ -45,14 +45,14 @@
}
{
- test::random_values<X> v(1000);
+ test::random_values<X> v(1000, generator);
X x, y(v.begin(), v.end());
swap_test_impl(x, y);
swap_test_impl(x, y);
}
{
- test::random_values<X> vx(1000), vy(1000);
+ test::random_values<X> vx(1000, generator), vy(1000, generator);
X x(vx.begin(), vx.end()), y(vy.begin(), vy.end());
swap_test_impl(x, y);
swap_test_impl(x, y);
@@ -60,7 +60,7 @@
}
template <class X>
-void swap_tests2(X* ptr = 0)
+void swap_tests2(X* ptr = 0, test::random_generator generator = test::default_generator)
{
swap_tests1(ptr);
@@ -75,14 +75,14 @@
}
{
- test::random_values<X> v(1000);
+ test::random_values<X> v(1000, generator);
X x(v.begin(), v.end(), 0, hasher(1), key_equal(1));
X y(0, hasher(2), key_equal(2));
swap_test_impl(x, y);
}
{
- test::random_values<X> vx(100), vy(50);
+ test::random_values<X> vx(100, generator), vy(50, generator);
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1));
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2));
swap_test_impl(x, y);
@@ -91,7 +91,7 @@
#if BOOST_UNORDERED_SWAP_METHOD == 1
{
- test::random_values<X> vx(100), vy(50);
+ test::random_values<X> vx(100, generator), vy(50, generator);
X x(vx.begin(), vx.end(), 0, hasher(), key_equal(), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(), key_equal(), allocator_type(2));
try {
@@ -101,14 +101,14 @@
}
#else
{
- test::random_values<X> vx(50), vy(100);
+ test::random_values<X> vx(50, generator), vy(100, generator);
X x(vx.begin(), vx.end(), 0, hasher(), key_equal(), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(), key_equal(), allocator_type(2));
swap_test_impl(x, y);
}
{
- test::random_values<X> vx(100), vy(100);
+ test::random_values<X> vx(100, generator), vy(100, generator);
X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1), allocator_type(1));
X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2), allocator_type(2));
swap_test_impl(x, y);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk