| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "sosnina_a_diff_count/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <string> | ||
| 6 | #include <utility> | ||
| 7 | |||
| 8 | #include "sosnina_a_diff_count/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace sosnina_a_diff_count { | ||
| 11 | |||
| 12 | 512 | SosninaADiffCountSEQ::SosninaADiffCountSEQ(InType in) : input_(std::move(in)) { | |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 | 512 | GetOutput() = 0; | |
| 15 | 512 | } | |
| 16 | |||
| 17 | 512 | bool SosninaADiffCountSEQ::ValidationImpl() { | |
| 18 | 512 | return true; | |
| 19 | } | ||
| 20 | |||
| 21 | 512 | bool SosninaADiffCountSEQ::PreProcessingImpl() { | |
| 22 | 512 | diff_counter_ = 0; | |
| 23 | 512 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 | 512 | bool SosninaADiffCountSEQ::RunImpl() { | |
| 27 | const std::string &str1 = input_.first; | ||
| 28 | const std::string &str2 = input_.second; | ||
| 29 | |||
| 30 | std::size_t total_len = std::max(str1.size(), str2.size()); | ||
| 31 | 512 | diff_counter_ = 0; | |
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 2880 times.
✓ Branch 1 taken 512 times.
|
3392 | for (std::size_t i = 0; i < total_len; i++) { |
| 34 |
6/6✓ Branch 0 taken 1872 times.
✓ Branch 1 taken 1008 times.
✓ Branch 2 taken 1760 times.
✓ Branch 3 taken 112 times.
✓ Branch 4 taken 752 times.
✓ Branch 5 taken 1008 times.
|
2880 | if (i >= str1.size() || i >= str2.size() || str1[i] != str2[i]) { |
| 35 | 1872 | diff_counter_++; | |
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 512 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | 512 | bool SosninaADiffCountSEQ::PostProcessingImpl() { | |
| 43 | 512 | GetOutput() = diff_counter_; | |
| 44 | 512 | return true; | |
| 45 | } | ||
| 46 | |||
| 47 | } // namespace sosnina_a_diff_count | ||
| 48 |