Chrysalis - Pattern Test Coverage


pattern/
File: pattern/include/arguments/VectorFunctionArgument.h
Date: 2026-08-27 18:35:18
Lines:
2/2
100.0%
Functions:
12/12
100.0%
Branches:
3/8
37.5%
Decisions:
0/0
-%
Calls:
23/24
95.8%

Line Branch Decision Call Exec Source
1 #ifndef CHRYSALIS_VECTORFUNCTIONARGUMENT_H
2 #define CHRYSALIS_VECTORFUNCTIONARGUMENT_H
3
4 #include "arguments/PatternPointArgument.h"
5 #include "arguments/BaseCalculatedArgument.h"
6
7 #define VECTOR_FUNCTIONS (Length)(Angle)
8
9 namespace Chrysalis {
10 /** @defgroup Arguments Arguments
11 * @{
12 */
13 /**
14 * @uml{note[top] Syntax samples:
15 * (A -> B).length
16 * (A ("Pattern 1") -> "A 1").angle
17 * }
18 */
19 class VectorFunctionArgument: public BaseCalculatedArgument<double> {
20
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
208 SERIALIZE_DERIVED_FROM(BaseCalculatedArgument)
21 protected:
22 explicit VectorFunctionArgument(const args::point* from, const args::point* to);
23 public:
24 ~VectorFunctionArgument() override;
25
26 #define FORWARD_DECLARE(r, data, Name) class Name;
27 BOOST_PP_SEQ_FOR_EACH(FORWARD_DECLARE, _, VECTOR_FUNCTIONS)
28 #undef FORWARD_DECLARE
29 protected:
30 std::expected<double, Error> calculate() const override;
31 virtual std::expected<double, Error> evaluate(const CG::Point& from, const CG::Point& to) const = 0;
32
33 /// @uml{composition}
34 const args::point* from_;
35 /// @uml{composition}
36 const args::point* to_;
37 };
38
39 #define DECLARE_VECTOR_FUNCTION(r, data, Name) \
40 class VectorFunctionArgument::Name: public VectorFunctionArgument { \
41 PROVIDE_SERIALIZATION_ACCESS(VectorFunctionArgument::Name) \
42 public: \
43 explicit Name(const args::point* from, const args::point* to): VectorFunctionArgument(from, to) {} \
44 protected: \
45 std::expected<double, Error> evaluate(const CG::Point& from, const CG::Point& to) const override; \
46 }; \
47 SERIALIZE_DERIVED_CONSTRUCTION(VectorFunctionArgument::Name, VectorFunctionArgument, from_, to_);
48
3/8
✓ Branch 4 taken 52 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 52 times.
✗ Branch 9 not taken.
✓ Branch 17 taken 52 times.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
18/19
✓ 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 19 invoked.
✗ Call 22 not invoked.
952 BOOST_PP_SEQ_FOR_EACH(DECLARE_VECTOR_FUNCTION, _, VECTOR_FUNCTIONS)
49 #undef DECLARE_VECTOR_FUNCTION
50 }
51
52 #endif //CHRYSALIS_VECTORFUNCTIONARGUMENT_H
53