Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-01-09 06:41:13


Author: danieljames
Date: 2008-01-09 06:41:12 EST (Wed, 09 Jan 2008)
New Revision: 42634
URL: http://svn.boost.org/trac/boost/changeset/42634

Log:
Add more tests to simple_test.
Text files modified:
   branches/unordered/trunk/libs/unordered/test/unordered/simple_tests.cpp | 27 +++++++++++++++++++++++++--
   1 files changed, 25 insertions(+), 2 deletions(-)

Modified: branches/unordered/trunk/libs/unordered/test/unordered/simple_tests.cpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/unordered/simple_tests.cpp (original)
+++ branches/unordered/trunk/libs/unordered/test/unordered/simple_tests.cpp 2008-01-09 06:41:12 EST (Wed, 09 Jan 2008)
@@ -51,8 +51,8 @@
         BOOST_TEST(b.empty());
         BOOST_TEST(equivalent(c));
         b.swap(c);
- BOOST_TEST(b.empty());
- BOOST_TEST(equivalent(c));
+ BOOST_TEST(c.empty());
+ BOOST_TEST(equivalent(b));
     }
 
     {
@@ -84,20 +84,43 @@
 
 int main()
 {
+ using namespace std;
+ srand(14878);
+
     std::cout<<"Test unordered_set.\n";
     boost::unordered_set<int> set;
     simple_test(set);
+
+ set.insert(1); set.insert(2); set.insert(1456);
+ simple_test(set);
 
     std::cout<<"Test unordered_multiset.\n";
     boost::unordered_multiset<int> multiset;
     simple_test(multiset);
     
+ for(int i1 = 0; i1 < 1000; ++i1) {
+ int count = rand() % 10, index = rand();
+ for(int j = 0; j < count; ++j)
+ multiset.insert(index);
+ }
+ simple_test(multiset);
+
     std::cout<<"Test unordered_map.\n";
     boost::unordered_map<int, int> map;
+
+ for(int i2 = 0; i2 < 1000; ++i2) {
+ map.insert(std::pair<const int, int>(rand(), rand()));
+ }
     simple_test(map);
 
     std::cout<<"Test unordered_multimap.\n";
     boost::unordered_multimap<int, int> multimap;
+
+ for(int i3 = 0; i3 < 1000; ++i3) {
+ int count = rand() % 10, index = rand();
+ for(int j = 0; j < count; ++j)
+ multimap.insert(std::pair<const int, int>(index, rand()));
+ }
     simple_test(multimap);
 
     return boost::report_errors();


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