OTest2
A C++ testing framework
scenarioroot.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_SCENARIOROOT_H_
21 #define OTest2_INCLUDE_OTEST2_SCENARIOROOT_H_
22 
24 
25 namespace OTest2 {
26 
31  private:
32  struct Impl;
33  Impl* pimpl;
34 
35  public:
41  explicit ScenarioRoot(
42  const std::string& name_);
43 
47  virtual ~ScenarioRoot();
48 
49  /* -- avoid copying */
51  const ScenarioRoot&) = delete;
53  const ScenarioRoot&) = delete;
54 
60  void setName(
61  const std::string& name_);
62 
63  /* -- scenario interface */
65  TagsStack& tags_,
66  ScenarioContainerPtr parent_,
67  const RunnerFilter& filter_) const override;
68  virtual std::pair<std::string, ObjectRepeaterPtr> createRepeater(
69  const Context& context_) const override;
70  virtual void enterObject(
71  const Context& context_) const noexcept override;
72  virtual void leaveObject(
73  const Context& context_) const noexcept override;
74  virtual ScenarioIterPtr getChildren() const override;
75 
76  /* -- scenario container interface */
77  virtual void appendScenario(
78  ScenarioPtr scenario_) override;
79  virtual bool isEmpty() const noexcept override;
80 };
81 
82 } /* -- namespace OTest2 */
83 
84 #endif /* -- OTest2_INCLUDE_OTEST2_SCENARIOROOT_H_ */
OTest2::ScenarioRoot::enterObject
virtual void enterObject(const Context &context_) const noexcept override
Enter the testing object.
Definition: scenarioroot.cpp:129
OTest2::RunnerFilter
Generic interface of a runner filter.
Definition: runnerfilter.h:35
OTest2::ScenarioRoot::appendScenario
virtual void appendScenario(ScenarioPtr scenario_) override
Append new sub-scenario into the container.
Definition: scenarioroot.cpp:150
OTest2::ScenarioContainer
Generic interface of a scenario container.
Definition: scenariocontainer.h:34
OTest2::ScenarioRoot::~ScenarioRoot
virtual ~ScenarioRoot()
Dtor.
Definition: scenarioroot.cpp:102
OTest2::ScenarioRoot::filterScenario
virtual ScenarioPtr filterScenario(TagsStack &tags_, ScenarioContainerPtr parent_, const RunnerFilter &filter_) const override
Filter the scenario.
Definition: scenarioroot.cpp:112
OTest2::ScenarioRoot::ScenarioRoot
ScenarioRoot(const std::string &name_)
Ctor.
Definition: scenarioroot.cpp:96
OTest2::ScenarioRoot::leaveObject
virtual void leaveObject(const Context &context_) const noexcept override
Report leaving of the testing object.
Definition: scenarioroot.cpp:137
OTest2::ScenarioRoot::createRepeater
virtual std::pair< std::string, ObjectRepeaterPtr > createRepeater(const Context &context_) const override
Create repeater object for testing object represented by this scenario object.
Definition: scenarioroot.cpp:124
OTest2
Definition: assertbean.h:25
OTest2::ScenarioRoot::getChildren
virtual ScenarioIterPtr getChildren() const override
Get iterator of children object.
Definition: scenarioroot.cpp:146
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::ScenarioRoot
Scenario object representing entire test.
Definition: scenarioroot.h:30
OTest2::TagsStack
Stack of assigned tags.
Definition: tagsstack.h:36
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::ScenarioRoot::setName
void setName(const std::string &name_)
Set name of the scenario (the name of the entire test)
Definition: scenarioroot.cpp:106
OTest2::ScenarioRoot::operator=
ScenarioRoot & operator=(const ScenarioRoot &)=delete
OTest2::ScenarioContainerPtr
std::shared_ptr< ScenarioContainer > ScenarioContainerPtr
Shared pointer to a scenario container.
Definition: scenariocontainerptr.h:27
OTest2::ScenarioRoot::isEmpty
virtual bool isEmpty() const noexcept override
Check whether the container is empty.
Definition: scenarioroot.cpp:156
scenariocontainer.h