OTest2
A C++ testing framework
suitegenerated.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2INCLUDE_SUITEGENERATED_H_
21 #define OTest2INCLUDE_SUITEGENERATED_H_
22 
23 #include <string>
24 
25 #include <otest2/contextobject.h>
26 #include <otest2/fcemarshalerptr.h>
27 #include <otest2/suite.h>
28 
29 namespace OTest2 {
30 
31 class Context;
32 
36 class SuiteGenerated : public Suite, public ContextObject {
37  private:
38  struct Impl;
39  Impl* pimpl;
40 
41  public:
42  /* -- avoid copying */
44  const SuiteGenerated&) = delete;
46  const SuiteGenerated&) = delete;
47 
54  explicit SuiteGenerated(
55  const Context& context_,
56  const std::string& name_);
57 
61  virtual ~SuiteGenerated();
62 
63  /* -- object */
64  virtual std::string getName() const;
65 
66  /* -- scenario object */
67  virtual bool startUpObject(
68  const Context& context_,
69  int index_) override;
70  virtual void scheduleBody(
71  const Context& context_,
72  ScenarioPtr scenario_,
73  ObjectPtr parent_) override;
74  virtual void tearDownObject(
75  const Context& context_,
76  int index_) override;
77 
78  /* -- context object */
79  virtual const Context& otest2Context() const;
80 
81  protected:
88  void registerFixture(
89  FceMarshalerPtr start_up_,
90  FceMarshalerPtr tear_down_);
91 };
92 
93 } /* -- namespace OTest2 */
94 
95 #endif /* -- OTest2INCLUDE_SUITEGENERATED_H_ */
OTest2::SuiteGenerated
Helper class for suites generated by the otest2 preprocessor.
Definition: suitegenerated.h:36
OTest2::SuiteGenerated::scheduleBody
virtual void scheduleBody(const Context &context_, ScenarioPtr scenario_, ObjectPtr parent_) override
Schedule body of the testing object.
Definition: suitegenerated.cpp:105
OTest2::SuiteGenerated::otest2Context
virtual const Context & otest2Context() const
Get the OTest2 context.
Definition: suitegenerated.cpp:122
OTest2::SuiteGenerated::SuiteGenerated
SuiteGenerated(const SuiteGenerated &)=delete
OTest2::SuiteGenerated::operator=
SuiteGenerated & operator=(const SuiteGenerated &)=delete
OTest2::SuiteGenerated::tearDownObject
virtual void tearDownObject(const Context &context_, int index_) override
Execute tear-down function at specified index.
Definition: suitegenerated.cpp:113
OTest2::SuiteGenerated::registerFixture
void registerFixture(FceMarshalerPtr start_up_, FceMarshalerPtr tear_down_)
Register a fixture (a pair of a start-up and a tear-down functions)
Definition: suitegenerated.cpp:126
OTest2::SuiteGenerated::startUpObject
virtual bool startUpObject(const Context &context_, int index_) override
Execute start-up function at specified index.
Definition: suitegenerated.cpp:92
fcemarshalerptr.h
OTest2::FceMarshalerPtr
std::shared_ptr< FceMarshaler > FceMarshalerPtr
Definition: fcemarshalerptr.h:27
OTest2::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
Definition: objectptr.h:27
OTest2
Definition: assertbean.h:25
OTest2::Suite
Suite interface.
Definition: suite.h:32
OTest2::SuiteGenerated::getName
virtual std::string getName() const
Get object's name.
Definition: suitegenerated.cpp:88
OTest2::ContextObject
A generic interface of objects which offers OTest2 context.
Definition: contextobject.h:33
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
OTest2::SuiteGenerated::~SuiteGenerated
virtual ~SuiteGenerated()
Dtor.
Definition: suitegenerated.cpp:84
suite.h
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
contextobject.h