| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "akimov_i_words_string_count/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cctype> | ||
| 4 | |||
| 5 | #include "akimov_i_words_string_count/common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace akimov_i_words_string_count { | ||
| 8 | |||
| 9 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | AkimovIWordsStringCountSEQ::AkimovIWordsStringCountSEQ(const InType &in) { |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 11 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | GetInput() = in; |
| 12 | 8 | GetOutput() = 0; | |
| 13 | 8 | } | |
| 14 | |||
| 15 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | bool AkimovIWordsStringCountSEQ::ValidationImpl() { |
| 16 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
8 | return (!GetInput().empty()) && (GetOutput() == 0); |
| 17 | } | ||
| 18 | |||
| 19 | 8 | bool AkimovIWordsStringCountSEQ::PreProcessingImpl() { | |
| 20 | 8 | input_buffer_ = GetInput(); | |
| 21 | 8 | word_count_ = 0; | |
| 22 | 8 | space_count_ = 0; | |
| 23 | 8 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | bool AkimovIWordsStringCountSEQ::RunImpl() { |
| 27 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (input_buffer_.empty()) { |
| 28 | ✗ | word_count_ = 0; | |
| 29 | ✗ | return true; | |
| 30 | } | ||
| 31 | |||
| 32 |
2/2✓ Branch 0 taken 1552 times.
✓ Branch 1 taken 8 times.
|
1560 | for (char c : input_buffer_) { |
| 33 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 1264 times.
|
1552 | if (std::isspace(static_cast<unsigned char>(c)) != 0) { |
| 34 | 288 | ++space_count_; | |
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | bool in_word = false; | ||
| 39 | 8 | word_count_ = 0; | |
| 40 |
2/2✓ Branch 0 taken 1552 times.
✓ Branch 1 taken 8 times.
|
1560 | for (char c : input_buffer_) { |
| 41 |
4/4✓ Branch 0 taken 1264 times.
✓ Branch 1 taken 288 times.
✓ Branch 2 taken 208 times.
✓ Branch 3 taken 1056 times.
|
1552 | if (std::isspace(static_cast<unsigned char>(c)) == 0 && !in_word) { |
| 42 | in_word = true; | ||
| 43 | 208 | ++word_count_; | |
| 44 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 1056 times.
|
1344 | } else if (std::isspace(static_cast<unsigned char>(c)) != 0 && in_word) { |
| 45 | in_word = false; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | return true; | ||
| 50 | } | ||
| 51 | |||
| 52 | 8 | bool AkimovIWordsStringCountSEQ::PostProcessingImpl() { | |
| 53 | 8 | GetOutput() = word_count_; | |
| 54 | 8 | return true; | |
| 55 | } | ||
| 56 | |||
| 57 | } // namespace akimov_i_words_string_count | ||
| 58 |