From 5cb339f6d3759e566da5ee7eef5d7609570ee8f6 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 22 Nov 2006 06:31:53 +0000 Subject: Fixed a silly mistake that made the whole thing useless when using strings. --- src/tests/hash.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/tests') diff --git a/src/tests/hash.cpp b/src/tests/hash.cpp index 58e0112..2fc6968 100644 --- a/src/tests/hash.cpp +++ b/src/tests/hash.cpp @@ -58,24 +58,28 @@ int main() NULL }; - Hash sTest; + Hash sTest; printf("Inserting\n-------------------\n\n"); for( int j = 0; j < 33; j++ ) { sTest[names[j]] = j; } + + printf("Test1: %d, Test2: %d\n", sTest.has("Lemon of Troy"), sTest.has(std::string("Lemon of Troy").c_str() ) ); + + sTest.has(std::string("Lemon of Troy").c_str() ); printf("Getting\n-------------------\n\n"); sTest.erase("Homer the Great"); sTest["Bart's Comet"].erase(); - for( Hash::iterator i = sTest.begin(); + for( Hash::iterator i = sTest.begin(); i != sTest.end(); i++ ) { - Hash::iterator j = i; - printf("%d: %s\n", (*j).second, (*j).first.c_str() ); + Hash::iterator j = i; + printf("%d: %s\n", (*j).second, (*j).first ); } printf("Testing\n-------------------\n\n"); @@ -101,11 +105,12 @@ int main() sTest.clear(); - for( Hash::iterator i = sTest.begin(); + for( Hash::iterator i = sTest.begin(); i != sTest.end(); i++ ) { - Hash::iterator j = i; - printf("%d: %s\n", (*j).second, (*j).first.c_str() ); + Hash::iterator j = i; + printf("%d: %s\n", (*j).second, (*j).first ); } + } -- cgit v1.2.3