GCC Code Coverage Report


Directory: ./
File: tasks/morozov_n_sentence_count/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 5 5 100.0%
Branches: 16 22 72.7%

Line Branch Exec Source
1 #include "morozov_n_sentence_count/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <string>
5
6 #include "morozov_n_sentence_count/common/include/common.hpp"
7
8 namespace morozov_n_sentence_count {
9
10
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 MorozovNSentenceCountSEQ::MorozovNSentenceCountSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 GetInput() = in;
13 48 GetOutput() = 0;
14 48 }
15
16
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 bool MorozovNSentenceCountSEQ::ValidationImpl() {
17
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
48 validated_ = (!GetInput().empty()) && (GetOutput() == 0);
18 48 return validated_;
19 }
20
21 48 bool MorozovNSentenceCountSEQ::PreProcessingImpl() {
22
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (!validated_) {
23 return false;
24 }
25
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 40 times.
48 if (GetInput()[0] == '.' || GetInput()[0] == '!' || GetInput()[0] == '?') {
26 8 GetInput()[0] = ' ';
27 }
28 return true;
29 }
30
31 48 bool MorozovNSentenceCountSEQ::RunImpl() {
32
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (!validated_) {
33 return false;
34 }
35
36 std::string &input = GetInput();
37 std::size_t counter = 0;
38
2/2
✓ Branch 0 taken 49872 times.
✓ Branch 1 taken 48 times.
49920 for (size_t i = 0; i < input.length(); i++) {
39
4/4
✓ Branch 0 taken 2728 times.
✓ Branch 1 taken 47144 times.
✓ Branch 2 taken 928 times.
✓ Branch 3 taken 1800 times.
49872 if ((input[i] == '.' || input[i] == '!' || input[i] == '?') && (input[i - 1] != '.') && (input[i - 1] != '?') &&
40 (input[i - 1] != '!')) {
41 928 counter++;
42 }
43 }
44
45
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 8 times.
48 if (counter != 0) {
46 40 GetOutput() = counter;
47 }
48 return true;
49 }
50
51 48 bool MorozovNSentenceCountSEQ::PostProcessingImpl() {
52 48 return validated_;
53 }
54
55 } // namespace morozov_n_sentence_count
56