Chrysalis - Pattern Test Coverage


pattern/
File: pattern/src/Curve.cpp
Date: 2026-08-27 18:35:18
Lines:
17/25
68.0%
Functions:
2/3
66.7%
Branches:
15/46
32.6%
Decisions:
2/4
50.0%
Calls:
68/124
54.8%

Line Branch Decision Call Exec Source
1 #include "Curve.h"
2
3 using namespace Chrysalis;
4
5 6 Curve::Curve(const CG::Point handleFrom, const CG::Point handleTo, const std::vector<CG::Point>& points)
6
1/2
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
4/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 5 invoked.
✗ Call 6 not invoked.
6 : spline_([&] {
7
1/1
✓ Call 0 invoked.
6 std::vector<tinyspline::real> coordinates;
8
1/2
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
6 coordinates.reserve(points.size() * 2);
9
2/2
✓ Branch 11 taken 27 times.
✓ Branch 12 taken 6 times.
2/2
✓ Decision 'true' taken 27 times.
✓ Decision 'false' taken 6 times.
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.
33 for (const auto& p : points) {
10
2/4
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 27 times.
✗ Branch 7 not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
27 coordinates.push_back(p.x());
11
2/4
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 27 times.
✗ Branch 7 not taken.
4/4
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
27 coordinates.push_back(p.y());
12 }
13
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
6 auto spline = tinyspline::BSpline::interpolateCubicNatural(coordinates, 2);
14
15
3/3
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
6 const auto last = (points.size() * 2 - 4) * 4;
16
1/2
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
2/2
✓ Call 0 invoked.
✓ Call 1 invoked.
6 auto controlPoints = spline.controlPoints();
17
1/2
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
7/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
6 controlPoints[2] = handleFrom.x();
18
1/2
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
7/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
6 controlPoints[3] = handleFrom.y();
19
1/2
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
7/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
6 controlPoints[last + 4] = handleTo.x();
20
1/2
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
7/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
6 controlPoints[last + 5] = handleTo.y();
21
22
1/2
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
3/3
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
6 spline.setControlPoints(controlPoints);
23 12 return spline;
24
2/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
12 }()) {}
25
26 ✗ std::vector<CG::Point> Curve::curvePoints(const double distance) const {
27
0/13
✗ 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 8 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.
✗ const int n = static_cast<int>(std::ceil(spline_.chordLengths().arcLength() / distance));
28
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ std::vector<CG::Point> points(n + 1);
29
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
✗ for (int i = 0; i <= n; i++) {
30
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 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.
✗ const auto res = spline_.eval(static_cast<double>(i) / n).resultVec2();
31
0/18
✗ 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 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 22 not invoked.
✗ Call 23 not invoked.
✗ points[i] = {res.x(), res.y()};
32 }
33 ✗ return points;
34
0/1
✗ Call 0 not invoked.
✗ }
35