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

daisytuner / sdfglib / 15947600317

28 Jun 2025 07:47PM UTC coverage: 65.01% (+0.04%) from 64.97%
15947600317

push

github

web-flow
Merge pull request #116 from daisytuner/robust-replace

makes symbolic replace more robust

10 of 14 new or added lines in 4 files covered. (71.43%)

1 existing line in 1 file now uncovered.

8554 of 13158 relevant lines covered (65.01%)

144.54 hits per line

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

51.72
/src/control_flow/interstate_edge.cpp
1
#include "sdfg/control_flow/interstate_edge.h"
2

3
namespace sdfg {
4
namespace control_flow {
5

6
InterstateEdge::InterstateEdge(size_t element_id, const DebugInfo& debug_info,
51✔
7
                               const graph::Edge& edge, const control_flow::State& src,
8
                               const control_flow::State& dst, const symbolic::Condition& condition,
9
                               const sdfg::control_flow::Assignments& assignments)
10
    : Element(element_id, debug_info),
51✔
11
      edge_(edge),
51✔
12
      src_(src),
51✔
13
      dst_(dst),
51✔
14
      condition_(condition),
51✔
15
      assignments_(assignments) {
51✔
16

17
      };
51✔
18

19
const graph::Edge InterstateEdge::edge() const { return this->edge_; };
2✔
20

21
const control_flow::State& InterstateEdge::src() const { return this->src_; };
8✔
22

23
const control_flow::State& InterstateEdge::dst() const { return this->dst_; };
37✔
24

25
const symbolic::Condition& InterstateEdge::condition() const { return this->condition_; };
11✔
26

27
bool InterstateEdge::is_unconditional() const { return symbolic::is_true(this->condition_); };
9✔
28

29
const sdfg::control_flow::Assignments& InterstateEdge::assignments() const {
18✔
30
    return this->assignments_;
18✔
31
};
32

33
void InterstateEdge::replace(const symbolic::Expression& old_expression,
×
34
                             const symbolic::Expression& new_expression) {
35
    symbolic::subs(this->condition_, old_expression, new_expression);
×
36

NEW
37
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) &&
×
NEW
38
        SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
×
39
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
×
40
        if (this->assignments_.find(old_symbol) != this->assignments_.end()) {
×
41
            auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
×
42
            this->assignments_[new_symbol] = this->assignments_[old_symbol];
×
43
            this->assignments_.erase(old_symbol);
×
44
        }
×
45
    }
×
46

47
    for (auto& entry : this->assignments_) {
×
48
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
49
    }
50
};
×
51

52
}  // namespace control_flow
53
}  // 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