GCC Code Coverage Report


Directory: ./
File: tasks/luzan_e_simps_int/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 33 33 100.0%
Functions: 5 5 100.0%
Branches: 16 19 84.2%

Line Branch Exec Source
1 #include "luzan_e_simps_int/seq/include/ops_seq.hpp"
2
3 #include <tuple>
4
5 #include "luzan_e_simps_int/common/include/common.hpp"
6
7 namespace luzan_e_simps_int {
8
9 128 LuzanESimpsIntSEQ::LuzanESimpsIntSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 GetOutput() = {};
13 128 }
14
15 128 bool LuzanESimpsIntSEQ::ValidationImpl() {
16 128 int n = std::get<0>(GetInput());
17 128 double a = std::get<0>(std::get<1>(GetInput()));
18 128 double b = std::get<1>(std::get<1>(GetInput()));
19 128 double c = std::get<0>(std::get<2>(GetInput()));
20 128 double d = std::get<1>(std::get<2>(GetInput()));
21 128 int func_num = std::get<3>(GetInput());
22
23
3/6
✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 128 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 128 times.
✗ Branch 5 not taken.
128 bool flag = (a < b) && (c < d) && (n % 2 == 0) && (n > 0) && (func_num > 0);
24 128 return flag;
25 }
26
27 128 bool LuzanESimpsIntSEQ::PreProcessingImpl() {
28 128 GetOutput() = 0.0;
29 128 return true;
30 }
31
32 128 bool LuzanESimpsIntSEQ::RunImpl() {
33 double a = 0.0;
34 double b = 0.0;
35 double c = 0.0;
36 double d = 0.0;
37 int n = 0; // кол-во отрезков
38 int func_num = 0;
39
40 // getting data
41 128 n = std::get<0>(GetInput());
42 128 a = std::get<0>(std::get<1>(GetInput()));
43 128 b = std::get<1>(std::get<1>(GetInput()));
44 128 c = std::get<0>(std::get<2>(GetInput()));
45 128 d = std::get<1>(std::get<2>(GetInput()));
46
5/5
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 48 times.
128 func_num = std::get<3>(GetInput());
47
48 double (*fp)(double, double) = GetFunc(func_num);
49 128 double hx = (b - a) / n;
50 128 double hy = (d - c) / n;
51
52 double sum = 0;
53 double wx = 1.0;
54 double wy = 1.0;
55 double x = 0.0;
56 double y = 0.0;
57
58
2/2
✓ Branch 0 taken 8720 times.
✓ Branch 1 taken 128 times.
8848 for (int i = 0; i <= n; i++) {
59
2/2
✓ Branch 0 taken 8464 times.
✓ Branch 1 taken 256 times.
8720 x = a + (hx * i);
60 wx = GetWeight(i, n);
61
62
2/2
✓ Branch 0 taken 1388352 times.
✓ Branch 1 taken 8720 times.
1397072 for (int j = 0; j <= n; j++) {
63
2/2
✓ Branch 0 taken 1370912 times.
✓ Branch 1 taken 17440 times.
1388352 y = c + (hy * j);
64 wy = GetWeight(j, n);
65 1388352 sum += wy * wx * fp(x, y);
66 }
67 }
68 128 sum = sum * hx * hy / (3 * 3);
69 128 GetOutput() = sum;
70 128 return true;
71 }
72
73 128 bool LuzanESimpsIntSEQ::PostProcessingImpl() {
74 128 return true;
75 }
76
77 } // namespace luzan_e_simps_int
78