GCC Code Coverage Report


Directory: ./
File: tasks/belov_e_lexico_order_two_strings/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 32 32 100.0%
Functions: 5 5 100.0%
Branches: 34 52 65.4%

Line Branch Exec Source
1 #include "belov_e_lexico_order_two_strings/seq/include/ops_seq.hpp"
2
3 #include <string>
4 #include <vector>
5
6 #include "belov_e_lexico_order_two_strings/common/include/common.hpp"
7
8 namespace belov_e_lexico_order_two_strings {
9
10
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 BelovELexicoOrderTwoStringsSEQ::BelovELexicoOrderTwoStringsSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 32 GetOutput() = false;
14 32 }
15
16
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 bool BelovELexicoOrderTwoStringsSEQ::ValidationImpl() {
17
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
32 return !std::get<0>(GetInput()).empty() && !std::get<1>(GetInput()).empty();
18 }
19 32 bool BelovELexicoOrderTwoStringsSEQ::PreProcessingImpl() {
20 32 std::vector<std::string> temp;
21 std::string current;
22
2/2
✓ Branch 0 taken 352 times.
✓ Branch 1 taken 32 times.
384 for (auto &ch : std::get<0>(GetInput())) {
23
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 288 times.
352 if (ch == ' ') {
24
1/2
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
64 temp.push_back(current);
25 current = "";
26 } else {
27 current += ch;
28 }
29 }
30
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 if (!current.empty()) {
31
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 temp.push_back(current);
32 }
33
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 std::get<0>(GetProccesedInput()) = temp;
34
35
1/2
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
32 std::vector<std::string>().swap(temp);
36 current = "";
37
2/2
✓ Branch 0 taken 352 times.
✓ Branch 1 taken 32 times.
384 for (auto &ch : std::get<1>(GetInput())) {
38
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 288 times.
352 if (ch == ' ') {
39
1/2
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
64 temp.push_back(current);
40 current = "";
41 } else {
42 current += ch;
43 }
44 }
45
1/2
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
32 if (!current.empty()) {
46
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 temp.push_back(current);
47 }
48
1/2
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
32 std::get<1>(GetProccesedInput()) = temp;
49
50
2/4
✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
64 return !std::get<0>(GetProccesedInput()).empty() && !std::get<1>(GetProccesedInput()).empty();
51 32 }
52
53 32 bool BelovELexicoOrderTwoStringsSEQ::RunImpl() {
54 const std::vector<std::string> &first = std::get<0>(GetProccesedInput());
55 const std::vector<std::string> &second = std::get<1>(GetProccesedInput());
56
57 bool flag = false;
58 bool ans = false;
59 auto iter1 = first.begin();
60 auto iter2 = second.begin();
61
3/4
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 80 times.
✗ Branch 3 not taken.
96 for (; iter1 != first.end() && iter2 != second.end(); iter1++, iter2++) {
62
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
80 if (*iter1 < *iter2) {
63 ans = true;
64 flag = true;
65 break;
66 }
67
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
64 if (*iter1 != *iter2) {
68 ans = false;
69 flag = true;
70 break;
71 }
72 }
73
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
32 if (flag) {
74 16 GetOutput() = ans;
75 } else {
76
3/4
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 8 times.
24 GetOutput() = (iter1 == first.end()) && (iter2 != second.end());
77 }
78
79 32 return true;
80 }
81
82 32 bool BelovELexicoOrderTwoStringsSEQ::PostProcessingImpl() {
83 32 return true;
84 }
85 } // namespace belov_e_lexico_order_two_strings
86