OTest2
A C++ testing framework
objectrepeateronce.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_REPEATERONCE_H_
21 #define OTest2_INCLUDE_OTEST2_REPEATERONCE_H_
22 
23 #include <string>
24 
25 #include <otest2/objectrepeater.h>
27 
28 namespace OTest2 {
29 
34  private:
35  bool created;
36 
40  virtual ObjectScenarioPtr doCreateObject(
41  const Context& context_,
42  const std::string& decorated_name_,
43  ObjectPtr parent_) = 0;
44 
45  public:
50 
54  virtual ~ObjectRepeaterOnce();
55 
56  /* -- avoid copying */
58  const ObjectRepeaterOnce&) = delete;
60  const ObjectRepeaterOnce&) = delete;
61 
62  /* -- repeater interface */
63  virtual bool hasNextRun(
64  const Context& context_) const override;
65  virtual void modifyObjectPath(
66  const Context& context_,
67  ObjectPath& path_) const override;
69  const Context& context_,
70  const std::string& decorated_name_,
71  ObjectPtr parent_) override;
72 };
73 
74 } /* -- namespace OTest2 */
75 
76 #endif /* -- OTest2_INCLUDE_OTEST2_REPEATERONCE_H_ */
OTest2::ObjectRepeater
Generic interface of a repeater of a testing object (this repeater is not a part of the OTest2 API)
Definition: objectrepeater.h:38
OTest2::ObjectScenarioPtr
std::shared_ptr< ObjectScenario > ObjectScenarioPtr
Shared pointer of a testing object scheduled by the scenario.
Definition: objectscenarioptr.h:27
objectrepeater.h
OTest2::ObjectPath
This is a simple object keeping path to current testing object.
Definition: objectpath.h:32
OTest2::ObjectRepeaterOnce::ObjectRepeaterOnce
ObjectRepeaterOnce()
Ctor.
Definition: objectrepeateronce.cpp:26
OTest2::ObjectRepeaterOnce
Object repeater which runs the test just once.
Definition: objectrepeateronce.h:33
OTest2::ObjectRepeaterOnce::modifyObjectPath
virtual void modifyObjectPath(const Context &context_, ObjectPath &path_) const override
Change current object path.
Definition: objectrepeateronce.cpp:40
OTest2::ObjectRepeaterOnce::operator=
ObjectRepeaterOnce & operator=(const ObjectRepeaterOnce &)=delete
objectscenarioptr.h
OTest2::ObjectRepeaterOnce::~ObjectRepeaterOnce
virtual ~ObjectRepeaterOnce()
Dtor.
Definition: objectrepeateronce.cpp:31
OTest2::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
Definition: objectptr.h:27
OTest2
Definition: assertbean.h:25
OTest2::ObjectRepeaterOnce::createObject
virtual ObjectScenarioPtr createObject(const Context &context_, const std::string &decorated_name_, ObjectPtr parent_) override
Create the testing object.
Definition: objectrepeateronce.cpp:46
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
OTest2::ObjectRepeaterOnce::hasNextRun
virtual bool hasNextRun(const Context &context_) const override
Check whether next run of the object is planned.
Definition: objectrepeateronce.cpp:35