template class TestCaseAdapter<typename T, typename S, typename D> : TestCase

Constructs test Cases from functions.

The test case adapter template creates a test case class from functions for the test activity, test fixture set-up and tear-down. Only functors could be used directly, that means plain functions have take no arguments. If a function should be used that requires some parameters, a binder could be used to associate static values to parameters (see Binder0).
A test case adapter instance could be easily created by using the convenience function makeTestCase. This function takes one to three functor arguments for the test action, and for fixture set-up and tear-down. If no functor is given for set-up and tear-down, a default no-operation function is used.

template<typename T, typename S, typename D>
inline TestCaseAdapter<T,S,D>* makeTestCase (
      const string& name,
      T testFunc, 
      S setUpFunc,
      D tearDownFunc
);

template<typename T, typename S> 
inline TestCaseAdapter<T,S,noop_type>* makeTestCase (
      const string& name,
      T testFunc, 
      S setUpFunc
);

template<typename T> 
inline TestCaseAdapter<T,noop_type,noop_type>* makeTestCase (
      const string& name,
      T testFunc
);
 




Public Members:
    TestCaseAdapter (const string& name, T testFunc, S setUpFunc, D tearDownFunc ) ;
    Create a new test adapter instance.
    In addition to the name, a test function of type T, a set-up function of type S and a tear-down function of type D have to be specified.

    virtual void test (TestConductor&) ;
    Run the test.
    Simply calls test ().

    virtual void setUp () ;
    Fixture set-up.
    Invokes the set-up function.

    virtual void test () ;
    Do the test.
    Invokes the test function.

    virtual void tearDown () ;
    Fixture tear-down.
    Invokes the tear-down function.




The Scrunitizer C++ Unit Test Framework
by Bernd Linowski

[Scrunitizer]  [Overview]  [Cookbook]  [Download]  [Index]  [Linosphere]

Page generated: 1 Nov 2000
(C) by Bernd Linowski
scrunitizer@linosphere.de