summaryrefslogtreecommitdiff
path: root/src/tests/hash.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/hash.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/tests/hash.cpp b/src/tests/hash.cpp
index 8406439..f9a8f12 100644
--- a/src/tests/hash.cpp
+++ b/src/tests/hash.cpp
@@ -67,11 +67,9 @@ int main()
67 } 67 }
68 68
69 printf("Getting\n-------------------\n\n"); 69 printf("Getting\n-------------------\n\n");
70 printf("%d\n", sTest.get( names[10] ) ); 70
71 printf("%d\n", (int)sTest[names[10]] ); 71 sTest.erase("Homer the Great");
72 sTest[names[10]] = 22; 72 sTest["Bart's Comet"].erase();
73 sTest["That one guy"] = 135;
74 printf("%d\n", (int)sTest[names[10]] );
75 73
76 for( Hash<std::string, int>::iterator i = sTest.begin(); 74 for( Hash<std::string, int>::iterator i = sTest.begin();
77 i != sTest.end(); i++ ) 75 i != sTest.end(); i++ )
@@ -79,5 +77,23 @@ int main()
79 Hash<std::string, int>::iterator j = i; 77 Hash<std::string, int>::iterator j = i;
80 printf("%d: %s\n", (*j).second, (*j).first.c_str() ); 78 printf("%d: %s\n", (*j).second, (*j).first.c_str() );
81 } 79 }
80
81 for( int j = 0; j < 33; j++ )
82 {
83 if( sTest[names[j]].isFilled() )
84 {
85 if( sTest[names[j]] != j )
86 {
87 printf("'%s' should be %d, is %d\n",
88 names[j], j,
89 sTest[names[j]].value()
90 );
91 }
92 }
93 else
94 {
95 printf("Missing element %d, '%s'\n", j, names[j] );
96 }
97 }
82} 98}
83 99