diff options
author | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-11 17:11:04 +0000 |
---|---|---|
committer | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-11 17:11:04 +0000 |
commit | 7aabf4896a44f2184e60ca21462c2511b5278bd6 (patch) | |
tree | fc22ea45dd1de938eae2e2a58d1980236f70eeae | |
parent | 1fff2a23c345b20d5f9ca05c6bec674e5bc095fd (diff) | |
download | ATCD-7aabf4896a44f2184e60ca21462c2511b5278bd6.tar.gz |
factored out RB_Tree test class template into a header file
-rw-r--r-- | ChangeLog-99b | 5 | ||||
-rw-r--r-- | tests/RB_Tree_Test.cpp | 85 | ||||
-rw-r--r-- | tests/RB_Tree_Test.h | 104 |
3 files changed, 110 insertions, 84 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index f57de45a436..6ba4fe2c5f8 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,8 @@ +Fri Jun 11 12:10:00 1999 Chris Gill <cdgill@cs.wustl.edu> + + * tests/RB_Tree_Test.{cpp, h (new)}: factored out class template + declaration into a .h file to make AIX C++ happy. + Fri Jun 11 10:43:51 1999 David L. Levine <levine@cs.wustl.edu> * ace/config-sunos5.5.h: properly reverted all the changes of today. diff --git a/tests/RB_Tree_Test.cpp b/tests/RB_Tree_Test.cpp index e6099121ebc..0ee92282087 100644 --- a/tests/RB_Tree_Test.cpp +++ b/tests/RB_Tree_Test.cpp @@ -28,6 +28,7 @@ #include "test_config.h" /* Include first to enable ACE_ASSERT. */ #include "ace/RB_Tree.h" +#include "RB_Tree_Test.h" ACE_RCSID(tests, RB_Tree_Test, "$Id$") @@ -36,90 +37,6 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ -template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> -class ACE_RB_Tree_Test -{ - // = TITLE - // Implements a templatized test class for the RB_Tree ADT and its - // iterators. - // - // = DESCRIPTION - - // To run the test class on a particular type instantiation of the - // RB_Tree, simply instantiate the test class template with the - // same type parameters, and invoke the run_test method. -public: - // = Traits - - typedef ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> - TREE; - typedef ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> - ITERATOR; - typedef ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> - REVERSE_ITERATOR; - - // = Initialization and termination methods. - - ACE_RB_Tree_Test (int entry_count, - EXT_ID key_array [], - INT_ID item_array [], - int order_index []); - // Constructor. - - ~ACE_RB_Tree_Test (void); - // Destructor. - - void run_test (void); - // Run the individual interface and iteration tests in order. - -private: - - void test_tree_insertion (void); - // Tests stable and deprecated insertion interfaces. - - void test_post_insertion_iteration (void); - // Tests forward and reverse iteration after insertion in both - // trees. - - void test_tree_deletion (void); - // Tests stable and deprecated deletion interfaces. - - void test_post_deletion_iteration (void); - // Tests forward and reverse iteration after deletions in both - // trees. - - TREE stable_tree_; - // Tree for testing stable interface. - - ITERATOR stable_fwd_iter_; - // Forward iterator for tree for testing stable interface. - - REVERSE_ITERATOR stable_rev_iter_; - // Forward iterator for tree for testing stable interface. - - TREE deprecated_tree_; - // Tree for testing deprecated interface. - - ITERATOR deprecated_fwd_iter_; - // Forward iterator for tree for testing deprecated interface. - - REVERSE_ITERATOR deprecated_rev_iter_; - // Forward iterator for tree for testing deprecated interface. - - int entry_count_; - // Number of entries in the key, item, and index arrays. - - EXT_ID *key_array_; - // Array of EXT_IDs (keys) with which to test. - - INT_ID *item_array_; - // Array of INT_IDs (items) with which to test. - - int *order_index_; - // Order of indices in the key and item arrays. - -}; - // Type definitions for the four distinct parameterizations of the // test. diff --git a/tests/RB_Tree_Test.h b/tests/RB_Tree_Test.h new file mode 100644 index 00000000000..e86c34d42d4 --- /dev/null +++ b/tests/RB_Tree_Test.h @@ -0,0 +1,104 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// RB_Tree_Test.cpp +// +// = DESCRIPTION +// Header file for a test to verify and illustrate the use of the +// ACE_RB_Tree ACE_RB_Tree_Iterator, and +// ACE_RB_Tree_Reverse_Iterator classes. +// iterator over each. +// +// = AUTHOR +// Chris Gill <cdgill@cs.wustl.edu> +// +// ============================================================================ + +template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> +class ACE_RB_Tree_Test +{ + // = TITLE + // Implements a templatized test class for the RB_Tree ADT and its + // iterators. + // + // = DESCRIPTION + + // To run the test class on a particular type instantiation of the + // RB_Tree, simply instantiate the test class template with the + // same type parameters, and invoke the run_test method. +public: + // = Traits + + typedef ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> + TREE; + typedef ACE_RB_Tree_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> + ITERATOR; + typedef ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> + REVERSE_ITERATOR; + + // = Initialization and termination methods. + + ACE_RB_Tree_Test (int entry_count, + EXT_ID key_array [], + INT_ID item_array [], + int order_index []); + // Constructor. + + ~ACE_RB_Tree_Test (void); + // Destructor. + + void run_test (void); + // Run the individual interface and iteration tests in order. + +private: + + void test_tree_insertion (void); + // Tests stable and deprecated insertion interfaces. + + void test_post_insertion_iteration (void); + // Tests forward and reverse iteration after insertion in both + // trees. + + void test_tree_deletion (void); + // Tests stable and deprecated deletion interfaces. + + void test_post_deletion_iteration (void); + // Tests forward and reverse iteration after deletions in both + // trees. + + TREE stable_tree_; + // Tree for testing stable interface. + + ITERATOR stable_fwd_iter_; + // Forward iterator for tree for testing stable interface. + + REVERSE_ITERATOR stable_rev_iter_; + // Forward iterator for tree for testing stable interface. + + TREE deprecated_tree_; + // Tree for testing deprecated interface. + + ITERATOR deprecated_fwd_iter_; + // Forward iterator for tree for testing deprecated interface. + + REVERSE_ITERATOR deprecated_rev_iter_; + // Forward iterator for tree for testing deprecated interface. + + int entry_count_; + // Number of entries in the key, item, and index arrays. + + EXT_ID *key_array_; + // Array of EXT_IDs (keys) with which to test. + + INT_ID *item_array_; + // Array of INT_IDs (items) with which to test. + + int *order_index_; + // Order of indices in the key and item arrays. + +}; |