| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <cctype> // Для std::isspace | ||
| 2 | #include <string> // Включаем, чтобы гарантировать, что std::string доступен | ||
| 3 | |||
| 4 | // ИСПРАВЛЕНИЕ ОШИБКИ C1083: Используем полный путь к заголовочному файлу | ||
| 5 | #include "borunov_v_cnt_words/common/include/common.hpp" | ||
| 6 | #include "borunov_v_cnt_words/seq/include/ops_seq.hpp" | ||
| 7 | |||
| 8 | namespace borunov_v_cnt_words { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
|
64 | BorunovVCntWordsSEQ::BorunovVCntWordsSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 64 | GetOutput() = 0; | |
| 14 | 64 | } | |
| 15 | |||
| 16 | 64 | bool BorunovVCntWordsSEQ::ValidationImpl() { | |
| 17 | 64 | return GetOutput() == 0; | |
| 18 | } | ||
| 19 | |||
| 20 | 64 | bool BorunovVCntWordsSEQ::PreProcessingImpl() { | |
| 21 | 64 | return true; | |
| 22 | } | ||
| 23 | |||
| 24 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 56 times.
|
64 | bool BorunovVCntWordsSEQ::RunImpl() { |
| 25 | const InType &str = GetInput(); | ||
| 26 | |||
| 27 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 56 times.
|
64 | if (str.empty()) { |
| 28 | 8 | GetOutput() = 0; | |
| 29 | 8 | return true; | |
| 30 | } | ||
| 31 | |||
| 32 | OutType count = 0; | ||
| 33 | bool in_word = false; | ||
| 34 | |||
| 35 |
2/2✓ Branch 0 taken 816 times.
✓ Branch 1 taken 56 times.
|
872 | for (char c : str) { |
| 36 |
2/2✓ Branch 0 taken 544 times.
✓ Branch 1 taken 272 times.
|
816 | if (std::isspace(static_cast<unsigned char>(c)) != 0) { |
| 37 | in_word = false; | ||
| 38 | } else { | ||
| 39 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 400 times.
|
544 | if (!in_word) { |
| 40 | 144 | count++; | |
| 41 | in_word = true; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | 56 | GetOutput() = count; | |
| 47 | 56 | return true; | |
| 48 | } | ||
| 49 | |||
| 50 | 64 | bool BorunovVCntWordsSEQ::PostProcessingImpl() { | |
| 51 | 64 | return true; | |
| 52 | } | ||
| 53 | |||
| 54 | } // namespace borunov_v_cnt_words | ||
| 55 |