GCC Code Coverage Report


Directory: ./
File: tasks/kotelnikova_a_num_sent_in_line/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 5 5 100.0%
Branches: 10 12 83.3%

Line Branch Exec Source
1 #include "kotelnikova_a_num_sent_in_line/seq/include/ops_seq.hpp"
2
3 #include <cctype>
4 #include <cstddef>
5 #include <string>
6
7 #include "kotelnikova_a_num_sent_in_line/common/include/common.hpp"
8
9 namespace kotelnikova_a_num_sent_in_line {
10
11
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 KotelnikovaANumSentInLineSEQ::KotelnikovaANumSentInLineSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 48 GetOutput() = 0;
15 48 }
16
17 48 bool KotelnikovaANumSentInLineSEQ::ValidationImpl() {
18 48 return !GetInput().empty();
19 }
20
21 48 bool KotelnikovaANumSentInLineSEQ::PreProcessingImpl() {
22 48 return true;
23 }
24
25 48 bool KotelnikovaANumSentInLineSEQ::RunImpl() {
26 const std::string &text = GetInput();
27
28 std::size_t sentence_count = 0;
29 bool in_sentence = false;
30
31
2/2
✓ Branch 0 taken 1306512 times.
✓ Branch 1 taken 48 times.
1306560 for (std::size_t i = 0; i < text.length(); ++i) {
32 1306512 char current_symb = text[i];
33
34
2/2
✓ Branch 0 taken 10672 times.
✓ Branch 1 taken 1295840 times.
1306512 if (current_symb == '.' || current_symb == '!' || current_symb == '?') {
35
1/2
✓ Branch 0 taken 10672 times.
✗ Branch 1 not taken.
10672 if (in_sentence) {
36 10672 sentence_count++;
37 in_sentence = false;
38 }
39
2/2
✓ Branch 0 taken 1139136 times.
✓ Branch 1 taken 156704 times.
1295840 } else if (std::isalnum(static_cast<unsigned char>(current_symb)) != 0) {
40 in_sentence = true;
41 }
42 }
43
44
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 32 times.
48 if (in_sentence) {
45 16 sentence_count++;
46 }
47
48 48 GetOutput() = sentence_count;
49 48 return true;
50 }
51
52 48 bool KotelnikovaANumSentInLineSEQ::PostProcessingImpl() {
53 48 return true;
54 }
55
56 } // namespace kotelnikova_a_num_sent_in_line
57