/* -*- C++ -*- */ //============================================================================= /** * @file RB_Tree_Test.h * * 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 */ //============================================================================= /** * @class ACE_RB_Tree_Test * * @brief Implements a templatized test class for the RB_Tree ADT and its * iterators. */ template class ACE_RB_Tree_Test { // 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 TREE; typedef ACE_RB_Tree_Iterator ITERATOR; typedef ACE_RB_Tree_Reverse_Iterator REVERSE_ITERATOR; /// Constructor. ACE_RB_Tree_Test (int entry_count, EXT_ID key_array [], INT_ID item_array [], int order_index []); /// Destructor. ~ACE_RB_Tree_Test (); /// Run the individual interface and iteration tests in order. void run_test (); private: /// Tests stable and deprecated insertion interfaces. void test_tree_insertion (); /// Tests forward and reverse iteration after insertion in both /// trees. void test_post_insertion_iteration (); ///Tests forward and reverse partial iteration void test_partial_iteration(); /// Tests stable and deprecated deletion interfaces. void test_tree_deletion (); /// Tests forward and reverse iteration after deletions in both /// trees. void test_post_deletion_iteration (); /// Tree for testing stable interface. TREE stable_tree_; /// Forward iterator for tree for testing stable interface. ITERATOR stable_fwd_iter_; ITERATOR part_fwd_iter_; REVERSE_ITERATOR part_rev_iter_; /// Forward iterator for tree for testing stable interface. REVERSE_ITERATOR stable_rev_iter_; /// Tree for testing deprecated interface. TREE deprecated_tree_; /// Forward iterator for tree for testing deprecated interface. ITERATOR deprecated_fwd_iter_; /// Forward iterator for tree for testing deprecated interface. REVERSE_ITERATOR deprecated_rev_iter_; /// Number of entries in the key, item, and index arrays. int entry_count_; /// Array of EXT_IDs (keys) with which to test. EXT_ID *key_array_; /// Array of INT_IDs (items) with which to test. INT_ID *item_array_; /// Order of indices in the key and item arrays. int *order_index_; };