OTest2
A C++ testing framework
objectscenario.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 OTest2_INCLUDE_OTEST2_OBJECTSCENARIO_H_
21 #define OTest2_INCLUDE_OTEST2_OBJECTSCENARIO_H_
22 
23 #include <otest2/object.h>
24 
25 #include <otest2/objectptr.h>
27 #include <otest2/scenarioptr.h>
28 
29 namespace OTest2 {
30 
31 class Context;
32 
37 class ObjectScenario : public Object {
38  public:
43 
47  virtual ~ObjectScenario();
48 
49  /* -- avoid copying */
51  const ObjectScenario&) = delete;
53  const ObjectScenario&) = delete;
54 
62  virtual bool startUpObject(
63  const Context& context_,
64  int index_) = 0;
65 
73  virtual void scheduleBody(
74  const Context& context_,
75  ScenarioPtr scenario_,
76  ObjectPtr me_) = 0;
77 
84  virtual void tearDownObject(
85  const Context& context_,
86  int index_) = 0;
87 };
88 
89 } /* -- namespace OTest2 */
90 
91 #endif /* -- OTest2_INCLUDE_OTEST2_OBJECTSCENARIO_H_ */
OTest2::ObjectScenario::startUpObject
virtual bool startUpObject(const Context &context_, int index_)=0
Execute start-up function at specified index.
objectptr.h
OTest2::ObjectScenario::ObjectScenario
ObjectScenario()
Dtor.
Definition: objectscenario.cpp:23
OTest2::ObjectScenario::scheduleBody
virtual void scheduleBody(const Context &context_, ScenarioPtr scenario_, ObjectPtr me_)=0
Schedule body of the testing object.
OTest2::ObjectScenario
Inteface of a testing object scheduled by the scenario (test, suite and test case)
Definition: objectscenario.h:37
OTest2::Object
Generic testing object.
Definition: object.h:32
OTest2::ObjectScenario::operator=
ObjectScenario & operator=(const ObjectScenario &)=delete
objectscenarioptr.h
OTest2::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
Definition: objectptr.h:27
OTest2
Definition: assertbean.h:25
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::ObjectScenario::~ObjectScenario
virtual ~ObjectScenario()
Dtor.
Definition: objectscenario.cpp:27
object.h
OTest2::ObjectScenario::tearDownObject
virtual void tearDownObject(const Context &context_, int index_)=0
Execute tear-down function at specified index.
scenarioptr.h