GCC Code Coverage Report


Directory: ./
File: tasks/tsarkov_k_lexicographic_string_compare/seq/src/ops_seq.cpp
Date: 2026-02-23 23:20:07
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 5 5 100.0%
Branches: 12 14 85.7%

Line Branch Exec Source
1 #include "tsarkov_k_lexicographic_string_compare/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5
6 #include "tsarkov_k_lexicographic_string_compare/common/include/common.hpp"
7
8 namespace tsarkov_k_lexicographic_string_compare {
9
10
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 TsarkovKLexicographicStringCompareSEQ::TsarkovKLexicographicStringCompareSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 48 GetOutput() = 0;
14 48 }
15
16 48 bool TsarkovKLexicographicStringCompareSEQ::ValidationImpl() {
17 48 return GetOutput() == 0;
18 }
19
20 48 bool TsarkovKLexicographicStringCompareSEQ::PreProcessingImpl() {
21 48 GetOutput() = 0;
22 48 return true;
23 }
24
25 48 bool TsarkovKLexicographicStringCompareSEQ::RunImpl() {
26 const auto &[first_str, second_str] = GetInput();
27
28 const std::size_t min_length = std::min(first_str.size(), second_str.size());
29
2/2
✓ Branch 0 taken 56 times.
✓ Branch 1 taken 32 times.
88 for (std::size_t index = 0; index < min_length; ++index) {
30 56 const auto first_ch = static_cast<unsigned char>(first_str[index]);
31 56 const auto second_ch = static_cast<unsigned char>(second_str[index]);
32
33
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 48 times.
56 if (first_ch < second_ch) {
34 8 GetOutput() = 1;
35 8 return true;
36 }
37
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 40 times.
48 if (first_ch > second_ch) {
38 8 GetOutput() = 0;
39 8 return true;
40 }
41 }
42
43
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
32 GetOutput() = (first_str.size() <= second_str.size()) ? 1 : 0;
44 32 return true;
45 }
46
47 48 bool TsarkovKLexicographicStringCompareSEQ::PostProcessingImpl() {
48
3/4
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
48 return (GetOutput() == 0) || (GetOutput() == 1);
49 }
50
51 } // namespace tsarkov_k_lexicographic_string_compare
52