Taxonomy Categories:
Member Functions:
Interface Category:
Developer Tool Programmer Interface.
Inherits From:
TTest
Inherited By:
TBaseStreamTest
TBaseWellBehavedObjectTest
TBaseCopyTest
TBaseFlattenResurrectTest
TBasePrimitiveComparisonTest
Purpose:
An abstract base class derived from TTest that defines a protocol for classes of tests that compares two objects using a comparator (TAbstractComparator).
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
TBaseComparisonTest cannot be used directly. Use one of its concrete derived classes instead.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
virtual ~ TBaseComparisonTest ()
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator <<= (TStream & source)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & source -The stream the object is streamed in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual TStream & operator >>=(TStream & destination) const
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & destination -The stream the object is streamed out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void AdoptComparator (TAbstractComparator * comparator)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Sets the comparator to be used for the test.
Calling Context:
Called by Test framework and directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TAbstractComparator * OrphanComparator ()
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Returns a pointer to the comparator previously set by AdoptComparator, or zero if no comparator has been set.
Calling Context:
Called by Test framework and directly.
Parameters:
Return Value:
Returns a pointer to the comparator previously set by AdoptComparator, or zero if no comparator has been set.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TAbstractComparator * GetComparator ()
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Returns a pointer to the comparator previously set by AdoptComparator, or zero if no comparator has been set.
Calling Context:
Called by Test framework and directly.
Parameters:
Return Value:
Returns a pointer to the comparator previously set by AdoptComparator, or zero if no comparator has been set.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void SetCheckHash (bool check)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Sets a Boolean that controls whether the hash values are checked when comparing two the objects. If true, the Compare member function checks that the hash values are equal if the objects suppose to be equal.
Calling Context:
Called by Test framework and directly.
Parameters:
- bool check -If true, the hash values for the objects are checked in the Compare function.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual bool GetCheckHash () const
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Gets a Boolean that controls whether the hash values are checked when comparing two the objects. If true, the Compare member function checks that the hash values are equal if the objects suppose to be equal.
Calling Context:
Called by Test framework and directly.
Parameters:
Return Value:
Returns true if the hash values are checked when comparing two objects in the Compare function.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TBaseComparisonTest ()
- TBaseComparisonTest (const TBaseComparisonTest & copyIn)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
- Default constructor.
- Copy constructor.
Calling Context:
- Called by the stream-in operators and directly.
- Called to copy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TBaseComparisonTest & operator =(const TBaseComparisonTest & copyIn)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void Setup ()
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Sets the target to the object returned from CreateNewTarget if the target is not set. It then calls SetupComparator to set the comparator if the comparator is not set.
Calling Context:
Called by Test framework. Do not call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual void SetupComparator ()
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Sets up the comparator to be used for the test. Derived classes should overload SetupComparator to instantiate the comparator and call AdoptComparator for the comparator.
Calling Context:
Called by Test framework. Do not call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TBaseComparisonTest::GetTargetClassNameAsString
virtual const char * GetTargetClassNameAsString () const
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Returns the name of the target class.
Calling Context:
Called by Test framework. Do not call this function directly.
Parameters:
Return Value:
Returns the name of the target class.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Derived classes must override this function to return the name of the target class.
virtual void * CreateNewTarget () const
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Creates target on the heap and returns the object.
Calling Context:
Called by Test framework. Do not call this function directly.
Parameters:
Return Value:
Returns a new target object that has been allocated on the heap.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Derived classes must override this function to create a new target object on the heap.
virtual void DeleteTarget (void *) const
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Deletes the given target object after casting it to the target class to invoke the correct destructor.
Calling Context:
Called by Test framework. Do not call this function directly.
Parameters:
- void * -The target object.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
Derived classes must override this function to delete the given target object.
virtual void Compare (void * obj, void * target, bool shouldBeEqual, bool canBeSame)
Interface Category:
Developer Tool Programmer Interface.
Purpose:
Compares the object's original and copy and verifies that they are equal or unequal using the comparator. Objects are considered equal if their hash values are equal and if TypeSafeCompare returns kEqual. If the comparator is not set, pointer comparison is done to compare the objects, and the hash values are not checked. If canBeSame is false, Compare also checks to see that the pointer values for the original and the copy are not equal.
Calling Context:
Called by Test framework.
Parameters:
- void * obj -The original target object.
- void * target -The copy of the target object.
- bool shouldBeEqual -A flag that indicates whether the objects should be equal.
- bool canBeSame -A flag that indicates whether the objects can be the same.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.