Chrysalis - Pattern Test Coverage


pattern/
File: pattern/src/IntersectionPointInstruction.cpp
Date: 2026-08-27 18:35:18
Lines:
20/23
87.0%
Functions:
3/3
100.0%
Branches:
29/68
42.6%
Decisions:
8/16
50.0%
Calls:
172/235
73.2%

Line Branch Decision Call Exec Source
1 #include "instructions/IntersectionPointInstruction.h"
2
3 #include <ranges>
4
5 #include "arguments/SegmentArgument.h"
6
7 using namespace Chrysalis;
8
9 9 IntersectionPointInstruction::IntersectionPointInstruction(ProjectSpace* space, args::patterns* patterns,
10 const args::line* line,
11 const args::container<Argument<std::string>>* names,
12
1/1
✓ Call 0 invoked.
9 const args::container<args::line>* targets)
13
17/17
✓ 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.
9 : BasePatternInstruction(space, patterns), line_(line), names_(names), targets_(targets) {}
14
15
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
36 IntersectionPointInstruction::~IntersectionPointInstruction() {
16
1/2
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
11/11
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
18 delete line_;
17
1/2
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
11/11
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
18 delete names_;
18
1/2
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
11/11
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
18 delete targets_;
19
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
36 }
20
21 9 void IntersectionPointInstruction::execute() {
22
3/4
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 6 times.
2/2
✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 6 times.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
9 if (dynamic_cast<const args::segment*>(line_)) {
23
24
2/4
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
1/2
✓ Decision 'true' taken 3 times.
✗ Decision 'false' not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
3 } else if (dynamic_cast<const args::vector*>(line_)) {
25
26
1/2
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
1/2
✓ Decision 'true' taken 3 times.
✗ Decision 'false' not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
3 } else if (dynamic_cast<const args::ray*>(line_)) {
27
28 } else {
29 }
30
8/14
✓ Branch 12 taken 9 times.
✗ Branch 13 not taken.
✓ Branch 17 taken 9 times.
✗ Branch 18 not taken.
✓ Branch 22 taken 9 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 18 times.
✗ Branch 27 not taken.
✓ Branch 31 taken 18 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 27 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 18 times.
✓ Branch 37 taken 9 times.
0/1
? Decision couldn't be analyzed.
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 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 19 invoked.
✓ Call 20 invoked.
✓ Call 21 invoked.
✓ Call 24 invoked.
✓ Call 25 invoked.
✓ Call 28 invoked.
✓ Call 29 invoked.
✓ Call 30 invoked.
✓ Call 33 invoked.
27 for (auto [name, otherLine] : std::views::zip(*names_, *targets_)) {
31
1/1
✓ Call 0 invoked.
18 std::optional<CG::Point> intersection;
32
2/4
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
1/2
✓ Decision 'true' taken 18 times.
✗ Decision 'false' not taken.
2/2
✓ Call 0 invoked.
✓ Call 3 invoked.
18 if (const auto vector = dynamic_cast<const args::vector*>(otherLine)) {
33
3/6
✓ Branch 9 taken 18 times.
✗ Branch 10 not taken.
✓ Branch 21 taken 18 times.
✗ Branch 22 not taken.
✓ Branch 25 taken 18 times.
✗ Branch 26 not taken.
26/29
✓ 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 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 23 invoked.
✓ Call 24 invoked.
✓ Call 27 invoked.
✓ Call 28 invoked.
✓ Call 29 invoked.
✓ Call 30 invoked.
✓ Call 31 invoked.
✗ Call 32 not invoked.
✗ Call 33 not invoked.
✗ Call 34 not invoked.
18 intersection = CG::intersection(static_cast<CG::Line>(*line_), static_cast<CG::Segment>(*vector));
34
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/2
✗ Call 0 not invoked.
✗ Call 3 not invoked.
✗ } else if (const auto ray = dynamic_cast<const args::ray*>(otherLine)) {
35
0/26
✗ 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 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 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ Call 27 not invoked.
✗ Call 28 not invoked.
✗ Call 29 not invoked.
✗ Call 30 not invoked.
✗ Call 31 not invoked.
✗ intersection = CG::intersection(static_cast<CG::Line>(*line_), static_cast<CG::Ray>(*ray));
36 } else {
37
0/30
✗ 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 12 not invoked.
✗ Call 13 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.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 28 not invoked.
✗ Call 29 not invoked.
✗ Call 30 not invoked.
✗ Call 31 not invoked.
✗ Call 32 not invoked.
✗ Call 33 not invoked.
✗ Call 34 not invoked.
✗ Call 35 not invoked.
✗ intersection = CG::intersection(static_cast<CG::Line>(*line_), static_cast<CG::Line>(*otherLine));
38 }
39
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
1/2
✓ Decision 'true' taken 18 times.
✗ Decision 'false' not taken.
1/1
✓ Call 0 invoked.
18 if (intersection) {
40
2/2
✓ Branch 22 taken 18 times.
✓ Branch 23 taken 18 times.
2/2
✓ Decision 'true' taken 18 times.
✓ Decision 'false' taken 18 times.
22/22
✓ 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.
36 for (const auto pattern : *patterns_) {
41
4/8
✓ Branch 12 taken 18 times.
✗ Branch 13 not taken.
✓ Branch 22 taken 18 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 18 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 18 times.
✗ Branch 31 not taken.
26/28
✓ 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 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
✓ Call 20 invoked.
✓ Call 21 invoked.
✓ Call 24 invoked.
✓ Call 25 invoked.
✓ Call 28 invoked.
✓ Call 29 invoked.
✓ Call 32 invoked.
✓ Call 33 invoked.
✗ Call 34 not invoked.
✗ Call 35 not invoked.
18 pattern->addPoint(name->get().value(), space().addPoint(*intersection));
42 }
43 }
44 }
45 9 }
46