Chrysalis - Pattern Test Coverage


pattern/
File: pattern/include/NamedElementsContainer.h
Date: 2026-08-27 18:35:18
Lines:
10/10
100.0%
Functions:
19/21
90.5%
Branches:
2/3
66.7%
Decisions:
2/2
100.0%
Calls:
44/55
80.0%

Line Branch Decision Call Exec Source
1 #ifndef CHRYSALIS_NAMEDELEMENTSCONTAINER_H
2 #define CHRYSALIS_NAMEDELEMENTSCONTAINER_H
3
4 #include <unordered_map>
5
6 #include "BaseNamedElement.h"
7 #include "CompositiveContainer.h"
8
9 namespace Chrysalis {
10 template<typename T>
11 requires std::derived_from<T, BaseNamedElement>
12 class NamedElementsContainer: public CompositiveContainer<T> {
13
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.
448 SERIALIZE_DERIVED_FROM(CompositiveContainer<T>, names_)
14 public:
15 112 [[nodiscard]] virtual bool has(const std::string& name) const {
16
7/7
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
112 return names_.contains(name);
17 }
18 40 void add(T* item) override {
19
5/5
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
40 CompositiveContainer<T>::add(item);
20
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.
40 names_[item->getName()] = item;
21
2/3
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 17 times.
2/2
✓ Decision 'true' taken 38 times.
✓ Decision 'false' taken 2 times.
4/15
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 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 15 not invoked.
40 if (item->hasAlias()) names_[item->getAlias()] = item;
22 40 }
23 53 virtual T* get(const std::string& name) const {
24
8/8
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
53 return names_.at(name);
25 }
26 private:
27 std::unordered_map<std::string, T*> names_;
28 };
29 }
30
31 #endif //CHRYSALIS_NAMEDELEMENTSCONTAINER_H
32