IStreamTestOf is a subclass of ITest which tests the streaming of the target. Clients should create a subclass of IStreamTestOf or use streamTestMacro (see below).
This test is a good way to leverage testing effort since it allows one to test classes if those classes are expected to adhere to some protocol. This protocol test is implemented using a template class. Target classes MUST have operator= defined to be tested by IStreamTestOf. One macro and one global function are provided for easy use of this class.
The macro streamTestMacro does everything you need in one line. It writes the entire header and the entire implementation. Just supply the name of the test class, target class and the parameter list for the constructor that creates the target. The parameter list may be left blank to indicate that the empty constructor is to be used to create the target. For example, ISample is the target class that we want to test streaming. ISample has operator<<=, operator>>=, and operator== defined.
streamTestMacro(ISampleTest,ISample,(1));
The following is an example of a class which creates the target object using the empty constructor:
streamTestMacro(ISampleTest,ISample,);
Now you can run ISampleTest with runTestImplementationMacro:
runTestImplementationMacro(ISampleTest);
Or you can use this global function which creates and returns an instance of IStreamTestOf, as follows:
createStreamTest(new ISample(2));
This can be used with the adoptTest method in the ITestCollection class.
Constructors & DestructorClass constructors and destructors.
![]() |
public:
virtual ~IStreamTestOf()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IStreamTestOf(const IStreamTestOf < AType >&)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IStreamTestOf(AType* target)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Assignment OperatorsUse this operator to replace the existing object with the assigned, given one.
![]() |
public:
IStreamTestOf < AType >& operator =( const IStreamTestOf < AType >& )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Meta InformationClass member functions used to provide information about the tests.
![]() |
public:
virtual void copyInfo()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Output MethodsClass members used to display information to the user.
![]() |
protected:
virtual const char* targetClassNameAsString() const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Test MethodsMethods used to run the streaming test.
![]() |
protected:
virtual void test()
The test method also verifies that the stream position is consistent after stream-out and stream-in.
Note: Do not override this method. The best way to use the IStreamTestOf framework is to use the protocol StreamTestMacro.
ITest overrides; these methods are called by the framework ITest::run()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
virtual ~ITest()
void copyInputs(int& argc, char * *& argv) const
virtual EStage exceptionStage() const
virtual bool lookupInfo(const IString& key, IString& info)
ITest& operator =(const ITest& test)
ITieredTextBuffer& outputTextStream()
virtual void run()
virtual unsigned long runCount() const
void setInputs(const int argc, const char * const* argv)
bool success() const
static const IString & _Import kComponentKey
static const IString& kComponentKey
static const IString& kDescriptionKey
static const IString & _Import kDescriptionKey
static const IString & _Import kInputSyntaxKey
static const IString& kInputSyntaxKey
static const IString& kTargetClassKey
static const IString & _Import kTargetClassKey
static const IString & _Import kTestNameKey
static const IString& kTestNameKey
static const IString & _Import kTestTypeKey
static const IString& kTestTypeKey
static const IString& kTestVersionKey
static const IString & _Import kTestVersionKey
virtual void addInfo(const IString&, const IString&)
virtual void cleanup()
virtual bool isReset() const
virtual bool isSuccessUndecided() const
ITest()
ITest(const ITest& test)
virtual void print(ITieredTextBuffer&)
virtual void reset()
virtual void setStickySuccess(bool success)
virtual void setSuccess(bool success)
virtual void setup()
virtual void test() = 0