OTest2
A C++ testing framework
objectrepeateronce.cpp
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 #include <objectrepeateronce.h>
20 
21 #include <assert.h>
22 #include <string>
23 
24 namespace OTest2 {
25 
27  created(false) {
28 
29 }
30 
32 
33 }
34 
36  const Context& context_) const {
37  return !created;
38 }
39 
41  const Context& context_,
42  ObjectPath& path_) const {
43  assert(!created);
44 }
45 
47  const Context& context_,
48  const std::string& decorated_name_,
49  ObjectPtr parent_) {
50  assert(!created);
51  created = true;
52  return doCreateObject(context_, decorated_name_, parent_);
53 }
54 
55 } /* -- namespace OTest2 */
OTest2::ObjectScenarioPtr
std::shared_ptr< ObjectScenario > ObjectScenarioPtr
Shared pointer of a testing object scheduled by the scenario.
Definition: objectscenarioptr.h:27
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::modifyObjectPath
virtual void modifyObjectPath(const Context &context_, ObjectPath &path_) const override
Change current object path.
Definition: objectrepeateronce.cpp:40
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
objectrepeateronce.h
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