OTest2
A C++ testing framework
lib
cmdfirststate.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 <
cmdfirststate.h
>
21
22
#include <assert.h>
23
#include <string>
24
25
#include <
caseordinary.h
>
26
#include <
caseordinaryptr.h
>
27
#include <
internalerror.h
>
28
#include <
state.h
>
29
#include <
stateptr.h
>
30
31
namespace
OTest2
{
32
33
CmdFirstState::CmdFirstState
(
34
CaseOrdinaryPtr
case_) :
35
testcase(case_) {
36
assert(testcase !=
nullptr
);
37
38
}
39
40
CmdFirstState::~CmdFirstState
() {
41
42
}
43
44
void
CmdFirstState::run
(
45
const
Context
& context_) {
46
StatePtr
state_(testcase->getFirstState());
47
if
(state_ !=
nullptr
) {
48
state_->scheduleRun(context_, testcase, state_,
false
, -1);
49
}
50
else
{
51
internalError
(context_,
"there is not set any entering state"
);
52
}
53
}
54
55
}
/* namespace OTest2 */
caseordinaryptr.h
OTest2::CmdFirstState::run
virtual void run(const Context &context_)
Run the command.
Definition:
cmdfirststate.cpp:44
caseordinary.h
OTest2::CmdFirstState::~CmdFirstState
virtual ~CmdFirstState()
Dtor.
Definition:
cmdfirststate.cpp:40
OTest2::CaseOrdinaryPtr
std::shared_ptr< CaseOrdinary > CaseOrdinaryPtr
Shared pointer of the ordinary cases.
Definition:
caseordinaryptr.h:27
internalerror.h
OTest2::internalError
void internalError(const Context &context_, const std::string &message_) noexcept
Fail the running test because of an internal error.
Definition:
internalerror.cpp:28
OTest2
Definition:
assertbean.h:25
OTest2::StatePtr
std::shared_ptr< State > StatePtr
Pointer to test state objects.
Definition:
stateptr.h:27
OTest2::CmdFirstState::CmdFirstState
CmdFirstState(const CmdFirstState &)=delete
stateptr.h
OTest2::Context
OTest2 runtime context.
Definition:
context.h:38
state.h
cmdfirststate.h
Generated by
1.8.17