| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "papulina_y_count_of_letters/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cctype> | ||
| 4 | |||
| 5 | #include "papulina_y_count_of_letters/common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace papulina_y_count_of_letters { | ||
| 8 | |||
| 9 |
1/2✓ Branch 1 taken 160 times.
✗ Branch 2 not taken.
|
160 | PapulinaYCountOfLettersSEQ::PapulinaYCountOfLettersSEQ(const InType &in) { |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 11 | GetInput() = in; | ||
| 12 | 160 | GetOutput() = 0; | |
| 13 | 160 | } | |
| 14 | 160 | int PapulinaYCountOfLettersSEQ::CountOfLetters(const char *s, const int &n) { | |
| 15 | int k = 0; | ||
| 16 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 8 times.
|
160 | if (n <= 0) { |
| 17 | return 0; | ||
| 18 | } | ||
| 19 |
2/2✓ Branch 0 taken 5272 times.
✓ Branch 1 taken 152 times.
|
5424 | for (int i = 0; i < n; i++) { |
| 20 | 5272 | unsigned char c = s[i]; | |
| 21 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 2552 times.
|
5272 | if (isalpha(c) != 0) { |
| 22 | 2720 | k++; | |
| 23 | } | ||
| 24 | } | ||
| 25 | return k; | ||
| 26 | } | ||
| 27 | 160 | bool PapulinaYCountOfLettersSEQ::ValidationImpl() { | |
| 28 | 160 | return true; | |
| 29 | } | ||
| 30 | |||
| 31 | 160 | bool PapulinaYCountOfLettersSEQ::PreProcessingImpl() { | |
| 32 | 160 | GetOutput() = 0; | |
| 33 | 160 | return GetOutput() == 0; | |
| 34 | } | ||
| 35 | |||
| 36 | 160 | bool PapulinaYCountOfLettersSEQ::RunImpl() { | |
| 37 | 160 | GetOutput() = CountOfLetters(GetInput().data(), static_cast<int>(GetInput().size())); | |
| 38 | 160 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 | 160 | bool PapulinaYCountOfLettersSEQ::PostProcessingImpl() { | |
| 42 | 160 | return true; | |
| 43 | } | ||
| 44 | |||
| 45 | } // namespace papulina_y_count_of_letters | ||
| 46 |