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

antonvw / wex / 25223915229

01 May 2026 05:01PM UTC coverage: 64.301% (+0.09%) from 64.21%
25223915229

Pull #1239

github

antonvw
changes after review
Pull Request #1239: update compare_file to specify compare type

18769 of 32065 branches covered (58.53%)

Branch coverage included in aggregate %.

14980 of 20421 relevant lines covered (73.36%)

1456.25 hits per line

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

42.05
/src/factory/unified-diff.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
// Name:      unified-diff.cpp
3
// Purpose:   Implementation of class wex::factory::unified_diff
4
//            https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
5
// Author:    Anton van Wezenbeek
6
// Copyright: (c) 2024-2026 Anton van Wezenbeek
7
////////////////////////////////////////////////////////////////////////////////
8

9
#include <wex/core/log.h>
10
#include <wex/factory/frame.h>
11
#include <wex/factory/unified-diff.h>
12
#include <wx/app.h>
13

14
#include <algorithm>
15
#include <utility>
16

17
#include "unified-diff-parser.h"
18

19
wex::factory::unified_diff::unified_diff(
29✔
20
  std::string     input,
21
  factory::frame* frame)
29✔
22
  : m_input(std::move(input))
29✔
23
  , m_range{0, 0, 0, 0}
29✔
24
  , m_frame(frame)
29✔
25
{
26
  if (
29✔
27
    auto* frame = dynamic_cast<wex::factory::frame*>(wxTheApp->GetTopWindow());
29!
28
    frame != nullptr && m_frame != nullptr)
29✔
29
  {
30
    m_frame = frame;
5✔
31
  }
32

33
  if (m_frame != nullptr)
29✔
34
  {
35
    m_frame->page_save();
5✔
36
  }
37
}
29✔
38

39
bool wex::factory::unified_diff::parse()
19✔
40
{
41
  return unified_diff_parser(this).parse();
19✔
42
}
43

44
bool wex::factory::unified_diff::report_diff()
15✔
45
{
46
  return m_frame != nullptr && m_frame->report_unified_diff(this);
15!
47
}
48

49
void wex::factory::unified_diff::report_diff_finish()
11✔
50
{
51
  if (m_frame != nullptr)
11!
52
  {
53
    m_frame->report_unified_diff(this);
×
54
    m_frame->page_restore();
×
55
  }
56
}
11✔
57

58
wex::path wex::factory::unified_diff::report_path() const
1✔
59
{
60
  return path_to();
1✔
61
}
62

63
void wex::factory::unified_diff::trace(const std::string& text) const
41✔
64
{
65
  if (log::get_level() != log::level_t::TRACE)
41!
66
  {
67
    return;
41✔
68
  }
69

70
  using boost::describe::operators::operator<<;
71

72
  std::stringstream str;
×
73
  str << "type: " << boost::describe::enum_to_string(m_type, "none") << " "
×
74
      << *this << " ranges: ";
×
75

76
  std::ranges::for_each(
×
77
    m_range,
×
78
    [this, &str](const auto& it)
×
79
    {
80
      str << std::to_string(it) << ",";
×
81
    });
×
82

83
  str << " text sizes: ";
×
84

85
  std::ranges::for_each(
×
86
    m_text,
×
87
    [this, &str](const auto& it)
×
88
    {
89
      str << it.size() << ",";
×
90
    });
×
91

92
  str << " paths: ";
×
93

94
  std::ranges::for_each(
×
95
    m_path,
×
96
    [this, &str](const auto& it)
×
97
    {
98
      str << it.string() << ",";
×
99
    });
×
100

101
  log::trace("unified_diff::" + text) << str.str();
×
102
}
×
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