LCOV - code coverage report
Current view: top level - src/esys/repo/git - aheadbehind_git.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 11 20 55.0 %
Date: 2026-08-01 10:43:40 Functions: 5 8 62.5 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/git/aheadbehind_git.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2023 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #include "esys/repo/esysrepo_prec.h"
      19             : #include "esys/repo/git/aheadbehind.h"
      20             : 
      21             : namespace esys::repo::git
      22             : {
      23             : 
      24           1 : AheadBehind::AheadBehind() = default;
      25             : 
      26           6 : void AheadBehind::set_ahead(std::size_t ahead)
      27             : {
      28           6 :     m_ahead = ahead;
      29           6 : }
      30             : 
      31           3 : std::size_t AheadBehind::get_ahead() const
      32             : {
      33           3 :     return m_ahead;
      34             : }
      35             : 
      36           6 : void AheadBehind::set_behind(std::size_t behind)
      37             : {
      38           6 :     m_behind = behind;
      39           6 : }
      40             : 
      41           3 : std::size_t AheadBehind::get_behind() const
      42             : {
      43           3 :     return m_behind;
      44             : }
      45             : 
      46           0 : bool AheadBehind::operator==(const AheadBehind &other) const
      47             : {
      48           0 :     if (get_ahead() != other.get_ahead()) return false;
      49           0 :     if (get_behind() != other.get_behind()) return false;
      50             :     return true;
      51             : }
      52             : 
      53           0 : bool AheadBehind::operator!=(const AheadBehind &other) const
      54             : {
      55           0 :     return !operator==(other);
      56             : }
      57             : 
      58             : } // namespace esys::repo::git
      59             : 
      60             : namespace std
      61             : {
      62             : 
      63           0 : ESYSREPO_API ostream &operator<<(ostream &os, const esys::repo::git::AheadBehind &ahead_behind)
      64             : {
      65           0 :     os << "ahead  : " << ahead_behind.get_ahead() << std::endl;
      66           0 :     os << "behind : " << ahead_behind.get_behind();
      67           0 :     return os;
      68             : }
      69             : 
      70             : } // namespace std

Generated by: LCOV version 1.14