GCC Code Coverage Report


Directory: ./
File: tasks/guseva_a_jarvis/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 5 5 100.0%
Branches: 14 20 70.0%

Line Branch Exec Source
1 #include "guseva_a_jarvis/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstdint>
5 #include <utility>
6 #include <vector>
7
8 #include "guseva_a_jarvis/common/include/common.hpp"
9
10 namespace guseva_a_jarvis {
11
12
1/2
✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
88 GusevaAJarvisSEQ::GusevaAJarvisSEQ(const InType &in) {
13 SetTypeOfTask(GetStaticTypeOfTask());
14 GetInput() = in;
15 GetOutput() = {};
16 88 }
17
18 88 bool GusevaAJarvisSEQ::ValidationImpl() {
19 const auto &[width, height, image] = GetInput();
20 88 bool is_size_match = static_cast<int>(image.size()) == width * height;
21
1/2
✓ Branch 0 taken 177584 times.
✗ Branch 1 not taken.
177584 bool is_image_binary = std::ranges::all_of(image.begin(), image.end(), [](int x) { return x == 0 || x == 1; });
22
2/4
✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 3 not taken.
88 bool is_size_possible = width > 0 && height > 0;
23
2/4
✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 88 times.
88 return is_image_binary && is_size_possible && is_size_match;
24 }
25
26 88 bool GusevaAJarvisSEQ::PreProcessingImpl() {
27 const auto &[width, height, image] = GetInput();
28
2/2
✓ Branch 0 taken 3824 times.
✓ Branch 1 taken 88 times.
3912 for (int yy = 0; yy < height; ++yy) {
29
2/2
✓ Branch 0 taken 177584 times.
✓ Branch 1 taken 3824 times.
181408 for (int xx = 0; xx < width; ++xx) {
30
2/2
✓ Branch 0 taken 88720 times.
✓ Branch 1 taken 88864 times.
177584 if (image[(yy * width) + xx] == 1) {
31 88720 points_.emplace_back(xx, yy);
32 }
33 }
34 }
35 88 return true;
36 }
37
38 88 bool GusevaAJarvisSEQ::RunImpl() {
39 88 hull_ = BuildConvexHull(points_);
40 88 return true;
41 }
42
43 88 bool GusevaAJarvisSEQ::PostProcessingImpl() {
44 88 GetOutput().resize(static_cast<int64_t>(std::get<0>(GetInput())) * std::get<1>(GetInput()), 0);
45
2/2
✓ Branch 0 taken 528 times.
✓ Branch 1 taken 88 times.
616 for (const auto &[x, y] : hull_) {
46 528 GetOutput()[(y * std::get<0>(GetInput())) + x] = 1;
47 }
48 88 return true;
49 }
50
51 } // namespace guseva_a_jarvis
52