| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "shilin_n_counting_number_sentences_in_line/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <string> | ||
| 5 | |||
| 6 | #include "shilin_n_counting_number_sentences_in_line/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace shilin_n_counting_number_sentences_in_line { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 192 times.
✗ Branch 2 not taken.
|
192 | ShilinNCountingNumberSentencesInLineSEQ::ShilinNCountingNumberSentencesInLineSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | GetInput() = in; | ||
| 13 | 192 | GetOutput() = 0; | |
| 14 | 192 | } | |
| 15 | |||
| 16 | 192 | bool ShilinNCountingNumberSentencesInLineSEQ::ValidationImpl() { | |
| 17 | 192 | return GetOutput() == 0; | |
| 18 | } | ||
| 19 | |||
| 20 | 192 | bool ShilinNCountingNumberSentencesInLineSEQ::PreProcessingImpl() { | |
| 21 | 192 | GetOutput() = 0; | |
| 22 | 192 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 | 192 | bool ShilinNCountingNumberSentencesInLineSEQ::RunImpl() { | |
| 26 | const std::string &input = GetInput(); | ||
| 27 | int count = 0; | ||
| 28 | |||
| 29 |
2/2✓ Branch 0 taken 3032 times.
✓ Branch 1 taken 192 times.
|
3224 | for (size_t i = 0; i < input.length(); ++i) { |
| 30 | 3032 | char ch = input[i]; | |
| 31 |
2/2✓ Branch 0 taken 408 times.
✓ Branch 1 taken 2624 times.
|
3032 | if (ch == '.' || ch == '!' || ch == '?') { |
| 32 | 408 | count++; | |
| 33 |
4/4✓ Branch 0 taken 440 times.
✓ Branch 1 taken 160 times.
✓ Branch 2 taken 192 times.
✓ Branch 3 taken 248 times.
|
600 | while (i + 1 < input.length() && (input[i + 1] == '.' || input[i + 1] == '!' || input[i + 1] == '?')) { |
| 34 | ++i; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 192 | GetOutput() = count; | |
| 40 | 192 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 | 192 | bool ShilinNCountingNumberSentencesInLineSEQ::PostProcessingImpl() { | |
| 44 | 192 | return true; | |
| 45 | } | ||
| 46 | |||
| 47 | } // namespace shilin_n_counting_number_sentences_in_line | ||
| 48 |