OTest2
A C++ testing framework
lib
stateordinary.cpp
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
#include <
stateordinary.h
>
21
22
#include <assert.h>
23
#include <memory>
24
25
#include <
cmdrunstate.h
>
26
#include <
commandstack.h
>
27
#include <
context.h
>
28
#include <
state.h
>
29
30
namespace
OTest2
{
31
32
StateOrdinary::StateOrdinary
(
33
const
Context
& context_) {
34
35
}
36
37
StateOrdinary::~StateOrdinary
() {
38
39
}
40
41
void
StateOrdinary::scheduleRun
(
42
const
Context
& context_,
43
CaseOrdinaryPtr
parent_,
44
StatePtr
this_ptr_,
45
bool
wait_,
46
int
delay_) {
47
assert(this_ptr_.get() ==
this
);
48
49
/* -- schedule the commands */
50
context_.
command_stack
->
pushCommand
(
51
std::make_shared<CmdRunState>(
52
parent_,
53
std::static_pointer_cast<StateOrdinary>(this_ptr_),
54
wait_,
55
delay_));
56
}
57
58
}
/* namespace OTest2 */
cmdrunstate.h
OTest2::CommandStack::pushCommand
void pushCommand(CommandPtr command_)
Push a command into the stack.
Definition:
commandstack.cpp:67
commandstack.h
OTest2::CaseOrdinaryPtr
std::shared_ptr< CaseOrdinary > CaseOrdinaryPtr
Shared pointer of the ordinary cases.
Definition:
caseordinaryptr.h:27
OTest2::Context::command_stack
CommandStack *const command_stack
Definition:
context.h:40
OTest2
Definition:
assertbean.h:25
stateordinary.h
OTest2::StateOrdinary::scheduleRun
virtual void scheduleRun(const Context &context_, CaseOrdinaryPtr parent_, StatePtr this_ptr_, bool wait_, int delay_)
Schedule run of the state.
Definition:
stateordinary.cpp:41
OTest2::StatePtr
std::shared_ptr< State > StatePtr
Pointer to test state objects.
Definition:
stateptr.h:27
OTest2::StateOrdinary::StateOrdinary
StateOrdinary(const StateOrdinary &)=delete
context.h
OTest2::Context
OTest2 runtime context.
Definition:
context.h:38
state.h
OTest2::StateOrdinary::~StateOrdinary
virtual ~StateOrdinary()
Dtor.
Definition:
stateordinary.cpp:37
Generated by
1.8.17