| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "perepelkin_i_string_diff_char_count/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <functional> | ||
| 6 | #include <numeric> | ||
| 7 | |||
| 8 | #include "perepelkin_i_string_diff_char_count/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace perepelkin_i_string_diff_char_count { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
|
96 | PerepelkinIStringDiffCharCountSEQ::PerepelkinIStringDiffCharCountSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 | GetInput() = in; | ||
| 15 | 96 | GetOutput() = 0; | |
| 16 | 96 | } | |
| 17 | |||
| 18 | 96 | bool PerepelkinIStringDiffCharCountSEQ::ValidationImpl() { | |
| 19 | 96 | return (GetOutput() == 0); | |
| 20 | } | ||
| 21 | |||
| 22 | 96 | bool PerepelkinIStringDiffCharCountSEQ::PreProcessingImpl() { | |
| 23 | 96 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 | 96 | bool PerepelkinIStringDiffCharCountSEQ::RunImpl() { | |
| 27 | const auto &[s1, s2] = GetInput(); | ||
| 28 | const size_t min_len = std::min(s1.size(), s2.size()); | ||
| 29 | const size_t max_len = std::max(s1.size(), s2.size()); | ||
| 30 | |||
| 31 | 96 | int diff = std::transform_reduce(s1.begin(), s1.begin() + static_cast<std::ptrdiff_t>(min_len), s2.begin(), 0, | |
| 32 | std::plus<>(), std::not_equal_to<>()); | ||
| 33 | |||
| 34 | 96 | GetOutput() = diff + static_cast<int>(max_len - min_len); | |
| 35 | 96 | return true; | |
| 36 | } | ||
| 37 | |||
| 38 | 96 | bool PerepelkinIStringDiffCharCountSEQ::PostProcessingImpl() { | |
| 39 | 96 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | } // namespace perepelkin_i_string_diff_char_count | ||
| 43 |