• 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

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

3
#include "sdfg/function.h"
4

5
namespace sdfg {
6
namespace control_flow {
7

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

20
      };
53✔
21

22
void InterstateEdge::validate(const Function& function) const {
16✔
23
    for (auto& entry : this->assignments_) {
20✔
24
        if (entry.first.is_null()) {
4✔
NEW
25
            throw InvalidSDFGException("Assignment - LHS: cannot be null");
×
26
        }
27
        if (entry.second.is_null()) {
4✔
NEW
28
            throw InvalidSDFGException("Assignment - RHS: cannot be null");
×
29
        }
30

31
        auto& lhs = entry.first;
4✔
32
        auto& type = function.type(lhs->get_name());
4✔
33
        if (type.type_id() != types::TypeID::Scalar) {
4✔
34
            throw InvalidSDFGException("Assignment - LHS: must be integer type");
×
35
        }
36

37
        auto& rhs = entry.second;
4✔
38
        for (auto& atom : symbolic::atoms(rhs)) {
5✔
39
            if (symbolic::is_nullptr(atom)) {
1✔
40
                throw InvalidSDFGException("Assignment - RHS: must be integer type, but is nullptr");
×
41
            }
42
            auto& atom_type = function.type(atom->get_name());
1✔
43
            if (atom_type.type_id() != types::TypeID::Scalar) {
1✔
44
                throw InvalidSDFGException("Assignment - RHS: must be integer type");
×
45
            }
46
        }
47
    }
48

49
    if (this->condition_.is_null()) {
16✔
NEW
50
        throw InvalidSDFGException("InterstateEdge: Condition cannot be null");
×
51
    }
52
    if (!SymEngine::is_a_Boolean(*this->condition_)) {
16✔
NEW
53
        throw InvalidSDFGException("InterstateEdge: Condition must be a boolean expression");
×
54
    }
55
    for (auto& atom : symbolic::atoms(this->condition_)) {
22✔
56
        if (symbolic::is_nullptr(atom)) {
6✔
57
            continue;
×
58
        }
59
        auto& atom_type = function.type(atom->get_name());
6✔
60
        if (atom_type.type_id() != types::TypeID::Scalar && atom_type.type_id() != types::TypeID::Pointer) {
6✔
61
            throw InvalidSDFGException("Condition: must be integer type or pointer type");
×
62
        }
63
    }
64
};
16✔
65

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

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

70
const control_flow::State& InterstateEdge::dst() const { return this->dst_; };
41✔
71

72
const symbolic::Condition InterstateEdge::condition() const { return this->condition_; };
11✔
73

74
bool InterstateEdge::is_unconditional() const { return symbolic::is_true(this->condition_); };
11✔
75

76
const sdfg::control_flow::Assignments& InterstateEdge::assignments() const { return this->assignments_; };
20✔
77

NEW
78
void InterstateEdge::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
79
    symbolic::subs(this->condition_, old_expression, new_expression);
×
80

81
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
×
82
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
×
83
        if (this->assignments_.find(old_symbol) != this->assignments_.end()) {
×
84
            auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
×
85
            this->assignments_[new_symbol] = this->assignments_[old_symbol];
×
86
            this->assignments_.erase(old_symbol);
×
87
        }
×
88
    }
×
89

90
    for (auto& entry : this->assignments_) {
×
91
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
92
    }
93
};
×
94

95
} // namespace control_flow
96
} // 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