libept
Public Types | Public Member Functions | Public Attributes | List of all members
ept::tests::FixtureTestCase< FIXTURE > Struct Template Reference

Test case that includes a fixture. More...

#include <tests.h>

Inheritance diagram for ept::tests::FixtureTestCase< FIXTURE >:
ept::tests::TestCase

Public Types

typedef FIXTURE Fixture
 

Public Member Functions

template<typename... Args>
 FixtureTestCase (const std::string &name, Args... args)
 
void setup () override
 Set up the test case before it is run.
 
void teardown () override
 Clean up after the test case is run.
 
void method_setup (TestMethodResult &mr) override
 Set up before the test method is run.
 
void method_teardown (TestMethodResult &mr) override
 Clean up after the test method is run.
 
template<typename FUNC , typename ... Args>
void add_method (const std::string &name, FUNC test_function, Args &&... args)
 Add a method that takes a reference to the fixture as argument.
 
- Public Member Functions inherited from ept::tests::TestCase
 TestCase (const std::string &name)
 
virtual ~TestCase ()
 
virtual void register_tests ()=0
 This will be called before running the test case, to populate it with its test methods.
 
virtual void setup ()
 Set up the test case before it is run.
 
virtual void teardown ()
 Clean up after the test case is run.
 
virtual void method_setup (TestMethodResult &)
 Set up before the test method is run.
 
virtual void method_teardown (TestMethodResult &)
 Clean up after the test method is run.
 
virtual TestCaseResult run_tests (TestController &controller)
 Call setup(), run all the tests that have been registered, then call teardown().
 
virtual TestMethodResult run_test (TestController &controller, TestMethod &method)
 Run a test method.
 
template<typename ... Args>
void add_method (const std::string &name, std::function< void()> test_function)
 Register a new test method.
 
template<typename ... Args>
void add_method (const std::string &name, std::function< void()> test_function, Args &&... args)
 Register a new test method.
 
template<typename FUNC , typename ... Args>
void add_method (const std::string &name, FUNC test_function, Args &&... args)
 Register a new test metheod, with arguments.
 

Public Attributes

Fixturefixture = 0
 
std::function< Fixture *()> make_fixture
 
- Public Attributes inherited from ept::tests::TestCase
std::string name
 Name of the test case.
 
std::vector< TestMethodmethods
 All registered test methods.
 

Detailed Description

template<typename FIXTURE>
struct ept::tests::FixtureTestCase< FIXTURE >

Test case that includes a fixture.

Member Typedef Documentation

◆ Fixture

template<typename FIXTURE >
typedef FIXTURE ept::tests::FixtureTestCase< FIXTURE >::Fixture

Constructor & Destructor Documentation

◆ FixtureTestCase()

template<typename FIXTURE >
template<typename... Args>
ept::tests::FixtureTestCase< FIXTURE >::FixtureTestCase ( const std::string &  name,
Args...  args 
)
inline

Member Function Documentation

◆ add_method()

template<typename FIXTURE >
template<typename FUNC , typename ... Args>
void ept::tests::FixtureTestCase< FIXTURE >::add_method ( const std::string &  name,
FUNC  test_function,
Args &&...  args 
)
inline

Add a method that takes a reference to the fixture as argument.

Any extra arguments to the function will be passed to the test method after the fixture.

References ept::tests::TestCase::methods, and ept::tests::TestCase::name.

◆ method_setup()

template<typename FIXTURE >
void ept::tests::FixtureTestCase< FIXTURE >::method_setup ( TestMethodResult )
inlineoverridevirtual

Set up before the test method is run.

Reimplemented from ept::tests::TestCase.

References ept::tests::FixtureTestCase< FIXTURE >::fixture, and ept::tests::TestCase::method_setup().

◆ method_teardown()

template<typename FIXTURE >
void ept::tests::FixtureTestCase< FIXTURE >::method_teardown ( TestMethodResult )
inlineoverridevirtual

Clean up after the test method is run.

Reimplemented from ept::tests::TestCase.

References ept::tests::FixtureTestCase< FIXTURE >::fixture, and ept::tests::TestCase::method_teardown().

◆ setup()

template<typename FIXTURE >
void ept::tests::FixtureTestCase< FIXTURE >::setup ( )
inlineoverridevirtual

◆ teardown()

template<typename FIXTURE >
void ept::tests::FixtureTestCase< FIXTURE >::teardown ( )
inlineoverridevirtual

Clean up after the test case is run.

Reimplemented from ept::tests::TestCase.

References ept::tests::FixtureTestCase< FIXTURE >::fixture, and ept::tests::TestCase::teardown().

Member Data Documentation

◆ fixture

template<typename FIXTURE >
Fixture* ept::tests::FixtureTestCase< FIXTURE >::fixture = 0

◆ make_fixture

template<typename FIXTURE >
std::function<Fixture*()> ept::tests::FixtureTestCase< FIXTURE >::make_fixture

The documentation for this struct was generated from the following file: