GCC Code Coverage Report


Directory: ./
File: tasks/shakirova_e_elem_matrix_sum/common/include/matrix.hpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 0 0 -%
Branches: 7 9 77.8%

Line Branch Exec Source
1 #pragma once
2
3 #include <cstddef>
4 #include <cstdint>
5 #include <vector>
6
7 namespace shakirova_e_elem_matrix_sum {
8
9
2/3
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 81 times.
✗ Branch 3 not taken.
441 struct Matrix {
10 size_t rows;
11 size_t cols;
12 std::vector<int64_t> data; // одномерный массив
13
14 [[nodiscard]] bool IsValid() const {
15
5/6
✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 72 times.
81 return rows > 0 && cols > 0 && data.size() == rows * cols;
16 }
17
18 [[nodiscard]] int64_t &At(size_t i, size_t j) {
19 19928 return data[(i * cols) + j];
20 }
21
22 [[nodiscard]] const int64_t &At(size_t i, size_t j) const {
23 return data[(i * cols) + j];
24 }
25
26 friend bool operator==(const Matrix &v_left, const Matrix &v_right) {
27 return v_left.rows == v_right.rows && v_left.cols == v_right.cols && v_left.data == v_right.data;
28 }
29 };
30
31 } // namespace shakirova_e_elem_matrix_sum
32