| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "samoylenko_i_lex_order_check/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <string> | ||
| 4 | #include <utility> | ||
| 5 | |||
| 6 | #include "samoylenko_i_lex_order_check/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace samoylenko_i_lex_order_check { | ||
| 9 | |||
| 10 | 80 | bool SamoylenkoILexOrderCheckSEQ::SamoylenkoILexOrderCompare(const std::string &s1, const std::string &s2) { | |
| 11 | auto first1 = s1.begin(); | ||
| 12 | auto last1 = s1.end(); | ||
| 13 | auto first2 = s2.begin(); | ||
| 14 | auto last2 = s2.end(); | ||
| 15 | |||
| 16 |
4/4✓ Branch 0 taken 160 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 152 times.
✓ Branch 3 taken 8 times.
|
200 | for (; (first1 != last1) && (first2 != last2); ++first1, ++first2) { |
| 17 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 8 times.
|
152 | if (*first1 < *first2) { |
| 18 | return true; | ||
| 19 | } | ||
| 20 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 120 times.
|
144 | if (*first2 < *first1) { |
| 21 | return false; | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | // Equal and prefix check | ||
| 26 |
7/8✓ Branch 0 taken 40 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 24 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 24 times.
|
48 | return ((first1 == last1) && (first2 == last2)) || ((first1 == last1) && (first2 != last2)); |
| 27 | } | ||
| 28 | |||
| 29 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | SamoylenkoILexOrderCheckSEQ::SamoylenkoILexOrderCheckSEQ(const InType &in) { |
| 30 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 31 | GetInput() = in; | ||
| 32 | 80 | GetOutput() = false; | |
| 33 | 80 | } | |
| 34 | |||
| 35 | 80 | bool SamoylenkoILexOrderCheckSEQ::ValidationImpl() { | |
| 36 | 80 | return true; | |
| 37 | } | ||
| 38 | |||
| 39 | 80 | bool SamoylenkoILexOrderCheckSEQ::PreProcessingImpl() { | |
| 40 | 80 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 | 80 | bool SamoylenkoILexOrderCheckSEQ::RunImpl() { | |
| 44 | const auto &input = GetInput(); | ||
| 45 | 80 | const std::string &s1 = input.first; | |
| 46 | 80 | const std::string &s2 = input.second; | |
| 47 | |||
| 48 | 80 | bool result = SamoylenkoILexOrderCompare(s1, s2); | |
| 49 | |||
| 50 | 80 | GetOutput() = result; | |
| 51 | |||
| 52 | 80 | return true; | |
| 53 | } | ||
| 54 | |||
| 55 | 80 | bool SamoylenkoILexOrderCheckSEQ::PostProcessingImpl() { | |
| 56 | 80 | return true; | |
| 57 | } | ||
| 58 | |||
| 59 | } // namespace samoylenko_i_lex_order_check | ||
| 60 |