Chrysalis - Pattern Test Coverage


pattern/
File: pattern/src/Project.cpp
Date: 2026-08-27 18:35:18
Lines:
136/154
88.3%
Functions:
62/66
93.9%
Branches:
53/136
39.0%
Decisions:
10/16
62.5%
Calls:
362/555
65.2%

Line Branch Decision Call Exec Source
1 #include "Project.h"
2
3 #include <boost/iostreams/stream.hpp>
4 #include <boost/iostreams/device/back_inserter.hpp>
5 #include <boost/archive/binary_iarchive.hpp>
6 #include <boost/archive/binary_oarchive.hpp>
7 #include <boost/serialization/export.hpp>
8 #include <boost/serialization/unique_ptr.hpp>
9
10 #include "exceptions/ProjectIOError.h"
11
12 #include "Option.h"
13 #include "Expression.h"
14
15 #include "arguments/ParameterArgument.h"
16 #include "arguments/ComparisonArgument.h"
17 #include "arguments/BinaryFunctionArgument.h"
18 #include "arguments/ConditionalArgument.h"
19 #include "arguments/ExpressionArgument.h"
20 #include "arguments/VectorFunctionArgument.h"
21 #include "arguments/OptionArgument.h"
22 #include "arguments/OriginPointArgument.h"
23
24 #include "instructions/CurveInstruction.h"
25 #include "instructions/EdgeDartInstruction.h"
26 #include "instructions/FreePointInstruction.h"
27 #include "instructions/MovePointInstruction.h"
28 #include "instructions/ExpressionInstruction.h"
29 #include "instructions/BuildOutlineInstruction.h"
30 #include "instructions/RelativePointInstruction.h"
31 #include "instructions/UnfoldEdgeDartInstruction.h"
32 #include "instructions/IntersectionPointInstruction.h"
33 #include "instructions/PatternInstructionsContainer.h"
34 #include "instructions/ConditionalInstructionsContainer.h"
35 #include "instructions/DartInstruction.h"
36 #include "instructions/ResetTransformationInstruction.h"
37 #include "instructions/TransformInstruction.h"
38
39 using namespace Chrysalis;
40
41 1 BOOST_CLASS_EXPORT(Chrysalis::ParameterArgument)
42
43 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Add)
44 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Subtract)
45 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Multiply)
46 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Divide)
47 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Min)
48 1 BOOST_CLASS_EXPORT(Chrysalis::BinaryFunctionArgument::Max)
49
50 1 BOOST_CLASS_EXPORT(Chrysalis::VectorFunctionArgument::Length)
51 1 BOOST_CLASS_EXPORT(Chrysalis::VectorFunctionArgument::Angle)
52 1 BOOST_CLASS_EXPORT(Chrysalis::VectorFunctionArgument)
53
54 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::Equal)
55 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::NotEqual)
56 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::Greater)
57 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::GreaterEqual)
58 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::Less)
59 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument::LessEqual)
60 1 BOOST_CLASS_EXPORT(Chrysalis::ComparisonArgument)
61
62 1 BOOST_CLASS_EXPORT(Chrysalis::LineArgument)
63 1 BOOST_CLASS_EXPORT(Chrysalis::RayArgument)
64 1 BOOST_CLASS_EXPORT(Chrysalis::VectorArgument)
65 1 BOOST_CLASS_EXPORT(Chrysalis::SegmentArgument)
66
67 1 BOOST_CLASS_EXPORT(Chrysalis::Option)
68 1 BOOST_CLASS_EXPORT(Chrysalis::Expression)
69 1 BOOST_CLASS_EXPORT(Chrysalis::OptionsContainer)
70 1 BOOST_CLASS_EXPORT(Chrysalis::ExpressionsContainer)
71 1 BOOST_CLASS_EXPORT(Chrysalis::Argument<double>)
72 1 BOOST_CLASS_EXPORT(Chrysalis::OptionArgument)
73 1 BOOST_CLASS_EXPORT(Chrysalis::ExpressionArgument)
74 1 BOOST_CLASS_EXPORT(Chrysalis::OriginPointArgument)
75 1 BOOST_CLASS_EXPORT(Chrysalis::PatternPointArgument)
76 1 BOOST_CLASS_EXPORT(Chrysalis::ConditionalArgument)
77
78 1 BOOST_CLASS_EXPORT(Chrysalis::TransformInstruction)
79 1 BOOST_CLASS_EXPORT(Chrysalis::ResetTransformationInstruction)
80 1 BOOST_CLASS_EXPORT(Chrysalis::DartInstruction)
81 1 BOOST_CLASS_EXPORT(Chrysalis::CurveInstruction)
82 1 BOOST_CLASS_EXPORT(Chrysalis::ExpressionInstruction)
83 1 BOOST_CLASS_EXPORT(Chrysalis::PatternInstructionsContainer)
84 1 BOOST_CLASS_EXPORT(Chrysalis::BaseInstructionsContainer<BaseInstruction>)
85 1 BOOST_CLASS_EXPORT(Chrysalis::ConditionalInstructionsContainer)
86 1 BOOST_CLASS_EXPORT(Chrysalis::FreePointInstruction)
87 1 BOOST_CLASS_EXPORT(Chrysalis::EdgeDartInstruction)
88 1 BOOST_CLASS_EXPORT(Chrysalis::MovePointInstruction)
89 1 BOOST_CLASS_EXPORT(Chrysalis::BuildOutlineInstruction)
90 1 BOOST_CLASS_EXPORT(Chrysalis::RelativePointInstruction)
91 1 BOOST_CLASS_EXPORT(Chrysalis::UnfoldEdgeDartInstruction)
92 1 BOOST_CLASS_EXPORT(Chrysalis::IntersectionPointInstruction)
93
94 9 Project::Project(std::string name, std::unique_ptr<ProjectSpace> space, std::unique_ptr<PatternsContainer> patterns,
95 std::unique_ptr<ParametersContainer> parameters, std::unique_ptr<OptionsContainer> options,
96 9 std::unique_ptr<ExpressionsContainer> expressions, std::unique_ptr<InstructionsContainer> instructions)
97
24/24
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
✓ Call 20 invoked.
✓ Call 21 invoked.
✓ Call 22 invoked.
✓ Call 23 invoked.
9 : name_(std::move(name)), space_(std::move(space)), options_(std::move(options)), patterns_(std::move(patterns)),
98
18/18
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
9 parameters_(std::move(parameters)), expressions_(std::move(expressions)), instructions_(std::move(instructions)),
99
1/2
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
7/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 8 invoked.
✗ Call 9 not invoked.
9 thread_([this](const std::stop_token& stopToken) -> void {
100
1/2
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
9 std::unique_lock lock(mutex_);
101
2/2
✓ Branch 2 taken 60 times.
✓ Branch 3 taken 1 times.
2/2
✓ Decision 'true' taken 60 times.
✓ Decision 'false' taken 1 times.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
70 while (!stopToken.stop_requested()) {
102
1/2
✓ Branch 6 taken 60 times.
✗ Branch 7 not taken.
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
60 startExecution_.wait(lock, [&] -> bool {
103
6/6
✓ Branch 5 taken 71 times.
✓ Branch 6 taken 47 times.
✓ Branch 11 taken 63 times.
✓ Branch 12 taken 8 times.
✓ Branch 18 taken 5 times.
✓ Branch 19 taken 58 times.
14/14
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
118 return pendingExecution_ || stopToken.stop_requested() || !queue_.empty();
104 });
105
2/2
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 52 times.
2/2
✓ Decision 'true' taken 8 times.
✓ Decision 'false' taken 52 times.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
60 if (stopToken.stop_requested()) return;
106
2/2
✓ Branch 5 taken 302 times.
✓ Branch 6 taken 52 times.
2/2
✓ Decision 'true' taken 302 times.
✓ Decision 'false' taken 52 times.
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
354 while (!queue_.empty()) {
107
10/10
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
302 auto task = std::move(queue_.front());
108
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
302 queue_.pop();
109
1/2
✓ Branch 1 taken 302 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
302 lock.unlock();
110
1/2
✓ Branch 1 taken 302 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
302 task();
111
1/2
✓ Branch 1 taken 302 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
302 lock.lock();
112
1/2
✓ Call 0 invoked.
✗ Call 1 not invoked.
302 }
113
2/2
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 48 times.
2/2
✓ Decision 'true' taken 4 times.
✓ Decision 'false' taken 48 times.
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
52 if (pendingExecution_) {
114
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
48 pendingExecution_ = false;
115
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
48 lock.unlock();
116
1/2
✓ Branch 10 taken 48 times.
✗ Branch 11 not taken.
10/10
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
48 instructions_->run();
117
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
48 lock.lock();
118 }
119 }
120
3/4
✓ Branch 14 taken 9 times.
✗ Branch 15 not taken.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 8 times.
15/24
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
✗ Call 22 not invoked.
✗ Call 23 not invoked.
✓ Call 24 invoked.
✗ Call 27 not invoked.
27 }) {}
121
122
20/20
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
90 Project::~Project() {
123
11/11
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
9 instructions_->ignore();
124
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
9 thread_.request_stop();
125
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
9 startExecution_.notify_one();
126
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
9 thread_.join();
127
20/20
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
90 }
128
129 ✗ std::unique_ptr<Project> Project::create() {
130
0/12
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ return create("Untitled");
131 }
132
133 1 std::unique_ptr<Project> Project::create(const std::string& name) {
134
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 const auto globalOptions = new OptionsContainer();
135
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 const auto globalExpressions = new ExpressionsContainer();
136 return std::make_unique<Project>(
137 name,
138
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
5/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
2 std::make_unique<ProjectSpace>(),
139
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
5/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
2 std::make_unique<PatternsContainer>(),
140
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
5/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
2 std::make_unique<ParametersContainer>(),
141
5/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
2 std::unique_ptr<OptionsContainer>(globalOptions),
142
5/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
2 std::unique_ptr<ExpressionsContainer>(globalExpressions),
143
4/12
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
20/26
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
✓ Call 20 invoked.
✓ Call 21 invoked.
✓ Call 24 invoked.
✓ Call 25 invoked.
✓ Call 26 invoked.
✓ Call 27 invoked.
✗ Call 28 not invoked.
✗ Call 31 not invoked.
✗ Call 32 not invoked.
✗ Call 35 not invoked.
✗ Call 36 not invoked.
✗ Call 37 not invoked.
3 std::make_unique<InstructionsContainer>(new OptionsContainer(globalOptions), new ExpressionsContainer(globalExpressions)));
144 }
145
146 1 std::vector<char> Project::bytes() const {
147
1/1
✓ Call 0 invoked.
1 std::vector<char> buffer;
148
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::iostreams::back_insert_device sink(buffer);
149
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::iostreams::stream os(sink);
150
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::archive::binary_oarchive archive(os);
151
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
4/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 5 invoked.
✗ Call 6 not invoked.
1 archive << this;
152 2 return buffer;
153
4/9
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
1 }
154
155 1 std::unique_ptr<Project> Project::fromBytes(const char* bytes, const size_t size) {
156
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::iostreams::array_source source(bytes, size);
157
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::iostreams::stream is(source);
158
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::archive::binary_iarchive archive(is);
159
1/1
✓ Call 0 invoked.
1 Project* project = nullptr;
160 try {
161
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
1 archive >> project;
162
1/1
✓ Call 0 invoked.
2 return std::unique_ptr<Project>(project);
163
0/2
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ } catch (const boost::archive::archive_exception &e) {
164
0/3
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ delete project;
165
0/14
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ throw ProjectIOError("Cannot read project from bytes");
166
0/1
✗ Call 0 not invoked.
✗ }
167
4/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
1 }
168
169 1 std::unique_ptr<Project> Project::read(const std::string& filePath) {
170
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 std::ifstream file(filePath, std::ios::binary);
171
1/6
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
1/2
✓ Decision 'true' taken 1 times.
✗ Decision 'false' not taken.
2/14
✓ Call 0 invoked.
✓ Call 1 invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
1 if (!file.is_open()) throw ProjectIOError("Failed to open file: " + filePath);
172
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::archive::binary_iarchive archive(file);
173
1/1
✓ Call 0 invoked.
1 Project* project = nullptr;
174 try {
175
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1/1
✓ Call 0 invoked.
1 archive >> project;
176
1/1
✓ Call 0 invoked.
2 return std::unique_ptr<Project>(project);
177
0/2
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ } catch (const boost::archive::archive_exception &e) {
178
0/3
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ delete project;
179
0/57
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
✗ Call 22 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ Call 29 not invoked.
✗ Call 30 not invoked.
✗ Call 33 not invoked.
✗ Call 34 not invoked.
✗ Call 37 not invoked.
✗ Call 38 not invoked.
✗ Call 41 not invoked.
✗ Call 42 not invoked.
✗ Call 45 not invoked.
✗ Call 46 not invoked.
✗ Call 47 not invoked.
✗ Call 48 not invoked.
✗ Call 49 not invoked.
✗ Call 50 not invoked.
✗ Call 51 not invoked.
✗ Call 52 not invoked.
✗ Call 53 not invoked.
✗ Call 54 not invoked.
✗ Call 55 not invoked.
✗ Call 56 not invoked.
✗ Call 57 not invoked.
✗ Call 58 not invoked.
✗ Call 59 not invoked.
✗ Call 60 not invoked.
✗ Call 61 not invoked.
✗ Call 62 not invoked.
✗ Call 63 not invoked.
✗ Call 64 not invoked.
✗ Call 65 not invoked.
✗ Call 66 not invoked.
✗ Call 67 not invoked.
✗ Call 68 not invoked.
✗ Call 69 not invoked.
✗ Call 70 not invoked.
✗ throw ProjectIOError("Cannot read file: " + filePath + ". Code #" + std::to_string(e.code) + ": " + e.what());
180
0/1
✗ Call 0 not invoked.
✗ }
181
4/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
1 }
182
183 1 void Project::write(const std::string& filePath, const Project& project) {
184
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 std::ofstream file(filePath, std::ios::binary);
185
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
1/2
✗ Decision 'true' not taken.
✓ Decision 'false' taken 1 times.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 if (!file.is_open()) {
186
0/1
? Decision couldn't be analyzed.
0/12
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ throw ProjectIOError("Failed to open file for write: " + filePath);
187 }
188
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 boost::archive::binary_oarchive archive(file);
189
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
4/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 5 invoked.
✗ Call 6 not invoked.
1 archive << &project;
190
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
1 file.close();
191
2/8
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
0/1
? Decision couldn't be analyzed.
2/14
✓ Call 0 invoked.
✓ Call 1 invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
1 if (!file) throw ProjectIOError("Failed to save project into: " + filePath);
192
4/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
2 }
193
194 53 void Project::execute() {
195
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
53 pendingExecution_ = true;
196
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
53 startExecution_.notify_one();
197 53 }
198
199 302 void Project::onExecuted(const std::function<void()>& function) {
200 {
201
1/2
✓ Branch 4 taken 302 times.
✗ Branch 5 not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
302 std::lock_guard lock(mutex_);
202
1/2
✓ Branch 5 taken 302 times.
✗ Branch 6 not taken.
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
302 queue_.push(function);
203
1/2
✓ Call 0 invoked.
✗ Call 1 not invoked.
302 }
204
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
302 startExecution_.notify_one();
205 302 }
206
207 ✗ std::string Project::getName() {
208
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ return name_;
209 }
210
211 ✗ void Project::setName(const std::string& name) {
212
0/5
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ name_ = name;
213 ✗ }
214
215 1 ProjectSpace* Project::getSpace() const {
216
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
1 return space_.get();
217 }
218
219 1 OptionsContainer* Project::getOptions() const {
220
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
1 return options_.get();
221 }
222
223 7 PatternsContainer* Project::getPatterns() const {
224
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
7 return patterns_.get();
225 }
226
227 28 ParametersContainer* Project::getParameters() const {
228
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
28 return parameters_.get();
229 }
230
231 ✗ ExpressionsContainer* Project::getExpressions() const {
232
0/6
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ return expressions_.get();
233 }
234
235 4 InstructionsContainer* Project::getInstructions() const {
236
6/6
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
4 return instructions_.get();
237 }
238