| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "vdovin_a_words_counting/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include "vdovin_a_words_counting/common/include/common.hpp" | ||
| 4 | |||
| 5 | namespace vdovin_a_words_counting { | ||
| 6 | |||
| 7 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | VdovinAWordsCountingSEQ::VdovinAWordsCountingSEQ(const InType &in) { |
| 8 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 9 | GetInput() = in; | ||
| 10 | 24 | GetOutput() = 0; | |
| 11 | 24 | } | |
| 12 | |||
| 13 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | bool VdovinAWordsCountingSEQ::ValidationImpl() { |
| 14 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | return (!GetInput().empty()) && (GetOutput() == 0); |
| 15 | } | ||
| 16 | |||
| 17 | 24 | bool VdovinAWordsCountingSEQ::PreProcessingImpl() { | |
| 18 | 24 | return true; | |
| 19 | } | ||
| 20 | |||
| 21 | 24 | bool VdovinAWordsCountingSEQ::RunImpl() { | |
| 22 | auto input = GetInput(); | ||
| 23 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (input.empty()) { |
| 24 | return false; | ||
| 25 | } | ||
| 26 | |||
| 27 | int counter = 0; | ||
| 28 | bool on_word = false; | ||
| 29 |
2/2✓ Branch 0 taken 52232 times.
✓ Branch 1 taken 24 times.
|
52256 | for (char ch : input) { |
| 30 |
2/2✓ Branch 0 taken 8064 times.
✓ Branch 1 taken 44168 times.
|
52232 | if (ch == ' ') { |
| 31 |
2/2✓ Branch 0 taken 8040 times.
✓ Branch 1 taken 24 times.
|
8064 | if (on_word) { |
| 32 | 8040 | ++counter; | |
| 33 | on_word = false; | ||
| 34 | } | ||
| 35 | } else { | ||
| 36 | on_word = true; | ||
| 37 | } | ||
| 38 | } | ||
| 39 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (on_word) { |
| 40 | 24 | ++counter; | |
| 41 | } | ||
| 42 | 24 | GetOutput() = counter; | |
| 43 | 24 | return true; | |
| 44 | } | ||
| 45 | |||
| 46 | 24 | bool VdovinAWordsCountingSEQ::PostProcessingImpl() { | |
| 47 | 24 | return true; | |
| 48 | } | ||
| 49 | |||
| 50 | } // namespace vdovin_a_words_counting | ||
| 51 |