diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-30 21:30:34 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-30 21:30:34 +0000 |
commit | f805f2155f7b5db820082868ab2243d3ac85bec4 (patch) | |
tree | b9e06617a92f1d064cd4e4334ea399fea1038b3e /tests/Cache_Map_Manager_Test.cpp | |
parent | de043e93a0f57306b808e752286e62c1f7e9e7f6 (diff) | |
download | ATCD-f805f2155f7b5db820082868ab2243d3ac85bec4.tar.gz |
Removed VxWorks warnings
Diffstat (limited to 'tests/Cache_Map_Manager_Test.cpp')
-rw-r--r-- | tests/Cache_Map_Manager_Test.cpp | 134 |
1 files changed, 70 insertions, 64 deletions
diff --git a/tests/Cache_Map_Manager_Test.cpp b/tests/Cache_Map_Manager_Test.cpp index b17725d3a19..8cf39463d14 100644 --- a/tests/Cache_Map_Manager_Test.cpp +++ b/tests/Cache_Map_Manager_Test.cpp @@ -47,37 +47,37 @@ typedef ACE_Hash<KEY> HASH_KEY; typedef ACE_Equal_To<KEY> COMPARE_KEYS; typedef ACE_Hash_Map_Manager_Ex<KEY, CACHE_VALUE, ACE_Hash<KEY>, ACE_Equal_To<KEY>, ACE_Null_Mutex> - HASH_MAP_MANAGER; + HASH_MAP_MANAGER; typedef ACE_Hash_Map_Iterator_Ex<KEY, CACHE_VALUE, ACE_Hash<KEY>, ACE_Equal_To<KEY>, ACE_Null_Mutex> - HASH_MAP_MANAGER_ITERATOR; + HASH_MAP_MANAGER_ITERATOR; typedef ACE_Map_Manager<KEY, CACHE_VALUE, ACE_Null_Mutex> - MAP_MANAGER; + MAP_MANAGER; typedef ACE_Map_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex> - MAP_MANAGER_ITERATOR; + MAP_MANAGER_ITERATOR; typedef ACE_Map_Reverse_Iterator<KEY, CACHE_VALUE, ACE_Null_Mutex> - MAP_MANAGER_REVERSE_ITERATOR; + MAP_MANAGER_REVERSE_ITERATOR; typedef ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, HASH_MAP_MANAGER, HASH_MAP_MANAGER_ITERATOR, ATTR> - HASH_MAP_CACHING_UTILITY; + HASH_MAP_CACHING_UTILITY; typedef ACE_Pair_Caching_Utility<KEY, CACHE_VALUE, MAP_MANAGER, MAP_MANAGER_ITERATOR, ATTR> - MAP_CACHING_UTILITY; + MAP_CACHING_UTILITY; typedef ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, HASH_MAP_MANAGER, ATTR, HASH_MAP_CACHING_UTILITY> - HASH_MAP_LRU; + HASH_MAP_LRU; typedef ACE_LRU_Caching_Strategy<KEY, CACHE_VALUE, MAP_MANAGER, ATTR, MAP_CACHING_UTILITY> - MAP_LRU; + MAP_LRU; typedef ACE_Hash_Cache_Map_Manager<KEY, VALUE, ACE_Hash<KEY>, ACE_Equal_To<KEY>, HASH_MAP_LRU, ATTR> - HASH_MAP_CACHE; + HASH_MAP_CACHE; typedef ACE_Cache_Map_Manager<KEY, VALUE, MAP_MANAGER, MAP_MANAGER_ITERATOR, MAP_MANAGER_REVERSE_ITERATOR, MAP_LRU, ATTR> - MAP_CACHE; + MAP_CACHE; static size_t iterations = ACE_MAX_ITERATIONS; static size_t no_of_lookups = iterations / 2; @@ -97,16 +97,16 @@ run_iterator_cache (MAP_CACHE &cache) { // Debugging info. ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%d|%d)"), - (*iter).first (), - (*iter).second ())); + ASYS_TEXT ("(%d|%d)"), + (*iter).first (), + (*iter).second ())); ACE_ASSERT ((*iter).first () == (*iter).second ()); ++counter; } ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\n"))); + ASYS_TEXT ("\n"))); ACE_UNUSED_ARG (iterations); ACE_ASSERT (counter == iterations); @@ -125,16 +125,16 @@ run_iterator_hash_cache (HASH_MAP_CACHE &cache) { // Debugging info. ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%d|%d)"), - (*iter).first (), - (*iter).second ())); + ASYS_TEXT ("(%d|%d)"), + (*iter).first (), + (*iter).second ())); ACE_ASSERT ((*iter).first () == (*iter).second ()); ++counter; } ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\n"))); + ASYS_TEXT ("\n"))); ACE_UNUSED_ARG (iterations); ACE_ASSERT (counter == iterations); @@ -154,14 +154,14 @@ run_reverse_iterator_cache (MAP_CACHE &cache) // Debugging info. ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%d|%d)"), - (*iter).first (), - (*iter).second ())); + ASYS_TEXT ("(%d|%d)"), + (*iter).first (), + (*iter).second ())); --counter; } ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\n"))); + ASYS_TEXT ("\n"))); ACE_ASSERT (counter == 0); } @@ -179,14 +179,14 @@ run_reverse_iterator_hash_cache (HASH_MAP_CACHE &cache) // Debugging info. ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%d|%d)"), - (*iter).first (), - (*iter).second ())); + ASYS_TEXT ("(%d|%d)"), + (*iter).first (), + (*iter).second ())); --counter; } ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("\n"))); + ASYS_TEXT ("\n"))); ACE_ASSERT (counter == 0); } @@ -201,7 +201,7 @@ find_test_cache (MAP_CACHE &cache) { KEY key = i; if (randomize_lookups != 0) - key = ACE_OS::rand () % total_entries; + key = ACE_OS::rand () % total_entries; VALUE j; int result = cache.find (key, j); @@ -210,8 +210,8 @@ find_test_cache (MAP_CACHE &cache) ACE_ASSERT (j == key); ACE_DEBUG ((LM_DEBUG, - "%d ", - j)); + "%d ", + j)); } ACE_DEBUG ((LM_DEBUG, "\n")); @@ -228,7 +228,7 @@ find_test_hash_cache (HASH_MAP_CACHE &cache) { KEY key = i; if (randomize_lookups != 0) - key = ACE_OS::rand () % total_entries; + key = ACE_OS::rand () % total_entries; VALUE j; int result = cache.find (key, j); @@ -237,8 +237,8 @@ find_test_hash_cache (HASH_MAP_CACHE &cache) ACE_ASSERT (j == key); ACE_DEBUG ((LM_DEBUG, - "%d ", - j)); + "%d ", + j)); } ACE_DEBUG ((LM_DEBUG, "\n")); @@ -260,14 +260,18 @@ purge_test_cache (MAP_CACHE &cache) int result = cache.purge (); ACE_ASSERT (result != -1); + size_t resultant_size = current_map_size - entries_to_remove; + ACE_UNUSED_ARG (resultant_size); + // Make sure the purge took out the appropriate number of entries. - ACE_ASSERT (cache.current_size () == - current_map_size - entries_to_remove); + ACE_ASSERT (cache.current_size () == resultant_size); } static void purge_test_hash_cache (HASH_MAP_CACHE &cache) { + + // Get the number of entries in the container. size_t current_map_size = cache.current_size (); @@ -281,9 +285,11 @@ purge_test_hash_cache (HASH_MAP_CACHE &cache) int result = cache.purge (); ACE_ASSERT (result != -1); + size_t resultant_size = current_map_size - entries_to_remove; + ACE_UNUSED_ARG (resultant_size); + // Make sure the purge took out the appropriate number of entries. - ACE_ASSERT (cache.current_size () == - current_map_size - entries_to_remove); + ACE_ASSERT (cache.current_size () == resultant_size); } static void @@ -302,7 +308,7 @@ functionality_test_cache (void) int result = cache.bind (i, j); ACE_ASSERT (result != -1); ACE_DEBUG ((LM_DEBUG, "keys[%d]=%d value=[%d]=%d\n", - i, i, j, j)); + i, i, j, j)); ++counter; ACE_ASSERT (cache.current_size () == counter); } @@ -313,12 +319,12 @@ functionality_test_cache (void) find_test_cache (cache); ACE_DEBUG ((LM_DEBUG, - "Number of entries in cache before purging : %d\n", - cache.current_size ())); + "Number of entries in cache before purging : %d\n", + cache.current_size ())); purge_test_cache (cache); ACE_DEBUG ((LM_DEBUG, - "Number of entries in cache after purging : %d\n", - cache.current_size ())); + "Number of entries in cache after purging : %d\n", + cache.current_size ())); run_iterator_cache (cache); run_reverse_iterator_cache (cache); @@ -340,8 +346,8 @@ functionality_test_hash_cache (void) int result = cache.bind (i, j); ACE_ASSERT (result != -1); ACE_DEBUG ((LM_DEBUG, - "keys[%d]=%d value=[%d]=%d\n", - i, i, j, j)); + "keys[%d]=%d value=[%d]=%d\n", + i, i, j, j)); ++counter; ACE_ASSERT (cache.current_size () == counter); } @@ -352,12 +358,12 @@ functionality_test_hash_cache (void) find_test_hash_cache (cache); ACE_DEBUG ((LM_DEBUG, - "Number of entries in cache before purging : %d\n", - cache.current_size ())); + "Number of entries in cache before purging : %d\n", + cache.current_size ())); purge_test_hash_cache (cache); ACE_DEBUG ((LM_DEBUG, - "Number of entries in cache after purging : %d\n", - cache.current_size ())); + "Number of entries in cache after purging : %d\n", + cache.current_size ())); run_iterator_hash_cache (cache); run_reverse_iterator_hash_cache (cache); @@ -374,28 +380,28 @@ parse_args (int argc, char *argv[]) switch (c) { case 'i': - iterations = atoi (get_opt.optarg); - break; + iterations = atoi (get_opt.optarg); + break; case 'f': - no_of_lookups = atoi (get_opt.optarg); - break; + no_of_lookups = atoi (get_opt.optarg); + break; case 'r': - randomize_lookups = atoi (get_opt.optarg); - break; + randomize_lookups = atoi (get_opt.optarg); + break; case 'p': - purge_percent = atoi (get_opt.optarg); - break; + purge_percent = atoi (get_opt.optarg); + break; case '?': case 'h': default: - ACE_ERROR ((LM_ERROR, - "usage: %s " - "[-r (randomize lookups)] " - "[-i (iterations)] " - "[-p (purge percent)] " - "[-f (number of lookups)] \n", - argv[0])); - return -1; + ACE_ERROR ((LM_ERROR, + "usage: %s " + "[-r (randomize lookups)] " + "[-i (iterations)] " + "[-p (purge percent)] " + "[-f (number of lookups)] \n", + argv[0])); + return -1; } return 0; |