Test inserting and constructing from input iterators.

Check thrown exception types properly.
Return by reference from 'get_key' so that the keys aren't copied.


[SVN r3115]
This commit is contained in:
Daniel James
2006-08-06 20:42:45 +00:00
parent 034b97fd23
commit 828dbe5078
9 changed files with 96 additions and 11 deletions
+10
View File
@@ -10,6 +10,7 @@
#include "../helpers/random_values.hpp"
#include "../helpers/tracker.hpp"
#include "../helpers/equivalent.hpp"
#include "../helpers/input_iterator.hpp"
#include <iostream>
@@ -204,6 +205,15 @@ void constructor_tests2(T* = 0)
test::check_container(x, v);
test::check_container(y, x);
}
std::cerr<<"Construct 8 - from input iterator\n";
{
test::random_values<T> v(100);
T x(test::input_iterator(v.begin()), test::input_iterator(v.end()), 0, hf1, eq1);
T y(test::input_iterator(x.begin()), test::input_iterator(x.end()), 0, hf2, eq2);
test::check_container(x, v);
test::check_container(y, x);
}
}
int main()
-1
View File
@@ -78,7 +78,6 @@ void erase_tests1(Container* = 0)
BOOST_TEST(next ==
(index == 0 ? x.begin() : boost::next(prev)));
BOOST_TEST(x.count(key) == count - 1);
std::cerr<<x.count(key)<<"/"<<(count - 1)<<"\n";
BOOST_TEST(x.size() == size);
}
BOOST_TEST(x.empty());
+14
View File
@@ -12,6 +12,7 @@
#include "../helpers/tracker.hpp"
#include "../helpers/equivalent.hpp"
#include "../helpers/invariants.hpp"
#include "../helpers/input_iterator.hpp"
#include <iostream>
@@ -199,6 +200,19 @@ void insert_tests2(X* = 0)
test::check_equivalent_keys(x);
}
std::cerr<<"insert input iterator range tests.\n";
{
X x;
const_iterator pos = x.begin();
test::random_values<X> v(1000);
x.insert(test::input_iterator(v.begin()), test::input_iterator(v.end()));
test::check_container(x, v);
test::check_equivalent_keys(x);
}
}
template <class X>