### IComparisonTestOf

  IComparisonTestOf tests the constructor, copy constructor and assignment operator of the target class. This is a good way to leverage testing effort since it allows you to test classes if those classes are expected to adhere to some protocol. This protocol test is implemented using a template class.

  Clients can either create a subclass or directly use this class.

  IComparisonTestOf tests the following operations of its target class:

          - copy constructed stack object
          - operator= assigned stack object
          - operator= self-assigned stack object
          - copy constructed heap object
          - operator= assigned heap object
          - operator= self-assigned heap object
          - Separately constructed unequal object of the unequal target is given

  Target class must have operator== defined.

  The best was to use the IComparisonTest framework is to use the protocol macros ComparisonTestMacro and ComparisonTestEqualOnlyMacro.

  These macros do everything you need in one line. They write the entire header and the entire implementation, including construtors and destructors. Just supply the names of the test class, target class, comparator, the parameter list for the constructor that creates the target, and (optionally) the unequal target. The parameter list may be left blank to indicate that the empty constructor is to be used to create the target or unequal target. If the test is only testing equal targets, then use the "EqualOnly" macros.

      Usage:

         Example:  ISample is the target class which we want to test.  ISample
                   has a constructor, a copy constructor, an operator=, and
                   an operator== defined:

                   comparisonTestMacro(ISampleTest, ISample, (1), (2));

         Example:  Example for a class which creates the target object using the
                   empty constructor:

                   comparisonTestMacro(ISampleTest, ISample, , (2));

         Now you can run ISampleTest with the following command:

                   runTestImplementationMacro(ISampleTest);

         If you do not want to test your target against an unequal object of the
         same type, do the following:

                   comparisonTestEqualOnlyMacro(ISampleTest, ISample, (1));

         Or you can use this global function which creates and returns an instance
         of IComparisonTestOf:

                   createComparisonTest(new ISample(1), new ISample(2));

         which can be used with the adoptTest method (see the ITestCollection class).

### IComparisonTestOf - Member Functions and Data by Group

### Constructors & Destructor

Class constructors and destructors.

~IComparisonTestOf

      public:
      virtual ~IComparisonTestOf()

  Destructor

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IComparisonTestOf
  Use these to construct obejcts of this class.

  Overload 1

      public:
      IComparisonTestOf(const IComparisonTestOf < AType >& that)

  Copy constructor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      public:
      IComparisonTestOf(AType* target, AType* unequalTarget = 0)

  Constructor which accepts the following arguments:.
  target
    Target object to perform tests on.
  unequalTarget
    Unequal object to use for comparison.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator =

      public:
      IComparisonTestOf < AType >&
        operator =( const IComparisonTestOf < AType >& that )

  Standard assignment operator.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Test Methods

Class member functions used to by the IComparison tests. Some need to be overridden by the user and some should NOT be overridden. See each member function for details.

copyInfo

      public:
      virtual void copyInfo()

  Within copyInfo, IComparisonTestOf calls the inherited implementation (e.g., IDerived::copyInfo should call IBase::copyInfo). Then copyInfo should add key/value pairs to infoMap by calling the addInfo method.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

targetClassNameAsString

      protected:
      virtual const char* targetClassNameAsString() const

  Returns the name of the target class. By default, it returns NULL.

  You must override this method if you want the target class name reported in the test output.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

test

      protected:
      virtual void test()

  Tests the constructor, copy constructor, and assignment operator of the target class.

  Note: Do NOT override the method. Do NOT call this method directly. The best was to use the IComparisonTest framework is to use the protocol macros: ComparisonTestMacro and ComparisonTestEqualOnlyMacro.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IComparisonTestOf - Inherited Member Functions and Data

#### Inherited Public Functions

  ITest

  -     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

#### Inherited Public Data

  ITest

  -     static const IString & _Import kComponentKey

  -     static const IString& kComponentKey

  -     static const IString & _Import kDescriptionKey

  -     static const IString& 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& kTestTypeKey

  -     static const IString & _Import kTestTypeKey

  -     static const IString& kTestVersionKey

  -     static const IString & _Import kTestVersionKey

#### Inherited Protected Functions

  ITest

  -     virtual void addInfo(const IString&, const IString&)

  -     virtual void cleanup()

  -     virtual bool isReset() const

  -     virtual bool isSuccessUndecided() const

  -     ITest(const ITest& test)

  -     ITest()

  -     virtual void print(ITieredTextBuffer&)

  -     virtual void reset()

  -     virtual void setStickySuccess(bool success)

  -     virtual void setSuccess(bool success)

  -     virtual void setup()

  -     virtual void test() = 0

#### Inherited Protected Data

  - None