GCC Code Coverage Report


Directory: ./
File: tasks/eremin_v_rectangle_method/seq/src/ops_seq.cpp
Date: 2025-12-13 04:24:21
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 5 5 100.0%
Branches: 12 22 54.5%

Line Branch Exec Source
1 #include "eremin_v_rectangle_method/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4 #include <tuple>
5
6 #include "eremin_v_rectangle_method/common/include/common.hpp"
7
8 namespace eremin_v_rectangle_method {
9
10
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 EreminVRectangleMethodSEQ::EreminVRectangleMethodSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 48 GetOutput() = 0;
14 48 }
15
16 48 bool EreminVRectangleMethodSEQ::ValidationImpl() {
17 auto &input = GetInput();
18
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 48 times.
48 return (std::get<0>(input) < std::get<1>(input)) && (std::get<2>(input) > 0) && (std::get<2>(input) <= 100000000) &&
19
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 48 times.
48 (std::get<0>(input) >= -1e9) && (std::get<0>(input) <= 1e9) && (std::get<1>(input) >= -1e9) &&
20
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
96 (std::get<1>(input) <= 1e9) && (GetOutput() == 0);
21 }
22
23 48 bool EreminVRectangleMethodSEQ::PreProcessingImpl() {
24 48 return true;
25 }
26
27 48 bool EreminVRectangleMethodSEQ::RunImpl() {
28 auto &input = GetInput();
29 48 const double lower_bound = std::get<0>(input);
30 48 const double upper_bound = std::get<1>(input);
31 48 const int steps = std::get<2>(input);
32 const auto &in_function = std::get<3>(input);
33 48 double step_size = (upper_bound - lower_bound) / steps;
34 double result = 0.0;
35
36
2/2
✓ Branch 0 taken 2488000 times.
✓ Branch 1 taken 48 times.
2488048 for (int i = 0; i < steps; i++) {
37
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2488000 times.
4976000 result += in_function(lower_bound + ((static_cast<double>(i) + 0.5) * step_size));
38 }
39
40 48 result *= step_size;
41 48 GetOutput() = result;
42 48 return true;
43 }
44
45 48 bool EreminVRectangleMethodSEQ::PostProcessingImpl() {
46 48 return true;
47 }
48
49 } // namespace eremin_v_rectangle_method
50