OTest2
A C++ testing framework
testroot.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_TESTROOT_H_
21 #define OTest2_INCLUDE_OTEST2_TESTROOT_H_
22 
23 #include <string>
24 
25 #include <otest2/objectscenario.h>
26 
27 namespace OTest2 {
28 
32 class TestRoot : public ObjectScenario {
33  private:
34  std::string name;
35 
36  public:
42  explicit TestRoot(
43  const std::string& name_);
44 
48  virtual ~TestRoot();
49 
50  /* -- avoid copying */
51  TestRoot(
52  const TestRoot&) = delete;
54  const TestRoot&) = delete;
55 
56  /* -- object interface */
57  virtual std::string getName() const override;
58 
59  /* -- object scenario */
60  virtual bool startUpObject(
61  const Context& context_,
62  int index_) override;
63  virtual void scheduleBody(
64  const Context& context_,
65  ScenarioPtr scenario_,
66  ObjectPtr me_) override;
67  virtual void tearDownObject(
68  const Context& context_,
69  int index_) override;
70 };
71 
72 } /* -- namespace OTest2 */
73 
74 #endif /* -- OTest2_INCLUDE_OTEST2_TESTROOT_H_ */
objectscenario.h
OTest2::TestRoot
Root testing object.
Definition: testroot.h:32
OTest2::ObjectScenario
Inteface of a testing object scheduled by the scenario (test, suite and test case)
Definition: objectscenario.h:37
OTest2::TestRoot::startUpObject
virtual bool startUpObject(const Context &context_, int index_) override
Execute start-up function at specified index.
Definition: testroot.cpp:47
OTest2::TestRoot::~TestRoot
virtual ~TestRoot()
Dtor.
Definition: testroot.cpp:39
OTest2::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
Definition: objectptr.h:27
OTest2
Definition: assertbean.h:25
OTest2::TestRoot::tearDownObject
virtual void tearDownObject(const Context &context_, int index_) override
Execute tear-down function at specified index.
Definition: testroot.cpp:62
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
OTest2::TestRoot::operator=
TestRoot & operator=(const TestRoot &)=delete
OTest2::TestRoot::getName
virtual std::string getName() const override
Get object's name.
Definition: testroot.cpp:43
OTest2::TestRoot::TestRoot
TestRoot(const std::string &name_)
Ctor.
Definition: testroot.cpp:32
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::TestRoot::scheduleBody
virtual void scheduleBody(const Context &context_, ScenarioPtr scenario_, ObjectPtr me_) override
Schedule body of the testing object.
Definition: testroot.cpp:53