OTest2
A C++ testing framework
cmdrunstate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_CMDRUNSTATE_H_
21 #define OTest2__INCLUDE_OTEST2_CMDRUNSTATE_H_
22 
23 #include <otest2/caseordinaryptr.h>
24 #include <otest2/command.h>
26 
27 namespace OTest2 {
28 
32 class CmdRunState : public Command {
33  private:
34  CaseOrdinaryPtr parent;
35  StateOrdinaryPtr state;
36  bool wait_before;
37  int delay;
38 
39  public:
40  /* -- avoid copying */
42  const CmdRunState&) = delete;
44  const CmdRunState&) = delete;
45 
54  explicit CmdRunState(
55  CaseOrdinaryPtr parent_,
56  StateOrdinaryPtr state_,
57  bool wait_before_,
58  int delay_);
59 
63  virtual ~CmdRunState();
64 
65  /* -- command interface */
66  virtual bool shouldWait(
67  const Context& context_,
68  int& delay_);
69  virtual void run(
70  const Context& context_);
71 };
72 
73 } /* namespace OTest2 */
74 
75 #endif /* OTest2__INCLUDE_OTEST2_CMDRUNSTATE_H_ */
caseordinaryptr.h
OTest2::CmdRunState::CmdRunState
CmdRunState(const CmdRunState &)=delete
OTest2::CmdRunState
Run a state.
Definition: cmdrunstate.h:32
OTest2::StateOrdinaryPtr
std::shared_ptr< StateOrdinary > StateOrdinaryPtr
Shared pointer of ordinary states.
Definition: stateordinaryptr.h:27
command.h
OTest2::CmdRunState::shouldWait
virtual bool shouldWait(const Context &context_, int &delay_)
Say whether the framework should wait before running the command.
Definition: cmdrunstate.cpp:51
OTest2::CaseOrdinaryPtr
std::shared_ptr< CaseOrdinary > CaseOrdinaryPtr
Shared pointer of the ordinary cases.
Definition: caseordinaryptr.h:27
OTest2::CmdRunState::operator=
CmdRunState & operator=(const CmdRunState &)=delete
OTest2::CmdRunState::run
virtual void run(const Context &context_)
Run the command.
Definition: cmdrunstate.cpp:62
OTest2
Definition: assertbean.h:25
OTest2::Command
generic command interface
Definition: command.h:30
OTest2::Context
OTest2 runtime context.
Definition: context.h:38
stateordinaryptr.h
OTest2::CmdRunState::~CmdRunState
virtual ~CmdRunState()
Dtor.
Definition: cmdrunstate.cpp:47