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

thetic / mutiny / 24573089316

17 Apr 2026 03:28PM UTC coverage: 97.192% (-1.4%) from 98.629%
24573089316

Pull #59

github

web-flow
Merge 7426fcdfb into e0583988c
Pull Request #59: Disunity

1 of 3 new or added lines in 2 files covered. (33.33%)

74 existing lines in 7 files now uncovered.

4984 of 5128 relevant lines covered (97.19%)

3235.13 hits per line

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

95.88
/src/test/TestingFixture.cpp
1
#include "mutiny/test/TestingFixture.hpp"
2

3
#include "mutiny/test/ExecFunctionShell.hpp"
4
#include "mutiny/test/Result.hpp"
5
#include "mutiny/test/Shell.hpp"
6

7
namespace mu {
8
namespace tiny {
9
namespace test {
10

11
bool TestingFixture::line_of_code_executed_after_check_ = false;
12

13
void TestingFixture::replace_output(StringBufferOutput* new_output)
1✔
14
{
15
  delete result_;
1✔
16
  delete output_;
1✔
17
  output_ = new_output;
1✔
18
  result_ = new Result(*output_);
1✔
19
}
1✔
20

21
TestingFixture::TestingFixture()
136✔
22
{
23
  output_ = new StringBufferOutput();
136✔
24
  result_ = new Result(*output_);
136✔
25
  gen_test_ = new ExecFunctionShell();
136✔
26
  registry_ = new Registry();
136✔
27
  owns_exec_function_ = false;
136✔
28

29
  registry_->set_current_registry(registry_);
136✔
30
  registry_->add_test(gen_test_);
136✔
31

32
  line_of_code_executed_after_check_ = false;
136✔
33
}
136✔
34

35
void TestingFixture::flush_output_and_reset_result()
2✔
36
{
37
  output_->flush();
2✔
38
  delete result_;
2✔
39
  result_ = new Result(*output_);
2✔
40
}
2✔
41

42
TestingFixture::~TestingFixture()
156✔
43
{
44
  registry_->set_current_registry(nullptr);
136✔
45
  clear_exec_function();
136✔
46
  delete registry_;
136✔
47
  delete result_;
136✔
48
  delete output_;
136✔
49
  delete gen_test_;
136✔
50
}
156✔
51

52
void TestingFixture::clear_exec_function()
227✔
53
{
54
  if (gen_test_->test_function && owns_exec_function_)
227✔
55
    delete gen_test_->test_function;
90✔
56
}
227✔
57

58
void TestingFixture::add_test(Shell* test)
4✔
59
{
60
  registry_->add_test(test);
4✔
61
}
4✔
62

63
void TestingFixture::set_test_function(void (*test_function)())
90✔
64
{
65
  clear_exec_function();
90✔
66

67
  gen_test_->test_function = new ExecFunctionWithoutParameters(test_function);
90✔
68
  owns_exec_function_ = true;
90✔
69
}
90✔
70

71
void TestingFixture::set_test_function(ExecFunction* test_function)
1✔
72
{
73
  clear_exec_function();
1✔
74

75
  gen_test_->test_function = test_function;
1✔
76

77
  owns_exec_function_ = false;
1✔
78
}
1✔
79

80
void TestingFixture::set_setup(void (*setup_function)())
2✔
81
{
82
  gen_test_->setup = setup_function;
2✔
83
}
2✔
84

85
void TestingFixture::set_teardown(void (*teardown_function)())
7✔
86
{
87
  gen_test_->teardown = teardown_function;
7✔
88
}
7✔
89

90
void TestingFixture::install_plugin(Plugin* plugin)
1✔
91
{
92
  registry_->install_plugin(plugin);
1✔
93
}
1✔
94

95
void TestingFixture::set_output_verbose()
1✔
96
{
97
  output_->verbose(Output::MutinyVerbosityLevel::verbose);
1✔
98
}
1✔
99

100
void TestingFixture::run_test_with_method(void (*method)())
55✔
101
{
102
  set_test_function(method);
55✔
103
  run_all_tests();
55✔
104
}
55✔
105

106
void TestingFixture::run_all_tests()
106✔
107
{
108
  registry_->run_all_tests(*result_);
106✔
109
}
102✔
110

111
size_t TestingFixture::get_failure_count()
145✔
112
{
113
  return result_->get_failure_count();
145✔
114
}
115

116
size_t TestingFixture::get_check_count()
6✔
117
{
118
  return result_->get_check_count();
6✔
119
}
120

121
size_t TestingFixture::get_test_count()
1✔
122
{
123
  return result_->get_test_count();
1✔
124
}
125

UNCOV
126
size_t TestingFixture::get_ignore_count()
×
127
{
UNCOV
128
  return result_->get_ignored_count();
×
129
}
130

131
Registry* TestingFixture::get_registry()
28✔
132
{
133
  return registry_;
28✔
134
}
135

136
bool TestingFixture::has_test_failed()
1✔
137
{
138
  return gen_test_->has_failed();
1✔
139
}
140

141
void TestingFixture::assert_print_contains(const String& contains)
35✔
142
{
143
  STRCMP_CONTAINS(contains.c_str(), get_output().c_str());
35✔
144
}
35✔
145

146
void TestingFixture::assert_print_contains_not(const String& contains)
1✔
147
{
148
  CHECK(!string_contains(get_output(), contains));
1✔
149
}
1✔
150

151
const String& TestingFixture::get_output()
36✔
152
{
153
  return output_->get_output();
36✔
154
}
155

156
size_t TestingFixture::get_run_count()
2✔
157
{
158
  return result_->get_run_count();
2✔
159
}
160

161
void TestingFixture::line_executed_after_check()
1✔
162
{
163
  line_of_code_executed_after_check_ = true;
1✔
164
}
1✔
165

166
void TestingFixture::check_test_fails_with_proper_test_location(
120✔
167
    const char* text,
168
    const char* file,
169
    size_t line
170
)
171
{
172
  if (get_failure_count() != 1)
120✔
173
    FAIL_TEST_LOCATION(
×
174
        string_from_format(
175
            "Expected one test failure, but got %d amount of test failures",
176
            static_cast<int>(get_failure_count())
177
        )
178
            .c_str(),
179
        file,
180
        line
181
    );
182

183
  STRCMP_CONTAINS_LOCATION(text, output_->get_output().c_str(), "", file, line);
120✔
184

185
  if (line_of_code_executed_after_check_)
120✔
186
    FAIL_TEST_LOCATION(
×
187
        "The test should jump/throw on failure and not execute the "
188
        "next line. However, the next line was executed.",
189
        file,
190
        line
191
    );
192
}
120✔
193

194
} // namespace test
195
} // namespace tiny
196
} // namespace mu
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