GCC Code Coverage Report


Directory: ./
File: tasks/morozova_s_strassen_multiplication/common/include/common.hpp
Date: 2026-04-02 17:12:27
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 0 0 -%
Branches: 16 30 53.3%

Line Branch Exec Source
1 #pragma once
2
3 #include <cmath>
4 #include <cstddef> // для size_t
5 #include <string>
6 #include <tuple>
7 #include <vector>
8
9 #include "task/include/task.hpp"
10
11 namespace morozova_s_strassen_multiplication {
12 using InType = std::vector<double>;
13 using OutType = std::vector<double>;
14 using TestType = std::tuple<int, std::string>;
15 using BaseTask = ppc::task::Task<InType, OutType>;
16
17
4/8
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 108 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 108 times.
444 struct Matrix {
18 std::vector<double> data;
19 int size;
20
21
1/2
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
132 Matrix() : size(0) {}
22
23
7/14
✓ Branch 6 taken 12 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 12 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 12 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 12 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 12 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 12 times.
✗ Branch 25 not taken.
960 explicit Matrix(int n) : data(static_cast<size_t>(n) * static_cast<size_t>(n), 0.0), size(n) {}
24
25 double &operator()(int i, int j) {
26
2/2
✓ Branch 0 taken 261432 times.
✓ Branch 1 taken 816 times.
3015384 return data[(i * size) + j];
27 }
28 const double &operator()(int i, int j) const {
29
2/4
✓ Branch 0 taken 174832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 87416 times.
✗ Branch 3 not taken.
55671240 return data[(i * size) + j];
30 }
31
32 bool operator==(const Matrix &other) const {
33 if (size != other.size) {
34 return false;
35 }
36 const double eps = 1e-6;
37 for (size_t i = 0; i < data.size(); ++i) {
38 if (std::abs(data[i] - other.data[i]) > eps) {
39 return false;
40 }
41 }
42 return true;
43 }
44 };
45
46 } // namespace morozova_s_strassen_multiplication
47