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

daisytuner / docc / 27981272983

22 Jun 2026 08:18PM UTC coverage: 61.754% (-0.03%) from 61.782%
27981272983

Pull #781

github

web-flow
Merge bddaa3724 into fe87d162b
Pull Request #781: Extend Segformer benchmarks setup

987 of 1432 new or added lines in 62 files covered. (68.92%)

9 existing lines in 7 files now uncovered.

38121 of 61730 relevant lines covered (61.75%)

993.19 hits per line

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

76.0
/sdfg/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
#include "symengine/subs.h"
6

7
namespace sdfg {
8
namespace structured_control_flow {
9

10
IfElse::IfElse(size_t element_id, const DebugInfo& debug_info, ControlFlowNode* parent)
11
    : ControlFlowNode(element_id, debug_info, parent) {}
161✔
12

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

30
size_t IfElse::size() const { return this->cases_.size(); };
1,707✔
31

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

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

40
bool IfElse::is_complete() const {
141✔
41
    auto condition = symbolic::__false__();
141✔
42
    for (auto& entry : this->conditions_) {
223✔
43
        condition = symbolic::Or(condition, entry);
223✔
44
    }
223✔
45
    if (symbolic::is_true(condition)) return true;
141✔
46

47
    symbolic::CNF cnf_cond = symbolic::conjunctive_normal_form(condition);
72✔
48
    for (auto& clause : cnf_cond) {
82✔
49
        if (!symbolic::is_tautology(clause)) {
82✔
50
            return false;
65✔
51
        }
65✔
52
    }
82✔
53
    return true;
7✔
54
};
72✔
55

56
void IfElse::replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) {
2✔
57
    for (size_t i = 0; i < this->cases_.size(); ++i) {
6✔
58
        this->cases_.at(i)->replace(old_expression, new_expression);
4✔
59
        this->conditions_.at(i) = symbolic::subs(this->conditions_.at(i), old_expression, new_expression);
4✔
60
    }
4✔
61
}
2✔
62

NEW
63
void IfElse::replace(const symbolic::ExpressionMapping& replacements) {
×
NEW
64
    for (size_t i = 0; i < this->cases_.size(); ++i) {
×
NEW
65
        this->cases_.at(i)->replace(replacements);
×
NEW
66
        this->conditions_.at(i) = symbolic::subs(this->conditions_.at(i), replacements);
×
NEW
67
    }
×
UNCOV
68
};
×
69

70
} // namespace structured_control_flow
71
} // 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