Chrysalis - Pattern Test Coverage


pattern/
File: pattern/include/PatternSpace.h
Date: 2026-08-27 18:35:18
Lines:
1/1
100.0%
Functions:
4/4
100.0%
Branches:
2/6
33.3%
Decisions:
0/0
-%
Calls:
14/18
77.8%

Line Branch Decision Call Exec Source
1 #ifndef CHRYSALIS_PATTERNSPACE_H
2 #define CHRYSALIS_PATTERNSPACE_H
3
4 #include <unordered_map>
5
6 #include "Outline.h"
7 #include "ProjectSpace.h"
8 #include "Transformation.h"
9 #include "observers/BaseObservable.h"
10 #include "observers/PatternShapeObserver.h"
11 #include "observers/PatternTraceObserver.h"
12
13 namespace Chrysalis {
14 class PatternSpace: public BaseObservable<PatternTraceObserver>, public BaseObservable<PatternShapeObserver> {
15 PROVIDE_SERIALIZATION_ACCESS(PatternSpace)
16 public:
17 using trace = BaseObservable<PatternTraceObserver>;
18 using shape = BaseObservable<PatternShapeObserver>;
19
20 explicit PatternSpace(OutlineContainer outline);
21 static PatternSpace* create();
22
23 [[nodiscard]] bool hasPoint(const std::string& name) const;
24 [[nodiscard]] bool hasOutline(const std::string& name) const;
25
26 [[nodiscard]] const Point* getLastPoint() const;
27 [[nodiscard]] const OutlineContainer& getOutline() const;
28 [[nodiscard]] const Transformation& getTransformation() const;
29 [[nodiscard]] const Point* getPoint(const std::string& name) const;
30 [[nodiscard]] const std::unordered_map<std::string, const Point*>& getPoints() const;
31
32 void transform(const Transformation& transformation);
33 void addPoint(const std::string& name, const Point* point);
34 private:
35 Transformation transformation_;
36
37 const Point* lastPoint_ = nullptr;
38 /// @uml{composition}
39 OutlineContainer outline_;
40 std::unordered_map<std::string, const Point*> points_;
41 };
42
2/6
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
14/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 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
40 SERIALIZE_CONSTRUCTION(PatternSpace, outline_)
43 }
44
45 #endif //CHRYSALIS_PATTERNSPACE_H
46