| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gasenin_l_lex_dif/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | |||
| 6 | #include "gasenin_l_lex_dif/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace gasenin_l_lex_dif { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
|
96 | GaseninLLexDifSEQ::GaseninLLexDifSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 96 | GetOutput() = 0; | |
| 14 | 96 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | bool GaseninLLexDifSEQ::ValidationImpl() { |
| 17 | const auto &[str1, str2] = GetInput(); | ||
| 18 |
2/4✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
96 | return str1.length() <= 100000000 && str2.length() <= 100000000; |
| 19 | } | ||
| 20 | |||
| 21 | 96 | bool GaseninLLexDifSEQ::PreProcessingImpl() { | |
| 22 | 96 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 | 96 | bool GaseninLLexDifSEQ::RunImpl() { | |
| 26 | const auto &[str1, str2] = GetInput(); | ||
| 27 | |||
| 28 | size_t min_len = std::min(str1.length(), str2.length()); | ||
| 29 | |||
| 30 |
2/2✓ Branch 0 taken 160144 times.
✓ Branch 1 taken 48 times.
|
160192 | for (size_t i = 0; i < min_len; ++i) { |
| 31 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 160096 times.
|
160144 | if (str1[i] != str2[i]) { |
| 32 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 32 times.
|
48 | GetOutput() = (str1[i] < str2[i]) ? -1 : 1; |
| 33 | 48 | return true; | |
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 32 times.
|
48 | if (str1.length() < str2.length()) { |
| 38 | 16 | GetOutput() = -1; | |
| 39 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
|
32 | } else if (str1.length() > str2.length()) { |
| 40 | 8 | GetOutput() = 1; | |
| 41 | } else { | ||
| 42 | 24 | GetOutput() = 0; | |
| 43 | } | ||
| 44 | |||
| 45 | return true; | ||
| 46 | } | ||
| 47 | |||
| 48 | 96 | bool GaseninLLexDifSEQ::PostProcessingImpl() { | |
| 49 | 96 | return true; | |
| 50 | } | ||
| 51 | } // namespace gasenin_l_lex_dif | ||
| 52 |