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

daisytuner / sdfglib / 20764569418

06 Jan 2026 10:50PM UTC coverage: 62.168% (+21.4%) from 40.764%
20764569418

push

github

web-flow
Merge pull request #433 from daisytuner/clang-coverage

updates clang coverage flags

14988 of 24109 relevant lines covered (62.17%)

88.57 hits per line

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

75.0
/src/structured_control_flow/if_else.cpp
1
#include "sdfg/structured_control_flow/if_else.h"
2

3
#include "sdfg/symbolic/conjunctive_normal_form.h"
4
#include "sdfg/symbolic/symbolic.h"
5

6
namespace sdfg {
7
namespace structured_control_flow {
8

9
IfElse::IfElse(size_t element_id, const DebugInfo& debug_info)
10
    : ControlFlowNode(element_id, debug_info) {
91✔
11

12
      };
91✔
13

14
void IfElse::validate(const Function& function) const {
82✔
15
    for (auto& entry : this->cases_) {
153✔
16
        entry->validate(function);
153✔
17
    }
153✔
18
    for (auto& entry : this->conditions_) {
153✔
19
        if (entry.is_null()) {
153✔
20
            throw InvalidSDFGException("IfElse: Conditions cannot be null");
×
21
        }
×
22
        if (!SymEngine::is_a_Boolean(*entry)) {
153✔
23
            throw InvalidSDFGException("IfElse: Conditions must be boolean expressions");
×
24
        }
×
25
    }
153✔
26
    if (this->cases_.size() != this->conditions_.size()) {
82✔
27
        throw InvalidSDFGException("IfElse: Number of cases must be equal to number of conditions");
×
28
    }
×
29
};
82✔
30

31
size_t IfElse::size() const { return this->cases_.size(); };
755✔
32

33
std::pair<const Sequence&, const symbolic::Condition> IfElse::at(size_t i) const {
53✔
34
    return {*this->cases_.at(i), this->conditions_.at(i)};
53✔
35
};
53✔
36

37
std::pair<Sequence&, const symbolic::Condition> IfElse::at(size_t i) {
551✔
38
    return {*this->cases_.at(i), this->conditions_.at(i)};
551✔
39
};
551✔
40

41
bool IfElse::is_complete() const {
75✔
42
    auto condition = symbolic::__false__();
75✔
43
    for (auto& entry : this->conditions_) {
129✔
44
        condition = symbolic::Or(condition, entry);
129✔
45
    }
129✔
46
    symbolic::CNF cnf_cond = symbolic::conjunctive_normal_form(condition);
75✔
47
    for (auto& clause : cnf_cond) {
76✔
48
        auto cond = symbolic::__false__();
76✔
49
        for (auto& literal : clause) {
82✔
50
            cond = symbolic::Or(cond, literal);
82✔
51
        }
82✔
52
        if (!symbolic::is_true(cond)) {
76✔
53
            return false;
22✔
54
        }
22✔
55
    }
76✔
56
    return true;
53✔
57
};
75✔
58

59
void IfElse::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
×
60
    for (size_t i = 0; i < this->cases_.size(); ++i) {
×
61
        this->cases_.at(i)->replace(old_expression, new_expression);
×
62
        this->conditions_.at(i) = symbolic::subs(this->conditions_.at(i), old_expression, new_expression);
×
63
    }
×
64
};
×
65

66
} // namespace structured_control_flow
67
} // 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