diff options
author | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-30 19:31:23 +0000 |
---|---|---|
committer | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-12-30 19:31:23 +0000 |
commit | 787f8122255799dec288f230e9590e36f603298a (patch) | |
tree | 27e685bf77df1116adeba51ebdd3c3c2cbbe6a8f /tests | |
parent | 05ed3507e1b04a46534ed03c6c51aec23fe31450 (diff) | |
download | ATCD-787f8122255799dec288f230e9590e36f603298a.tar.gz |
Functor, RB_Tree, and pSOS fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Handle_Set_Test.cpp | 4 | ||||
-rw-r--r-- | tests/Process_Strategy_Test.cpp | 2 | ||||
-rw-r--r-- | tests/RB_Tree_Test.cpp | 104 | ||||
-rw-r--r-- | tests/Reactor_Performance_Test.cpp | 2 | ||||
-rw-r--r-- | tests/TSS_Test.cpp | 5 |
5 files changed, 44 insertions, 73 deletions
diff --git a/tests/Handle_Set_Test.cpp b/tests/Handle_Set_Test.cpp index b5a88a89c22..45875b5483d 100644 --- a/tests/Handle_Set_Test.cpp +++ b/tests/Handle_Set_Test.cpp @@ -98,7 +98,9 @@ test_boundaries (void) ACE_Handle_Set_Iterator i1 (handle_set); while ((handle = i1 ()) != ACE_INVALID_HANDLE) - ACE_ASSERT (!ASYS_TEXT ("this shouldn't get called since the set is empty!\n")); + { + ACE_ASSERT (ASYS_TEXT ("this shouldn't get called since the set is empty!\n") == 0); + } // Insert the vector of HANDLEs into the set. diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp index d4c0ed3b159..77d82b8a8bc 100644 --- a/tests/Process_Strategy_Test.cpp +++ b/tests/Process_Strategy_Test.cpp @@ -217,7 +217,7 @@ Options::parse_args (int argc, char *argv[]) -1); break; #else - ACE_ASSERT (!"PROCESS invalid on this platform"); + ACE_ASSERT ("PROCESS invalid on this platform" == 0); #endif /* !defined (ACE_LACKS_FORK) */ case Options::THREAD: #if defined (ACE_HAS_THREADS) diff --git a/tests/RB_Tree_Test.cpp b/tests/RB_Tree_Test.cpp index 5bf6f746d47..0e9c34bdf2f 100644 --- a/tests/RB_Tree_Test.cpp +++ b/tests/RB_Tree_Test.cpp @@ -10,12 +10,14 @@ // // = DESCRIPTION // This is a test to verify and illustrate the use of the ACE_RB_Tree -// and ACE_RB_Tree_Iterator classes. Two different less than comparison -// function object types are demonstrated for native key types int (for -// which the native < operator is sufficient) and char * (for which the -// native < operator is not sufficient). An RB tree for each of the four -// possible type parameter combinations over int and char * is constructed -// and filled in, and the resulting order checked via an iterator. +// and ACE_RB_Tree_Iterator classes. Two different key and item types are +// used in order to demonstrate specialization of the ACE_Less_Than +// comparison function object template: int (for which the native < +// operator is sufficient), and char * (for which < operator semantics must +// be replaced by strcmp semantics). An RB tree for each of the four +// possible type parameter permutations over int and char * is constructed +// and filled in, and the resulting order is checked via an iterator over +// each. // // = AUTHOR // Chris Gill <cdgill@cs.wustl.edu> @@ -52,33 +54,6 @@ static int str_str_index [] = {4, 2, 1, 0, 3, 6, 5, 7}; // LR preorder // Number of entries placed in each tree. static int RB_TREE_TEST_ENTRIES = 8; -class RB_Test_String_Less_Than_Functor : - public ACE_Const_Binary_Functor_Base<char *, char *> -{ - // = TITLE - // Defines a class template that allows us to invoke a binary less than - // function over two parameterized types without knowing anything about - // the function and operand objects except their types. - // - // = DESCRIPTION - // This class depends on the definition - // objects of the paramterized types. A class can invoke such - // an operation without knowing anything about it, or its implementation. - // -public: - - virtual int execute (char * const & operand1, - char * const & operand2) - {return (ACE_OS::strcmp (operand1, operand2) < 0) ? 1 : 0;} - // Invokes the function object. - - virtual ACE_Const_Binary_Functor_Base<char *, char *> * clone () - {return new RB_Test_String_Less_Than_Functor;} - // Creates another object of the same type. -}; - - - int main (int, ASYS_TCHAR *[]) { @@ -87,14 +62,13 @@ main (int, ASYS_TCHAR *[]) // Local variables used to index arrays. int i, k; - // Construct four RB_Trees, using the default comparison semantics for those - // keyed with int, and using a custom comparison function object for those - // keyed with char *. - RB_Test_String_Less_Than_Functor strcmp_functor; - ACE_RB_Tree<int, int> int_int_tree; - ACE_RB_Tree<int, char *> int_str_tree; - ACE_RB_Tree<char *, int> str_int_tree (&strcmp_functor); - ACE_RB_Tree<char *, char *> str_str_tree (&strcmp_functor); + // Construct four RB_Trees. Specialization of the ACE_Less_Than template + // for character strings performs strcmp style string comparisons rather + // than < operator comparison of the pointers themselves. + ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> int_int_tree; + ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> int_str_tree; + ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> str_int_tree; + ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> str_str_tree; // Fill in each tree with the key and item from the appropriate arrays, // using the shuffle indexes to create different insertion orders. @@ -130,10 +104,10 @@ main (int, ASYS_TCHAR *[]) } // Construct an iterator for each of the trees. - ACE_RB_Tree_Iterator<int, int> int_int_iter (int_int_tree); - ACE_RB_Tree_Iterator<int, char *> int_str_iter (int_str_tree); - ACE_RB_Tree_Iterator<char *, int> str_int_iter (str_int_tree); - ACE_RB_Tree_Iterator<char *, char *> str_str_iter (str_str_tree); + ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> int_int_iter (int_int_tree); + ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> int_str_iter (int_str_tree); + ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> str_int_iter (str_int_tree); + ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> str_str_iter (str_str_tree); // Iterate over each of the trees, making sure their entries // are in the same relative order (i.e., the integers and strings @@ -229,38 +203,30 @@ main (int, ASYS_TCHAR *[]) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Const_Binary_Functor_Base<char *, char *>; -template class ACE_Const_Binary_Functor_Base<int, int>; -template class ACE_Less_Than_Functor<char *, char *>; -template class ACE_Less_Than_Functor<int, int>; -template class ACE_RB_Tree<int, int>; +template class ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>; template class ACE_RB_Tree_Node<int, int>; -template class ACE_RB_Tree_Iterator<int, int>; -template class ACE_RB_Tree<int, char *>; +template class ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>; +template class ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>; template class ACE_RB_Tree_Node<int, char *>; -template class ACE_RB_Tree_Iterator<int, char *>; -template class ACE_RB_Tree<char *, int>; +template class ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>; +template class ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>; template class ACE_RB_Tree_Node<char *, int>; -template class ACE_RB_Tree_Iterator<char *, int>; -template class ACE_RB_Tree<char *, char *>; +template class ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>; +template class ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>; template class ACE_RB_Tree_Node<char *, char *>; -template class ACE_RB_Tree_Iterator<char *, char *>; +template class ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Const_Binary_Functor_Base<char *, char *> -#pragma instantiate ACE_Const_Binary_Functor_Base<int, int> -#pragma instantiate ACE_Less_Than_Functor<char *, char *> -#pragma instantiate ACE_Less_Than_Functor<int, int> -#pragma instantiate ACE_RB_Tree<int, int> +#pragma instantiate ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> #pragma instantiate ACE_RB_Tree_Node<int, int> -#pragma instantiate ACE_RB_Tree_Iterator<int, int> -#pragma instantiate ACE_RB_Tree<int, char *> +#pragma instantiate ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> +#pragma instantiate ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> #pragma instantiate ACE_RB_Tree_Node<int, char *> -#pragma instantiate ACE_RB_Tree_Iterator<int, char *> -#pragma instantiate ACE_RB_Tree<char *, int> +#pragma instantiate ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> +#pragma instantiate ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> #pragma instantiate ACE_RB_Tree_Node<char *, int> -#pragma instantiate ACE_RB_Tree_Iterator<char *, int> -#pragma instantiate ACE_RB_Tree<char *, char *> +#pragma instantiate ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> +#pragma instantiate ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> #pragma instantiate ACE_RB_Tree_Node<char *, char *> -#pragma instantiate ACE_RB_Tree_Iterator<char *, char *> +#pragma instantiate ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Reactor_Performance_Test.cpp b/tests/Reactor_Performance_Test.cpp index 00fbf89613e..9cd10445e21 100644 --- a/tests/Reactor_Performance_Test.cpp +++ b/tests/Reactor_Performance_Test.cpp @@ -121,7 +121,7 @@ Read_Handler::handle_close (ACE_HANDLE handle, ACE_UNUSED_ARG (close_mask); // Reduce count. - this->waiting_--; + waiting_--; // If no connections are open. if (waiting_ == 0) diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp index 676b9a27600..48b1a446488 100644 --- a/tests/TSS_Test.cpp +++ b/tests/TSS_Test.cpp @@ -174,7 +174,9 @@ worker (void *c) // types when used with ACE_TSS. See DESCRIPTION of template // class ACE_TSS_Type_Adapter in ace/Synch_T.h for what this // should look like. Unfortunately, some compilers have trouble - // with the implicit type conversions. + // with the implicit type conversions. Others have problems with + // the *explicit* type conversions. +#if !defined (ACE_HAS_BROKEN_EXPLICIT_TYPECAST_OPERATOR_INVOCATION) (*u)->operator u_int & () = 37; if ((*u)->operator u_int () != 37) { @@ -185,6 +187,7 @@ worker (void *c) ASYS_TEXT ("is %u, it should be 37!\n"), (*u)->operator u_int ())); ++errors; } +#endif /* !defined (ACE_HAS_BROKEN_EXPLICIT_TYPECAST_OPERATOR_INVOCATION) */ #if !defined (__Lynx__) || defined (ACE_HAS_TSS_EMULATION) key = ACE_OS::NULL_key; |