• 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

88.89
/src/structured_control_flow/structured_loop.cpp
1
#include "sdfg/structured_control_flow/structured_loop.h"
2

3
namespace sdfg {
4
namespace structured_control_flow {
5

6
StructuredLoop::StructuredLoop(size_t element_id, const DebugInfo& debug_info,
426✔
7
                               symbolic::Symbol indvar, symbolic::Expression init,
8
                               symbolic::Expression update, symbolic::Condition condition)
9
    : ControlFlowNode(element_id, debug_info),
213✔
10
      indvar_(indvar),
213✔
11
      init_(init),
213✔
12
      update_(update),
213✔
13
      condition_(condition) {
426✔
14
    this->root_ = std::unique_ptr<Sequence>(new Sequence(++element_id, debug_info));
213✔
15
}
213✔
16

17
const symbolic::Symbol& StructuredLoop::indvar() const { return this->indvar_; };
30✔
18

19
symbolic::Symbol& StructuredLoop::indvar() { return this->indvar_; };
792✔
20

21
const symbolic::Expression& StructuredLoop::init() const { return this->init_; };
14✔
22

23
symbolic::Expression& StructuredLoop::init() { return this->init_; };
481✔
24

25
const symbolic::Expression& StructuredLoop::update() const { return this->update_; };
14✔
26

27
symbolic::Expression& StructuredLoop::update() { return this->update_; };
454✔
28

29
const symbolic::Condition& StructuredLoop::condition() const { return this->condition_; };
22✔
30

31
symbolic::Condition& StructuredLoop::condition() { return this->condition_; };
498✔
32

33
Sequence& StructuredLoop::root() const { return *this->root_; };
1,950✔
34

35
void StructuredLoop::replace(const symbolic::Expression& old_expression,
2✔
36
                             const symbolic::Expression& new_expression) {
37
    if (symbolic::eq(this->indvar_, old_expression) &&
2✔
NEW
38
        SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
×
39
        this->indvar_ = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
×
40
    }
×
41
    this->init_ = symbolic::subs(this->init_, old_expression, new_expression);
2✔
42
    this->update_ = symbolic::subs(this->update_, old_expression, new_expression);
2✔
43
    this->condition_ = symbolic::subs(this->condition_, old_expression, new_expression);
2✔
44

45
    this->root_->replace(old_expression, new_expression);
2✔
46
};
2✔
47

48
}  // namespace structured_control_flow
49
}  // 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