diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-09-30 22:14:36 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-09-30 22:14:36 +0000 |
commit | 162d9c6897a34453c8e8c1cdd531e54e763206e0 (patch) | |
tree | 3b2b0b4b6216c554f741c4a8fa2033e9a1dfcf0e /tests | |
parent | a9cd6e9d6c9a2cb59bf877f0111bb0f860463dfe (diff) | |
download | ATCD-162d9c6897a34453c8e8c1cdd531e54e763206e0.tar.gz |
Added some code to test the Hash_Map_Manager_Iterator. This is to
show Bob Laferriere that it works.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Hash_Map_Manager_Test.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp index 196b1f0a12d..2d5635498ae 100644 --- a/tests/Hash_Map_Manager_Test.cpp +++ b/tests/Hash_Map_Manager_Test.cpp @@ -27,6 +27,7 @@ #define HASH_STRING_ENTRY ACE_Hash_Map_Entry<char *, char *> #define HASH_STRING_MAP ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> +#define HASH_STRING_ITER ACE_Hash_Map_Iterator<char *, char *, ACE_Null_Mutex> #define MAP_STRING char * #define ENTRY entry @@ -72,6 +73,8 @@ HASH_STRING_MAP::equal (char *const &id1, char *const &id2) #define HASH_STRING_ENTRY ACE_Hash_Map_Entry<Dumb_String, Dumb_String> #define HASH_STRING_MAP \ ACE_Hash_Map_Manager<Dumb_String, Dumb_String, ACE_Null_Mutex> +#define HASH_STRING_ITER \ + ACE_Hash_Map_Iterator<Dumb_String, Dumb_String, ACE_Null_Mutex> #define MAP_STRING Dumb_String #define ENTRY ((char *)entry) @@ -161,6 +164,16 @@ main (int, char *[]) if (hash.find ("funny", entry) == 0) ACE_DEBUG ((LM_DEBUG, "`%s' found `%s'\n", "funny", ENTRY)); + // Let's test the iterator while we are at it. + { + HASH_STRING_ENTRY *i; + for (HASH_STRING_ITER hash_iter (hash); + hash_iter.next (i); + hash_iter.advance ()) + ACE_DEBUG ((LM_DEBUG, "iterating: [%s, %s]\n", + i->ext_id_, i->int_id_)); + } + hash.unbind ("goodbye", entry); if (hash.find ("hello", entry) == 0) @@ -169,6 +182,16 @@ main (int, char *[]) ACE_DEBUG ((LM_DEBUG, "OOPS! `%s' found `%s'\n", "goodbye", ENTRY)); if (hash.find ("funny", entry) == 0) ACE_DEBUG ((LM_DEBUG, "`%s' found `%s'\n", "funny", ENTRY)); + + // Let's test the iterator again. + { + HASH_STRING_ENTRY *i; + for (HASH_STRING_ITER hash_iter (hash); + hash_iter.next (i); + hash_iter.advance ()) + ACE_DEBUG ((LM_DEBUG, "iterating: [%s, %s]\n", + i->ext_id_, i->int_id_)); + } } ACE_END_TEST; |