• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / sdfglib / 17697650771

13 Sep 2025 02:09PM UTC coverage: 60.533% (+1.2%) from 59.335%
17697650771

Pull #219

github

web-flow
Merge 0edf508a7 into 6c1992b40
Pull Request #219: stdlib Library Nodes and ConstantNodes

563 of 1790 new or added lines in 102 files covered. (31.45%)

102 existing lines in 38 files now uncovered.

9442 of 15598 relevant lines covered (60.53%)

107.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.77
/src/structured_control_flow/sequence.cpp
1
#include "sdfg/structured_control_flow/sequence.h"
2

3
namespace sdfg {
4
namespace structured_control_flow {
5

6
Transition::Transition(size_t element_id, const DebugInfo& debug_info, Sequence& parent)
×
7
    : Element(element_id, debug_info), parent_(&parent) {
×
8

9
      };
×
10

11
Transition::Transition(
909✔
12
    size_t element_id, const DebugInfo& debug_info, Sequence& parent, const control_flow::Assignments& assignments
13
)
14
    : Element(element_id, debug_info), parent_(&parent), assignments_(assignments) {
909✔
15

16
      };
909✔
17

18
void Transition::validate(const Function& function) const {
694✔
19
    for (const auto& entry : this->assignments_) {
887✔
20
        if (entry.first.is_null() || entry.second.is_null()) {
193✔
NEW
21
            throw InvalidSDFGException("Transition: Assignments cannot have null expressions");
×
22
        }
23
    }
24
};
694✔
25

26
const control_flow::Assignments& Transition::assignments() const { return this->assignments_; };
23✔
27

28
control_flow::Assignments& Transition::assignments() { return this->assignments_; };
1,386✔
29

30
Sequence& Transition::parent() { return *this->parent_; };
×
31

32
const Sequence& Transition::parent() const { return *this->parent_; };
×
33

34
bool Transition::empty() const { return this->assignments_.empty(); };
21✔
35

36
size_t Transition::size() const { return this->assignments_.size(); };
46✔
37

38
void Transition::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
2✔
39
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
2✔
40
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
2✔
41
        auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
2✔
42

43
        if (this->assignments().find(old_symbol) != this->assignments().end()) {
2✔
44
            this->assignments()[new_symbol] = this->assignments()[old_symbol];
×
45
            this->assignments().erase(old_symbol);
×
46
        }
×
47
    }
2✔
48

49
    for (auto& entry : this->assignments()) {
2✔
50
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
51
    }
52
};
2✔
53

54
Sequence::Sequence(size_t element_id, const DebugInfo& debug_info)
1,768✔
55
    : ControlFlowNode(element_id, debug_info) {
884✔
56

57
      };
884✔
58

59
void Sequence::validate(const Function& function) const {
569✔
60
    // children and transition have same length
61
    if (this->children_.size() != this->transitions_.size()) {
569✔
62
        throw InvalidSDFGException("Sequence must have the same number of children and transitions");
×
63
    }
64

65
    for (auto& child : this->children_) {
1,263✔
66
        child->validate(function);
694✔
67
    }
68
    for (auto& trans : this->transitions_) {
1,263✔
69
        trans->validate(function);
694✔
70
    }
71
};
569✔
72

73
size_t Sequence::size() const { return this->children_.size(); };
9,647✔
74

75
std::pair<const ControlFlowNode&, const Transition&> Sequence::at(size_t i) const {
263✔
76
    return {*this->children_.at(i), *this->transitions_.at(i)};
263✔
77
};
78

79
std::pair<ControlFlowNode&, Transition&> Sequence::at(size_t i) {
5,516✔
80
    return {*this->children_.at(i), *this->transitions_.at(i)};
5,516✔
81
};
82

83
int Sequence::index(const ControlFlowNode& child) const {
85✔
84
    for (size_t i = 0; i < this->children_.size(); i++) {
91✔
85
        if (this->children_.at(i).get() == &child) {
91✔
86
            return static_cast<int>(i);
85✔
87
        }
88
    }
6✔
89

90
    return -1;
×
91
};
85✔
92

93
int Sequence::index(const Transition& transition) const {
×
94
    for (size_t i = 0; i < this->transitions_.size(); i++) {
×
95
        if (this->transitions_.at(i).get() == &transition) {
×
96
            return static_cast<int>(i);
×
97
        }
98
    }
×
99

100
    return -1;
×
101
};
×
102

103
void Sequence::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
2✔
104
    for (auto& child : this->children_) {
4✔
105
        child->replace(old_expression, new_expression);
2✔
106
    }
107

108
    for (auto& trans : this->transitions_) {
4✔
109
        trans->replace(old_expression, new_expression);
2✔
110
    }
111
};
2✔
112

113
} // namespace structured_control_flow
114
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc