GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "tochilin_e_integration_trapezoid/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4
5 #include "tochilin_e_integration_trapezoid/common/include/common.hpp"
6
7 namespace tochilin_e_integration_trapezoid {
8
9
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 TochilinEIntegrationTrapezoidSEQ::TochilinEIntegrationTrapezoidSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 24 GetOutput() = 0.0;
13 24 }
14
15 24 bool TochilinEIntegrationTrapezoidSEQ::ValidationImpl() {
16 const auto &input = GetInput();
17
3/6
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 24 times.
24 return input.num_intervals > 0 && input.lower_bound < input.upper_bound && input.function != nullptr;
18 }
19
20 24 bool TochilinEIntegrationTrapezoidSEQ::PreProcessingImpl() {
21 const auto &input = GetInput();
22 24 lower_bound_ = input.lower_bound;
23 24 upper_bound_ = input.upper_bound;
24 24 num_intervals_ = input.num_intervals;
25 24 function_ = input.function;
26 24 result_ = 0.0;
27 24 return true;
28 }
29
30 24 bool TochilinEIntegrationTrapezoidSEQ::RunImpl() {
31
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 double step = (upper_bound_ - lower_bound_) / num_intervals_;
32
33
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
24 double sum = (function_(lower_bound_) + function_(upper_bound_)) / 2.0;
34
35
2/2
✓ Branch 0 taken 23976 times.
✓ Branch 1 taken 24 times.
24000 for (int i = 1; i < num_intervals_; ++i) {
36
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 23976 times.
23976 double x = lower_bound_ + (i * step);
37 23976 sum += function_(x);
38 }
39
40 24 result_ = step * sum;
41 24 return true;
42 }
43
44 24 bool TochilinEIntegrationTrapezoidSEQ::PostProcessingImpl() {
45 24 GetOutput() = result_;
46 24 return true;
47 }
48
49 } // namespace tochilin_e_integration_trapezoid
50