OTest2
A C++ testing framework
lib
cmdleaveobject.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
20
#include <
cmdleaveobject.h
>
21
22
#include <assert.h>
23
24
#include <
context.h
>
25
#include <
objectpath.h
>
26
#include <
scenario.h
>
27
#include <
semanticstack.h
>
28
29
namespace
OTest2
{
30
31
CmdLeaveObject::CmdLeaveObject
(
32
ScenarioPtr
scenario_) :
33
scenario(scenario_) {
34
assert(scenario !=
nullptr
);
35
36
}
37
38
CmdLeaveObject::~CmdLeaveObject
() {
39
40
}
41
42
void
CmdLeaveObject::run
(
43
const
Context
& context_) {
44
/* -- report finishing of the object */
45
scenario->leaveObject(context_);
46
47
/* -- finish object's stack-frame */
48
context_.
object_path
->
popName
();
49
context_.
semantic_stack
->
popAnd
();
50
}
51
52
}
/* -- namespace OTest2 */
OTest2::ObjectPath::popName
void popName()
Pop name of currently leaving testing object.
Definition:
objectpath.cpp:93
OTest2::SemanticStack::popAnd
void popAnd()
AND last two values and replace them by the result.
Definition:
semanticstack.cpp:86
objectpath.h
semanticstack.h
OTest2::CmdLeaveObject::CmdLeaveObject
CmdLeaveObject(ScenarioPtr scenario_)
Ctor.
Definition:
cmdleaveobject.cpp:31
OTest2
Definition:
assertbean.h:25
OTest2::CmdLeaveObject::run
virtual void run(const Context &context_) override
Run the command.
Definition:
cmdleaveobject.cpp:42
cmdleaveobject.h
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition:
scenarioptr.h:27
OTest2::Context::object_path
ObjectPath *const object_path
Definition:
context.h:42
OTest2::Context::semantic_stack
SemanticStack *const semantic_stack
Definition:
context.h:41
scenario.h
context.h
OTest2::Context
OTest2 runtime context.
Definition:
context.h:38
OTest2::CmdLeaveObject::~CmdLeaveObject
virtual ~CmdLeaveObject()
Dtor.
Definition:
cmdleaveobject.cpp:38
Generated by
1.8.17