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

daisytuner / sdfglib / 18727774411

22 Oct 2025 07:37PM UTC coverage: 61.468% (-0.3%) from 61.746%
18727774411

push

github

web-flow
Merge pull request #296 from daisytuner/fix-external-prefix

Fixes for building OpenFOAM with DOCC

9 of 19 new or added lines in 6 files covered. (47.37%)

44 existing lines in 4 files now uncovered.

9704 of 15787 relevant lines covered (61.47%)

100.86 hits per line

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

17.24
/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

UNCOV
22
void InterstateEdge::validate(const Function& function) const {
×
UNCOV
23
    for (auto& entry : this->assignments_) {
×
UNCOV
24
        auto& lhs = entry.first;
×
UNCOV
25
        auto& type = function.type(lhs->get_name());
×
UNCOV
26
        if (type.type_id() != types::TypeID::Scalar) {
×
27
            throw InvalidSDFGException("Assignment - LHS: must be integer type");
×
28
        }
UNCOV
29
        if (!types::is_integer(type.primitive_type())) {
×
30
            throw InvalidSDFGException("Assignment - LHS: must be integer type");
×
31
        }
32

UNCOV
33
        auto& rhs = entry.second;
×
UNCOV
34
        bool is_relational = SymEngine::is_a_Relational(*rhs);
×
UNCOV
35
        for (auto& atom : symbolic::atoms(rhs)) {
×
UNCOV
36
            if (symbolic::is_nullptr(atom)) {
×
37
                if (!is_relational) {
×
38
                    throw InvalidSDFGException("Assignment - RHS: nullptr can only be used in comparisons");
×
39
                }
40
                continue;
×
41
            }
UNCOV
42
            auto& atom_type = function.type(atom->get_name());
×
43

44
            // Scalar integers
UNCOV
45
            if (atom_type.type_id() == types::TypeID::Scalar) {
×
UNCOV
46
                if (!types::is_integer(atom_type.primitive_type())) {
×
47
                    throw InvalidSDFGException("Assignment - RHS: must evaluate to integer type");
×
48
                }
UNCOV
49
                continue;
×
50
            }
51

52
            // Pointer types (only in comparisons)
53
            if (atom_type.type_id() == types::TypeID::Pointer) {
×
54
                if (!is_relational) {
×
55
                    throw InvalidSDFGException("Assignment - RHS: pointer types can only be used in comparisons");
×
56
                }
57
                continue;
×
58
            }
59
        }
60
    }
61

UNCOV
62
    if (this->condition_.is_null()) {
×
63
        throw InvalidSDFGException("InterstateEdge: Condition cannot be null");
×
64
    }
UNCOV
65
    if (!SymEngine::is_a_Boolean(*this->condition_)) {
×
66
        throw InvalidSDFGException("InterstateEdge: Condition must be a boolean expression");
×
67
    }
UNCOV
68
    for (auto& atom : symbolic::atoms(this->condition_)) {
×
UNCOV
69
        if (symbolic::is_nullptr(atom)) {
×
70
            continue;
×
71
        }
UNCOV
72
        auto& atom_type = function.type(atom->get_name());
×
UNCOV
73
        if (atom_type.type_id() != types::TypeID::Scalar && atom_type.type_id() != types::TypeID::Pointer) {
×
74
            throw InvalidSDFGException("Condition: must be integer type or pointer type");
×
75
        }
76
    }
UNCOV
77
};
×
78

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

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

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

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

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

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

91
void InterstateEdge::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
92
    symbolic::subs(this->condition_, old_expression, new_expression);
×
93

94
    if (SymEngine::is_a<SymEngine::Symbol>(*old_expression) && SymEngine::is_a<SymEngine::Symbol>(*new_expression)) {
×
95
        auto old_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(old_expression);
×
96
        if (this->assignments_.find(old_symbol) != this->assignments_.end()) {
×
97
            auto new_symbol = SymEngine::rcp_static_cast<const SymEngine::Symbol>(new_expression);
×
98
            this->assignments_[new_symbol] = this->assignments_[old_symbol];
×
99
            this->assignments_.erase(old_symbol);
×
100
        }
×
101
    }
×
102

103
    for (auto& entry : this->assignments_) {
×
104
        entry.second = symbolic::subs(entry.second, old_expression, new_expression);
×
105
    }
106
};
×
107

108
} // namespace control_flow
109
} // 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