| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "baldin_a_word_count/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cctype> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <string> | ||
| 6 | |||
| 7 | #include "baldin_a_word_count/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace baldin_a_word_count { | ||
| 10 | |||
| 11 | namespace { | ||
| 12 | |||
| 13 | bool IsWordChar(char c) { | ||
| 14 | 6360 | return ((std::isalnum(static_cast<unsigned char>(c)) != 0) || c == '-' || c == '_'); | |
| 15 | } | ||
| 16 | |||
| 17 | } // namespace | ||
| 18 | |||
| 19 |
1/2✓ Branch 1 taken 288 times.
✗ Branch 2 not taken.
|
288 | BaldinAWordCountSEQ::BaldinAWordCountSEQ(const InType &in) { |
| 20 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 21 | GetInput() = in; | ||
| 22 | 288 | GetOutput() = 0; | |
| 23 | 288 | } | |
| 24 | |||
| 25 | 288 | bool BaldinAWordCountSEQ::ValidationImpl() { | |
| 26 | 288 | return true; | |
| 27 | } | ||
| 28 | |||
| 29 | 288 | bool BaldinAWordCountSEQ::PreProcessingImpl() { | |
| 30 | 288 | return true; | |
| 31 | } | ||
| 32 | |||
| 33 | 288 | bool BaldinAWordCountSEQ::RunImpl() { | |
| 34 | std::string &input = GetInput(); | ||
| 35 | size_t count = 0; | ||
| 36 | bool in_word = false; | ||
| 37 |
4/4✓ Branch 0 taken 1304 times.
✓ Branch 1 taken 3752 times.
✓ Branch 2 taken 5056 times.
✓ Branch 3 taken 288 times.
|
5344 | for (char c : input) { |
| 38 |
2/2✓ Branch 0 taken 184 times.
✓ Branch 1 taken 1120 times.
|
1304 | if (IsWordChar(c)) { |
| 39 |
2/2✓ Branch 0 taken 816 times.
✓ Branch 1 taken 3120 times.
|
3936 | if (!in_word) { |
| 40 | in_word = true; | ||
| 41 | 816 | count++; | |
| 42 | } | ||
| 43 | } else { | ||
| 44 | in_word = false; | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | 288 | GetOutput() = count; | |
| 49 | 288 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | 288 | bool BaldinAWordCountSEQ::PostProcessingImpl() { | |
| 53 | 288 | return true; | |
| 54 | } | ||
| 55 | |||
| 56 | } // namespace baldin_a_word_count | ||
| 57 |