From bbe8ee9de8bfbd490336d80e76148663dcbe027f Mon Sep 17 00:00:00 2001 From: David Date: Tue, 30 Dec 2008 22:07:47 +0000 Subject: david - i found a strange hash bug, and made a unit test to reproduce it ("insert3")... with a hash of type Bu::Hash, when the size of the hash reaches certain points (11, 23, 46, 94, etc...), it seems to reset itself and not have any data in it... --- src/unit/hash.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/unit') diff --git a/src/unit/hash.cpp b/src/unit/hash.cpp index 77160e3..1c873fd 100644 --- a/src/unit/hash.cpp +++ b/src/unit/hash.cpp @@ -16,6 +16,7 @@ class Unit : public Bu::UnitSuite private: typedef Bu::Hash StrIntHash; typedef Bu::Hash StrStrHash; + typedef Bu::Hash IntStrHash; public: Unit() @@ -23,6 +24,7 @@ public: setName("Hash"); addTest( Unit::insert1 ); addTest( Unit::insert2 ); + addTest( Unit::insert3 ); addTest( Unit::probe1 ); addTest( Unit::erase1 ); } @@ -68,6 +70,17 @@ public: unitTest( h3["Bye"].getValue() = "Later" ); } + void insert3() + { + IntStrHash h; + + for( unsigned int i=1; i<50; i++ ) + { + h[i] = "testing"; + unitTest( h.getSize() == i ); + } + } + void erase1() { StrIntHash h; -- cgit v1.2.3