OTest2
A C++ testing framework
scenario.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_SCENARIO_H_
21 #define OTest2_INCLUDE_OTEST2_SCENARIO_H_
22 
23 #include <utility>
24 
27 #include <otest2/scenarioiterptr.h>
28 #include <otest2/scenarioptr.h>
29 
30 namespace OTest2 {
31 
32 class Context;
33 class ObjectPath;
34 class Parameters;
35 class RunnerFilter;
36 class RunnerFilterTags;
37 class TagsStack;
38 
47 class Scenario {
48  public:
52  Scenario();
53 
57  virtual ~Scenario();
58 
59  /* -- avoid copying */
60  Scenario(
61  const Scenario&) = delete;
63  const Scenario&) = delete;
64 
78  TagsStack& tags_,
79  ScenarioContainerPtr parent_,
80  const RunnerFilter& filter_) const = 0;
81 
90  virtual std::pair<std::string, ObjectRepeaterPtr> createRepeater(
91  const Context& context_) const = 0;
92 
106  virtual void enterObject(
107  const Context& context_) const noexcept = 0;
108 
114  virtual void leaveObject(
115  const Context& context_) const noexcept = 0;
116 
120  virtual ScenarioIterPtr getChildren() const = 0;
121 };
122 
123 } /* -- namespace OTest2 */
124 
125 #endif /* -- OTest2_INCLUDE_OTEST2_SCENARIO_H_ */
objectrepeaterptr.h
scenarioiterptr.h
OTest2::RunnerFilter
Generic interface of a runner filter.
Definition: runnerfilter.h:35
OTest2::Scenario::getChildren
virtual ScenarioIterPtr getChildren() const =0
Get iterator of children object.
OTest2::Scenario::leaveObject
virtual void leaveObject(const Context &context_) const noexcept=0
Report leaving of the testing object.
OTest2::Scenario::Scenario
Scenario()
Ctor.
Definition: scenario.cpp:23
OTest2
Definition: assertbean.h:25
OTest2::Scenario::operator=
Scenario & operator=(const Scenario &)=delete
OTest2::ScenarioIterPtr
std::shared_ptr< ScenarioIter > ScenarioIterPtr
Shared pointer of the scenario iter interface.
Definition: scenarioiterptr.h:27
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
OTest2::Scenario::filterScenario
virtual ScenarioPtr filterScenario(TagsStack &tags_, ScenarioContainerPtr parent_, const RunnerFilter &filter_) const =0
Filter the scenario.
OTest2::TagsStack
Stack of assigned tags.
Definition: tagsstack.h:36
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::Scenario::~Scenario
virtual ~Scenario()
Dtor.
Definition: scenario.cpp:27
OTest2::Scenario::enterObject
virtual void enterObject(const Context &context_) const noexcept=0
Enter the testing object.
OTest2::ScenarioContainerPtr
std::shared_ptr< ScenarioContainer > ScenarioContainerPtr
Shared pointer to a scenario container.
Definition: scenariocontainerptr.h:27
scenariocontainerptr.h
OTest2::Scenario::createRepeater
virtual std::pair< std::string, ObjectRepeaterPtr > createRepeater(const Context &context_) const =0
Create repeater object for testing object represented by this scenario object.
OTest2::Scenario
Generic scenario object.
Definition: scenario.h:47
scenarioptr.h