GCC Code Coverage Report


Directory: ./
File: tasks/levonychev_i_min_val_rows_matrix/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: 11 16 68.8%

Line Branch Exec Source
1 #include "levonychev_i_min_val_rows_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "levonychev_i_min_val_rows_matrix/common/include/common.hpp"
8
9 namespace levonychev_i_min_val_rows_matrix {
10
11
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 LevonychevIMinValRowsMatrixSEQ::LevonychevIMinValRowsMatrixSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 GetOutput() = {};
15 80 }
16
17
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 bool LevonychevIMinValRowsMatrixSEQ::ValidationImpl() {
18 const size_t vector_size = std::get<0>(GetInput()).size();
19 80 const int rows = std::get<1>(GetInput());
20 80 const int cols = std::get<2>(GetInput());
21
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
80 return vector_size != 0 && rows != 0 && cols != 0 &&
22
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
80 (vector_size == static_cast<size_t>(rows) * static_cast<size_t>(cols));
23 }
24
25 80 bool LevonychevIMinValRowsMatrixSEQ::PreProcessingImpl() {
26 80 GetOutput().resize(static_cast<size_t>(std::get<1>(GetInput())));
27 80 return true;
28 }
29
30 80 bool LevonychevIMinValRowsMatrixSEQ::RunImpl() {
31 const std::vector<int> &matrix = std::get<0>(GetInput());
32 80 const int rows = std::get<1>(GetInput());
33 80 const int cols = std::get<2>(GetInput());
34 OutType &result = GetOutput();
35
36
2/2
✓ Branch 0 taken 408 times.
✓ Branch 1 taken 80 times.
488 for (int i = 0; i < rows; ++i) {
37 408 int min_val = matrix[static_cast<size_t>(cols) * static_cast<size_t>(i)];
38
2/2
✓ Branch 0 taken 1792 times.
✓ Branch 1 taken 408 times.
2200 for (int j = 1; j < cols; ++j) {
39
2/2
✓ Branch 0 taken 936 times.
✓ Branch 1 taken 856 times.
2728 min_val = std::min(matrix[(cols * i) + j], min_val);
40 }
41 408 result[i] = min_val;
42 }
43
44 80 return true;
45 }
46
47 80 bool LevonychevIMinValRowsMatrixSEQ::PostProcessingImpl() {
48 80 return true;
49 }
50
51 } // namespace levonychev_i_min_val_rows_matrix
52