GCC Code Coverage Report


Directory: ./
File: tasks/telnov_a_integral_rectangle/seq/src/ops_seq.cpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 24 24 100.0%
Functions: 5 5 100.0%
Branches: 6 8 75.0%

Line Branch Exec Source
1 #include "telnov_a_integral_rectangle/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4 #include <cstdint>
5
6 #include "telnov_a_integral_rectangle/common/include/common.hpp"
7
8 namespace telnov_a_integral_rectangle {
9
10 64 TelnovAIntegralRectangleSEQ::TelnovAIntegralRectangleSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 GetOutput() = 0;
14 64 }
15
16 64 bool TelnovAIntegralRectangleSEQ::ValidationImpl() {
17
2/4
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
64 return GetInput().first > 0 && GetInput().second > 0;
18 }
19
20 64 bool TelnovAIntegralRectangleSEQ::PreProcessingImpl() {
21 64 GetOutput() = 0.0;
22 64 return true;
23 }
24
25 64 bool TelnovAIntegralRectangleSEQ::RunImpl() {
26 64 const int n = GetInput().first;
27 64 const int d = GetInput().second;
28
29 const double a = 0.0;
30 const double b = 1.0;
31 64 const double h = (b - a) / n;
32
33 64 auto total_points = static_cast<int64_t>(std::pow(n, d));
34
35 double result = 0.0;
36
37
2/2
✓ Branch 0 taken 301352 times.
✓ Branch 1 taken 64 times.
301416 for (int64_t idx = 0; idx < total_points; idx++) {
38 int64_t tmp = idx;
39 double f_value = 0.0;
40
41
2/2
✓ Branch 0 taken 1423928 times.
✓ Branch 1 taken 301352 times.
1725280 for (int dim = 0; dim < d; dim++) {
42 1423928 int coord_index = static_cast<int>(tmp % n);
43 1423928 tmp /= n;
44
45 1423928 double x = a + ((coord_index + 0.5) * h);
46 1423928 f_value += x;
47 }
48
49 301352 result += f_value;
50 }
51
52 64 result *= std::pow(h, d);
53
54 64 GetOutput() = result;
55 64 return true;
56 }
57
58 64 bool TelnovAIntegralRectangleSEQ::PostProcessingImpl() {
59 64 return true;
60 }
61
62 } // namespace telnov_a_integral_rectangle
63