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

daisytuner / sdfglib / 15948486670

28 Jun 2025 09:48PM UTC coverage: 65.154% (+0.1%) from 65.01%
15948486670

push

github

web-flow
Merge pull request #117 from daisytuner/while-loops

Improves lifting of for loops

27 of 53 new or added lines in 4 files covered. (50.94%)

1 existing line in 1 file now uncovered.

8571 of 13155 relevant lines covered (65.15%)

144.59 hits per line

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

84.62
/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)
114✔
7
    : Element(element_id, debug_info), parent_(parent) {
57✔
8

9
      };
57✔
10

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

15
      };
884✔
16

17
const control_flow::Assignments& Transition::assignments() const { return this->assignments_; };
22✔
18

19
control_flow::Assignments& Transition::assignments() { return this->assignments_; };
1,452✔
20

21
Sequence& Transition::parent() { return this->parent_; };
×
22

23
const Sequence& Transition::parent() const { return this->parent_; };
×
24

25
bool Transition::empty() const { return this->assignments_.empty(); };
109✔
26

27
size_t Transition::size() const { return this->assignments_.size(); };
45✔
28

29
void Transition::replace(const symbolic::Expression& old_expression,
10✔
30
                         const symbolic::Expression& new_expression) {
31
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) &&
10✔
32
        SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
10✔
33
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
10✔
34
        auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
10✔
35

36
        if (this->assignments().find(old_symbol) != this->assignments().end()) {
10✔
NEW
37
            this->assignments()[new_symbol] = this->assignments()[old_symbol];
×
NEW
38
            this->assignments().erase(old_symbol);
×
NEW
39
        }
×
40
    }
10✔
41

42
    for (auto& entry : this->assignments()) {
10✔
NEW
43
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
44
    }
45
};
10✔
46

47
Sequence::Sequence(size_t element_id, const DebugInfo& debug_info)
1,808✔
48
    : ControlFlowNode(element_id, debug_info) {
904✔
49

50
      };
904✔
51

52
size_t Sequence::size() const { return this->children_.size(); };
7,084✔
53

54
std::pair<const ControlFlowNode&, const Transition&> Sequence::at(size_t i) const {
245✔
55
    return {*this->children_.at(i), *this->transitions_.at(i)};
245✔
56
};
57

58
std::pair<ControlFlowNode&, Transition&> Sequence::at(size_t i) {
3,813✔
59
    return {*this->children_.at(i), *this->transitions_.at(i)};
3,813✔
60
};
61

62
void Sequence::replace(const symbolic::Expression& old_expression,
14✔
63
                       const symbolic::Expression& new_expression) {
64
    for (auto& child : this->children_) {
24✔
65
        child->replace(old_expression, new_expression);
10✔
66
    }
67

68
    for (auto& trans : this->transitions_) {
24✔
69
        trans->replace(old_expression, new_expression);
10✔
70
    }
71
};
14✔
72

73
}  // namespace structured_control_flow
74
}  // 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

© 2025 Coveralls, Inc