LCOV - code coverage report
Current view: top level - src/IR - Condition.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 25 20.0 %
Date: 2025-03-25 01:19:55 Functions: 2 4 50.0 %
Branches: 1 16 6.2 %

           Branch data     Line data    Source code
       1                 :            : #include <mutable/IR/Condition.hpp>
       2                 :            : 
       3                 :            : 
       4                 :            : using namespace m;
       5                 :            : 
       6                 :            : 
       7                 :        243 : bool ConditionSet::implied_by(const ConditionSet &other) const
       8                 :            : {
       9         [ -  + ]:        243 :     for (auto &this_entry : this->type2cond_) {
      10                 :          0 :         auto it = other.type2cond_.find(this_entry.first);
      11         [ #  # ]:          0 :         if (it == other.type2cond_.cend())
      12                 :          0 :             return false; // condition not found
      13         [ #  # ]:          0 :         if (not this_entry.second->implied_by(*it->second))
      14                 :          0 :             return false; // condition does not imply this condition
      15                 :            :     }
      16                 :        243 :     return true;
      17                 :        243 : }
      18                 :            : 
      19                 :          0 : void ConditionSet::project_and_rename(const std::vector<std::pair<Schema::Identifier, Schema::Identifier>> &old2new)
      20                 :            : {
      21         [ #  # ]:          0 :     for (auto &entry : type2cond_)
      22                 :          0 :         entry.second->project_and_rename(old2new);
      23                 :          0 : }
      24                 :            : 
      25                 :          0 : bool ConditionSet::operator==(const ConditionSet &other) const
      26                 :            : {
      27         [ #  # ]:          0 :     if (this->type2cond_.size() != other.type2cond_.size())
      28                 :          0 :         return false; // different number of conditions
      29                 :            : 
      30         [ #  # ]:          0 :     for (auto &this_entry : this->type2cond_) {
      31                 :          0 :         auto it = other.type2cond_.find(this_entry.first);
      32         [ #  # ]:          0 :         if (it == other.type2cond_.cend())
      33                 :          0 :             return false; // condition not found
      34         [ #  # ]:          0 :         if (*this_entry.second != *it->second)
      35                 :          0 :             return false; // condition differs
      36                 :            :     }
      37                 :          0 :     return true;
      38                 :          0 : }

Generated by: LCOV version 1.16