aboutsummaryrefslogtreecommitdiff
path: root/src/unit/hash.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/unit/hash.cpp13
1 files changed, 13 insertions, 0 deletions
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
16private: 16private:
17 typedef Bu::Hash<Bu::FString, int> StrIntHash; 17 typedef Bu::Hash<Bu::FString, int> StrIntHash;
18 typedef Bu::Hash<Bu::FString, Bu::FString> StrStrHash; 18 typedef Bu::Hash<Bu::FString, Bu::FString> StrStrHash;
19 typedef Bu::Hash<int, Bu::FString> IntStrHash;
19 20
20public: 21public:
21 Unit() 22 Unit()
@@ -23,6 +24,7 @@ public:
23 setName("Hash"); 24 setName("Hash");
24 addTest( Unit::insert1 ); 25 addTest( Unit::insert1 );
25 addTest( Unit::insert2 ); 26 addTest( Unit::insert2 );
27 addTest( Unit::insert3 );
26 addTest( Unit::probe1 ); 28 addTest( Unit::probe1 );
27 addTest( Unit::erase1 ); 29 addTest( Unit::erase1 );
28 } 30 }
@@ -68,6 +70,17 @@ public:
68 unitTest( h3["Bye"].getValue() = "Later" ); 70 unitTest( h3["Bye"].getValue() = "Later" );
69 } 71 }
70 72
73 void insert3()
74 {
75 IntStrHash h;
76
77 for( unsigned int i=1; i<50; i++ )
78 {
79 h[i] = "testing";
80 unitTest( h.getSize() == i );
81 }
82 }
83
71 void erase1() 84 void erase1()
72 { 85 {
73 StrIntHash h; 86 StrIntHash h;