GCC Code Coverage Report


Directory: ./
File: tasks/iskhakov_d_trapezoidal_integration/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 24 24 100.0%
Functions: 5 5 100.0%
Branches: 9 16 56.2%

Line Branch Exec Source
1 #include "iskhakov_d_trapezoidal_integration/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4
5 #include "iskhakov_d_trapezoidal_integration/common/include/common.hpp"
6
7 namespace iskhakov_d_trapezoidal_integration {
8
9
1/2
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
120 IskhakovDTrapezoidalIntegrationSEQ::IskhakovDTrapezoidalIntegrationSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 120 GetOutput() = 0;
13 120 }
14
15 120 bool IskhakovDTrapezoidalIntegrationSEQ::ValidationImpl() {
16 auto &input = GetInput();
17
18 120 double lower_level = std::get<0>(input);
19 120 double top_level = std::get<1>(input);
20 120 int number_steps = std::get<3>(input);
21
22
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 120 times.
120 return (lower_level < top_level) && (number_steps > 0);
23 }
24
25 120 bool IskhakovDTrapezoidalIntegrationSEQ::PreProcessingImpl() {
26 120 return GetOutput() == 0.0;
27 }
28
29 120 bool IskhakovDTrapezoidalIntegrationSEQ::RunImpl() {
30 auto &input = GetInput();
31
32 120 double lower_level = std::get<0>(input);
33 120 double top_level = std::get<1>(input);
34 120 auto input_function = std::get<2>(input);
35 120 int number_steps = std::get<3>(input);
36
37 double result = 0.0;
38
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 double step = (top_level - lower_level) / static_cast<double>(number_steps);
39
40
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 result = (input_function(lower_level) + input_function(top_level)) / 2.0;
41
42
2/2
✓ Branch 0 taken 1631880 times.
✓ Branch 1 taken 120 times.
1632000 for (int step_index = 1; step_index < number_steps; ++step_index) {
43
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1631880 times.
3263760 result += input_function(lower_level + (step * step_index));
44 }
45
46 120 result *= step;
47
1/2
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
120 GetOutput() = result;
48
49 120 return true;
50 }
51
52 120 bool IskhakovDTrapezoidalIntegrationSEQ::PostProcessingImpl() {
53 120 return true;
54 }
55
56 } // namespace iskhakov_d_trapezoidal_integration
57