Class: TBaseWellBehavedObjectTest

Declaration: WellBehavedObjectTest.h

Taxonomy Categories:

Member Functions:


Interface Category:

Developer Tool Programmer Interface.

Inherits From:

TBaseComparisonTest

Inherited By:

TWellBehavedObjectTestOf

Purpose:

TBaseWellBehavedObject test is an abstract base class derived from TBaseComparisonTest that defines the protocol used for TWellBehavedTestOf tests. TBaseWellBehavedObjectTest bundles TBaseCopyTest, TBaseFlattenResurrectTest, TBaseStreamTest, and TBasePrimitiveComparisonTest into a single test. TBaseWellBehavedObjectTest tests the copying, flattening, and the streaming of the target by creating TCopyTestOf, TFlattenResurrectTestOf, and TStreamTestOf tests for the target and running the tests. The test also does all the testing done by TBasePrimitiveComparisonTest (for example, testing constructor, destructor, assignment operator) by creating a TPrimitiveComparisonTestOf test for the target and running it.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

TBaseWellBehavedObjectTest cannot be used directly. Use the template class TWellBehavedObjectTestOf or the TWellBehavedObjectTestOf macros. The template class defines all the functions that you must override for TBaseWellBehavedObjectTest.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TBaseWellBehavedObjectTest::~TBaseWellBehavedObjectTest

virtual ~ TBaseWellBehavedObjectTest ()

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.

Member Function: TBaseWellBehavedObjectTest::operator<<=

virtual TStream & operator <<= (TStream & source)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

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.

Member Function: TBaseWellBehavedObjectTest::operator>>=

virtual TStream & operator >>=(TStream & destination) const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

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.

Member Function: TBaseWellBehavedObjectTest::CopyInfo

virtual void CopyInfo (TDictionaryOf < TStandardText, TText >& infoDict) const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Framework function that derived classes can override to provide metainformation about themselves.

Calling Context:

Called by Test framework and test logging classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::GetCheckPrimitiveComparison

virtual bool GetCheckPrimitiveComparison () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Sets a Boolean that controls whether the primitive comparison test is run for the target. If true, the Test function creates a TPrimitiveComparisonTestOf test for the target and runs the test.

Calling Context:

Called by Test framework and directly.

Parameters:

Return Value:

Returns true if the primitive comparison test is run for the target class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::SetCheckPrimitiveComparison

virtual void SetCheckPrimitiveComparison (bool check)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Gets whether the Test member function will run the TBasePrimitiveComparisonTest for the target.

Calling Context:

Called by Test framework.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::GetCheckVersionHandling

virtual bool GetCheckVersionHandling () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Gets a Boolean that controls whether the version handling checking is done in the stream test. If true, the Test member function checks for correct handling of invalid version number in stream when streaming in the target object.

Calling Context:

Called by test framework and directly.

Parameters:

Return Value:

Returns true if version handling checking is done in the stream test.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::SetCheckVersionHandling

virtual void SetCheckVersionHandling (bool check)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Sets a Boolean that controls whether the version handling checking is done in the stream test. If true, the Test member function checks for correct handling of invalid version number in stream when streaming in the target object.

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.

Member Function: TBaseWellBehavedObjectTest::AdoptStreamer

void AdoptStreamer (TAbstractStreamer * streamer)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Sets the streamer 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:

After this call, this object owns the streamer and deletes it.

Member Function: TBaseWellBehavedObjectTest::OrphanStreamer

TAbstractStreamer * OrphanStreamer ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Returns a pointer to the streamer previously set by AdoptStreamer, or zero if no streamer has been set.

Calling Context:

Called by Test framework and directly.

Parameters:

Return Value:

Returns a pointer to the streamer previously set by AdoptStreamer, or zero if no streamer has been set.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The caller owns the object that is returned and is responsible for deleting it.

Member Function: TBaseWellBehavedObjectTest::GetStreamer

TAbstractStreamer * GetStreamer ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Returns a pointer to the streamer previously set by AdoptStreamer, or zero if no streamer has been set.

Calling Context:

Called by Test framework and directly.

Parameters:

Return Value:

Returns a pointer to the streamer previously set by AdoptStreamer, or zero if no streamer has been set.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The caller must not delete the streamer that is returned.

Member Function: TBaseWellBehavedObjectTest::TBaseWellBehavedObjectTest

  1. TBaseWellBehavedObjectTest ()
  2. TBaseWellBehavedObjectTest (const TBaseWellBehavedObjectTest & source)

Interface Category:

Developer Tool Programmer Interface.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::operator=

TBaseWellBehavedObjectTest & operator =(const TBaseWellBehavedObjectTest & rhs)

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.

Member Function: TBaseWellBehavedObjectTest::Setup

virtual void Setup ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Parses the inputs for the test and calls SetCheckPrimitiveComparison if the -p option is specified. It then calls SetupStreamer if the streamer 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.

Member Function: TBaseWellBehavedObjectTest::Test

virtual void Test ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates the copy test, the streaming test, and the flattening test for the target class and runs these tests. If version handling checking is enabled, the stream test will test version handling of the target's stream-in operator. If primitive comparison checking is enabled, it creates the primitive comparison test for the target class and runs the test.

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: TBaseWellBehavedObjectTest::SetupStreamer

virtual void SetupStreamer ()

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Sets up the streamer to be used for the test. Derived classes should overload SetupStreamer to instantiate the streamer and call AdoptStreamer for the streamer.

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: TBaseWellBehavedObjectTest::CreateStreamTest

virtual TBaseStreamTest * CreateStreamTest () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates the stream test for the target class.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the stream test for the target class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::CreateCopyTest

virtual TBaseCopyTest * CreateCopyTest () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates the copy test for the target class.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the copy test for the target class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::CreateFlattenResurrectTest

virtual TBaseFlattenResurrectTest * CreateFlattenResurrectTest () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates the flatten/resurrect test for the target class.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the flatten/resurrect test for the target class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::CreatePrimitiveComparisonTest

virtual TBasePrimitiveComparisonTest * CreatePrimitiveComparisonTest () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates the primitive comparison test for the target class.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the primitive comparison test for the target class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TBaseWellBehavedObjectTest::CreateEqualTarget

virtual void * CreateEqualTarget () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates an object that is equal to the target. By default, this function calls CreateNewTarget to create the equal object. Derived classes can overload this function to create an object equal to the target object in another way.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the object equal to the target object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes can overload CreateEqualTarget to create an object equal to the target object.

Member Function: TBaseWellBehavedObjectTest::CreateUnequalTarget

virtual void * CreateUnequalTarget () const

Interface Category:

Developer Tool Programmer Interface.

Purpose:

Creates an object that is unequal to the target and returns the unequal target. By default, this function returns a NIL pointer.

Calling Context:

Called by Test framework. Do not call this function directly.

Parameters:

Return Value:

Returns the object that is not equal to the target object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes can overload CreateUnequalTarget to create an object that is not equal to the target.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.