| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "orehov_n_character_frequency/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <string> | ||
| 5 | |||
| 6 | #include "orehov_n_character_frequency/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace orehov_n_character_frequency { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | OrehovNCharacterFrequencySEQ::OrehovNCharacterFrequencySEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 8 | GetOutput() = 0; | |
| 14 | 8 | } | |
| 15 | |||
| 16 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | bool OrehovNCharacterFrequencySEQ::ValidationImpl() { |
| 17 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
8 | return (!std::get<0>(GetInput()).empty()) && (std::get<1>(GetInput()).length() == 1); |
| 18 | } | ||
| 19 | |||
| 20 | 8 | bool OrehovNCharacterFrequencySEQ::PreProcessingImpl() { | |
| 21 | 8 | return true; | |
| 22 | } | ||
| 23 | |||
| 24 | 8 | bool OrehovNCharacterFrequencySEQ::RunImpl() { | |
| 25 | std::string str = std::get<0>(GetInput()); | ||
| 26 | std::string symbol = std::get<1>(GetInput()); | ||
| 27 | int result = 0; | ||
| 28 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 8 times.
|
296 | for (size_t i = 0; i < str.length(); i++) { |
| 29 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 264 times.
|
288 | if (str[i] == symbol[0]) { |
| 30 | 24 | result++; | |
| 31 | } | ||
| 32 | } | ||
| 33 | 8 | GetOutput() = result; | |
| 34 | |||
| 35 | 8 | return true; | |
| 36 | } | ||
| 37 | |||
| 38 | 8 | bool OrehovNCharacterFrequencySEQ::PostProcessingImpl() { | |
| 39 | 8 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | } // namespace orehov_n_character_frequency | ||
| 43 |