| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "potashnik_m_char_freq/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <string> | ||
| 4 | |||
| 5 | #include "potashnik_m_char_freq/common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace potashnik_m_char_freq { | ||
| 8 | |||
| 9 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | PotashnikMCharFreqSEQ::PotashnikMCharFreqSEQ(const InType &in) { |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 11 | GetInput() = in; | ||
| 12 | 80 | GetOutput() = 0; | |
| 13 | 80 | } | |
| 14 | |||
| 15 | 80 | bool PotashnikMCharFreqSEQ::ValidationImpl() { | |
| 16 | 80 | return !std::get<0>(GetInput()).empty(); | |
| 17 | } | ||
| 18 | |||
| 19 | 80 | bool PotashnikMCharFreqSEQ::PreProcessingImpl() { | |
| 20 | 80 | return true; | |
| 21 | } | ||
| 22 | |||
| 23 | 80 | bool PotashnikMCharFreqSEQ::RunImpl() { | |
| 24 | auto &input = GetInput(); | ||
| 25 | std::string str = std::get<0>(input); | ||
| 26 | 80 | char chr = std::get<1>(input); | |
| 27 | |||
| 28 | 80 | int string_size = static_cast<int>(str.size()); | |
| 29 | int res = 0; | ||
| 30 |
2/2✓ Branch 0 taken 305088 times.
✓ Branch 1 taken 80 times.
|
305168 | for (int i = 0; i < string_size; i++) { |
| 31 |
2/2✓ Branch 0 taken 11728 times.
✓ Branch 1 taken 293360 times.
|
305088 | if (str[i] == chr) { |
| 32 | 11728 | res++; | |
| 33 | } | ||
| 34 | } | ||
| 35 | 80 | GetOutput() = res; | |
| 36 | |||
| 37 | 80 | return true; | |
| 38 | } | ||
| 39 | |||
| 40 | 80 | bool PotashnikMCharFreqSEQ::PostProcessingImpl() { | |
| 41 | 80 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | } // namespace potashnik_m_char_freq | ||
| 45 |