test_hash_resize.h

00001 /***********************************************************************************
00002         test_hash_resize.h
00003         
00004  * Copyright (c) 1997
00005  * Mark of the Unicorn, Inc.
00006  *
00007  * Permission to use, copy, modify, distribute and sell this software
00008  * and its documentation for any purpose is hereby granted without fee,
00009  * provided that the above copyright notice appear in all copies and
00010  * that both that copyright notice and this permission notice appear
00011  * in supporting documentation.  Mark of the Unicorn makes no
00012  * representations about the suitability of this software for any
00013  * purpose.  It is provided "as is" without express or implied warranty.
00014                 
00015 ***********************************************************************************/
00016 #ifndef test_hash_resize__
00017 #define test_hash_resize__
00018 
00019 #include "random_number.h"
00020 #include "nc_alloc.h"
00021 
00022 template <class T>
00023 struct test_hash_resize
00024 {
00025     test_hash_resize()
00026     {
00027             gTestController.SetCurrentTestName("hash resize");
00028     }
00029     
00030         void operator()( T& t ) const
00031         {
00032                 t.resize( 1+random_number(random_base) + t.bucket_count() );
00033         }
00034 };
00035 
00036 template <class T>
00037 struct test_construct_iter_range_n
00038 {
00039         test_construct_iter_range_n( const T& src )
00040                 : fItems( src )
00041         {
00042         gTestController.SetCurrentTestName("iterator range n-size constructor");
00043     }
00044         
00045         void operator()( int ) const
00046         {
00047                 T t( fItems.begin(), fItems.end(), fItems.size() );
00048                 // prevent simulated failures during verification
00049                 gTestController.CancelFailureCountdown();
00050                 CheckInvariant(t);
00051         }
00052         
00053         const T& fItems;
00054 };
00055 
00056 #endif //__test_hash_resize__

Generated on Mon Jun 5 10:20:48 2006 for Intelligence.kdevelop by  doxygen 1.4.6