diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 05:51:25 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 05:51:25 +0000 |
commit | 45d107fa502c8733988f83cd8e1634c6d56b29c6 (patch) | |
tree | d1692370fb48aefef0e38c28b85874f49fe24af4 | |
parent | c5f4da0cacfa4f82c19e527abc207d55ddbb9452 (diff) | |
download | ATCD-45d107fa502c8733988f83cd8e1634c6d56b29c6.tar.gz |
.
-rw-r--r-- | ChangeLog-99b | 3 | ||||
-rw-r--r-- | tests/Env_Value_Test.cpp | 10 | ||||
-rw-r--r-- | tests/Hash_Map_Manager_Test.cpp | 66 | ||||
-rw-r--r-- | tests/Map_Manager_Test.cpp | 11 |
4 files changed, 49 insertions, 41 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index 726fd50ca56..330b191c59c 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,5 +1,8 @@ Mon Jun 7 00:11:00 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * tests/Hash_Map_Manager_Test.cpp: Changed the use of ASYS_TCHAR * + to LPCTSTR to ensure const-correctness. + * netsvcs/lib: Reformatted all the *.h files to conform to the ACE programming guidelines. diff --git a/tests/Env_Value_Test.cpp b/tests/Env_Value_Test.cpp index 9147e71d335..44a9c94e80a 100644 --- a/tests/Env_Value_Test.cpp +++ b/tests/Env_Value_Test.cpp @@ -10,7 +10,7 @@ // working correctly. // // = AUTHOR -// Chris Cleeland +// Chris Cleeland <cleeland@cs.wustl.edu> // // ============================================================================ @@ -101,8 +101,8 @@ main (int argc, LPTSTR [], LPTSTR envp[]) TEST_THIS (short, "TEST_VALUE_NEGATIVE", 0, -10); TEST_THIS (unsigned short, "TEST_VALUE_NEGATIVE", 0, (unsigned short) -10); - char *defstr = "Sarah Cleeland is Two!"; - ACE_Env_Value<char *> sval ("This_Shouldnt_Be_Set_Hopefully", + const char *defstr = "Sarah Cleeland is Two!"; + ACE_Env_Value<const char *> sval ("This_Shouldnt_Be_Set_Hopefully", defstr); ACE_ASSERT (ACE_OS::strcmp (sval, defstr) == 0); ACE_END_TEST; @@ -110,7 +110,7 @@ main (int argc, LPTSTR [], LPTSTR envp[]) return 0; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Env_Value<char*>; + template class ACE_Env_Value<const char*>; # if !defined (ACE_LACKS_FLOATING_POINT) template class ACE_Env_Value<double>; # endif /* ! ACE_LACKS_FLOATING_POINT */ @@ -120,7 +120,7 @@ main (int argc, LPTSTR [], LPTSTR envp[]) template class ACE_Env_Value<unsigned short>; template class ACE_Env_Value<unsigned long>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# pragma instantiate ACE_Env_Value<char*> +# pragma instantiate ACE_Env_Value<const char*> # if !defined (ACE_LACKS_FLOATING_POINT) # pragma instantiate ACE_Env_Value<double> # endif /* ! ACE_LACKS_FLOATING_POINT */ diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp index 3554abe784e..8e91fe5eba7 100644 --- a/tests/Hash_Map_Manager_Test.cpp +++ b/tests/Hash_Map_Manager_Test.cpp @@ -15,7 +15,8 @@ // conjunction with the <ACE_Hash_Map_Manager>. // // = AUTHOR -// James Hu and Douglas C. Schmidt +// James Hu <jxh@cs.wustl.edu> and +// Douglas C. Schmidt <schmidt@cs.wustl.edu> // // ============================================================================ @@ -31,25 +32,25 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ -typedef ACE_Hash_Map_Entry<ASYS_TCHAR *, - ASYS_TCHAR *> HASH_STRING_ENTRY; +typedef ACE_Hash_Map_Entry<LPCTSTR, + LPCTSTR> HASH_STRING_ENTRY; -typedef ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, - ASYS_TCHAR *, - ACE_Hash<ASYS_TCHAR *>, - ACE_Equal_To<ASYS_TCHAR *>, +typedef ACE_Hash_Map_Manager_Ex<LPCTSTR, + LPCTSTR, + ACE_Hash<LPCTSTR>, + ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> HASH_STRING_MAP; -typedef ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, - ASYS_TCHAR *, - ACE_Hash<ASYS_TCHAR *>, - ACE_Equal_To<ASYS_TCHAR *>, +typedef ACE_Hash_Map_Iterator_Ex<LPCTSTR, + LPCTSTR, + ACE_Hash<LPCTSTR>, + ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> HASH_STRING_ITER; -typedef ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, - ASYS_TCHAR *, - ACE_Hash<ASYS_TCHAR *>, - ACE_Equal_To<ASYS_TCHAR *>, +typedef ACE_Hash_Map_Reverse_Iterator_Ex<LPCTSTR, + LPCTSTR, + ACE_Hash<LPCTSTR>, + ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> HASH_STRING_REVERSE_ITER; struct String_Table @@ -84,7 +85,8 @@ static const size_t MAX_HASH = 6; // @@ The following requires too much internal implementation // information about the <ACE_Hash_Map_Manager>. We need to figure // out how to simplify this. -static const size_t String_Table_size = sizeof (HASH_STRING_ENTRY) * (STRING_TABLE_SIZE + MAX_HASH); +static const size_t String_Table_size = + sizeof (HASH_STRING_ENTRY) * (STRING_TABLE_SIZE + MAX_HASH); static ACE_Static_Allocator<String_Table_size> alloc; static int @@ -105,7 +107,7 @@ run_test (void) ASYS_TEXT ("bind"), string_table[i].key_), -1); - ASYS_TCHAR *entry; + LPCTSTR entry; // Check the <find> operation. for (i = 0; string_table[i].key_ != 0; i++) @@ -123,7 +125,7 @@ run_test (void) // Check the <trybind> operation. { - ASYS_TCHAR *pc = string_table[1].value_; + LPCTSTR pc = string_table[1].value_; if (hash.trybind (string_table[0].key_, pc) != 1) ACE_ERROR_RETURN ((LM_ERROR, @@ -147,8 +149,8 @@ run_test (void) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("iterating (%d): [%s, %s]\n"), i, - (ASYS_TCHAR *) entry->ext_id_, - (ASYS_TCHAR *) entry->int_id_)); + (LPCTSTR) entry->ext_id_, + (LPCTSTR) entry->int_id_)); i++; } } @@ -181,8 +183,8 @@ run_test (void) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("iterating (%d): [%s, %s]\n"), i, - (ASYS_TCHAR *) entry->ext_id_, - (ASYS_TCHAR *) entry->int_id_)); + (LPCTSTR) entry->ext_id_, + (LPCTSTR) entry->int_id_)); i++; } } @@ -204,17 +206,17 @@ main (int, ASYS_TCHAR *[]) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<ASYS_TCHAR *, ASYS_TCHAR *>; -template class ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<LPCTSTR, LPCTSTR>; +template class ACE_Hash_Map_Manager_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex>; template class ACE_Static_Allocator<String_Table_size>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<ASYS_TCHAR *, ASYS_TCHAR *> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, ASYS_TCHAR *, ACE_Hash<ASYS_TCHAR *>, ACE_Equal_To<ASYS_TCHAR *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<LPCTSTR, LPCTSTR> +#pragma instantiate ACE_Hash_Map_Manager_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<LPCTSTR, LPCTSTR, ACE_Hash<LPCTSTR>, ACE_Equal_To<LPCTSTR>, ACE_Null_Mutex> #pragma instantiate ACE_Static_Allocator<String_Table_size> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp index a40acf9e419..70dcf6cb412 100644 --- a/tests/Map_Manager_Test.cpp +++ b/tests/Map_Manager_Test.cpp @@ -129,7 +129,7 @@ test_active_map_manager (size_t table_size, ACE_ASSERT (map.current_size () == remaining_entries); } - delete[] active_keys; + delete [] active_keys; } static void @@ -552,11 +552,14 @@ run_test (void (*ptf) (size_t, size_t, int), timer.elapsed_time (et); - ASYS_TCHAR *test_iterators_string = 0; + LPCTSTR test_iterators_string = 0; + if (test_iterators) - test_iterators_string = ASYS_TEXT ("includes executing iterators"); + test_iterators_string = + ASYS_TEXT ("includes executing iterators"); else - test_iterators_string = ASYS_TEXT ("doesn't include executing iterators"); + test_iterators_string = + ASYS_TEXT ("doesn't include executing iterators"); ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("time to test a map of size %d for %d iterations using %s (%s)\n"), |