| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "smyshlaev_a_str_order_check/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <string> | ||
| 5 | #include <utility> | ||
| 6 | |||
| 7 | #include "smyshlaev_a_str_order_check/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace smyshlaev_a_str_order_check { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
|
88 | SmyshlaevAStrOrderCheckSEQ::SmyshlaevAStrOrderCheckSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 88 | GetOutput() = 0; | |
| 15 | 88 | } | |
| 16 | |||
| 17 | 88 | bool SmyshlaevAStrOrderCheckSEQ::ValidationImpl() { | |
| 18 | 88 | return true; | |
| 19 | } | ||
| 20 | |||
| 21 | 88 | bool SmyshlaevAStrOrderCheckSEQ::PreProcessingImpl() { | |
| 22 | 88 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 | 88 | bool SmyshlaevAStrOrderCheckSEQ::RunImpl() { | |
| 26 | const auto &input_data = GetInput(); | ||
| 27 | |||
| 28 | const std::string &str1 = input_data.first; | ||
| 29 | const std::string &str2 = input_data.second; | ||
| 30 | |||
| 31 | 88 | int min_len = static_cast<int>(std::min(str1.length(), str2.length())); | |
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 56 times.
|
168 | for (int i = 0; i < min_len; ++i) { |
| 34 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 88 times.
|
112 | if (str1[i] < str2[i]) { |
| 35 | 24 | GetOutput() = -1; | |
| 36 | 24 | return true; | |
| 37 | } | ||
| 38 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 80 times.
|
88 | if (str1[i] > str2[i]) { |
| 39 | 8 | GetOutput() = 1; | |
| 40 | 8 | return true; | |
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 40 times.
|
56 | if (str1.length() < str2.length()) { |
| 45 | 16 | GetOutput() = -1; | |
| 46 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 24 times.
|
40 | } else if (str1.length() > str2.length()) { |
| 47 | 16 | GetOutput() = 1; | |
| 48 | } else { | ||
| 49 | 24 | GetOutput() = 0; | |
| 50 | } | ||
| 51 | |||
| 52 | return true; | ||
| 53 | } | ||
| 54 | |||
| 55 | 88 | bool SmyshlaevAStrOrderCheckSEQ::PostProcessingImpl() { | |
| 56 | 88 | return true; | |
| 57 | } | ||
| 58 | |||
| 59 | } // namespace smyshlaev_a_str_order_check | ||
| 60 |