GCC Code Coverage Report


Directory: ./
File: tasks/romanov_a_integration_rect_method/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 19 20 95.0%
Functions: 5 5 100.0%
Branches: 6 10 60.0%

Line Branch Exec Source
1 #include "romanov_a_integration_rect_method/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4
5 #include "romanov_a_integration_rect_method/common/include/common.hpp"
6
7 namespace romanov_a_integration_rect_method {
8
9
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 RomanovAIntegrationRectMethodSEQ::RomanovAIntegrationRectMethodSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 48 GetOutput() = 0.0;
13 48 }
14
15 48 bool RomanovAIntegrationRectMethodSEQ::ValidationImpl() {
16
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (!IsEqual(GetOutput(), 0.0)) {
17 return false;
18 }
19
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (std::get<3>(GetInput()) <= 0) {
20 return false;
21 }
22
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (std::get<1>(GetInput()) >= std::get<2>(GetInput())) {
23 return false;
24 }
25 return true;
26 }
27
28 48 bool RomanovAIntegrationRectMethodSEQ::PreProcessingImpl() {
29 48 return true;
30 }
31
32 48 bool RomanovAIntegrationRectMethodSEQ::RunImpl() {
33 const auto &[f, a, b, n] = GetInput();
34
35 48 double delta_x = (b - a) / static_cast<double>(n);
36 48 double mid = a + (delta_x / 2.0);
37
38 double result = 0.0;
39
40
2/2
✓ Branch 0 taken 32000104 times.
✓ Branch 1 taken 48 times.
32000152 for (int i = 0; i < n; ++i) {
41 32000104 result += f(mid) * delta_x;
42 32000104 mid += delta_x;
43 }
44
45 48 GetOutput() = result;
46
47 48 return true;
48 }
49
50 48 bool RomanovAIntegrationRectMethodSEQ::PostProcessingImpl() {
51 48 return true;
52 }
53
54 } // namespace romanov_a_integration_rect_method
55