Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com> | ||
3 | // | ||
4 | // SPDX-License-Identifier: Apache-2.0 | ||
5 | // | ||
6 | |||
7 | #include "test/common/rect.hpp" | ||
8 | |||
9 | #include <cstddef> | ||
10 | #include <ostream> | ||
11 | |||
12 | namespace kai::test { | ||
13 | |||
14 | 123720 | Rect::Rect(size_t start_row, size_t start_col, size_t height, size_t width) : | |
15 | 123720 | _start_row(start_row), _start_col(start_col), _height(height), _width(width) { | |
16 | 123720 | } | |
17 | |||
18 | 25246676 | size_t Rect::start_row() const { | |
19 | 25246676 | return _start_row; | |
20 | } | ||
21 | |||
22 | 20827906 | size_t Rect::start_col() const { | |
23 | 20827906 | return _start_col; | |
24 | } | ||
25 | |||
26 | 203912 | size_t Rect::height() const { | |
27 | 203912 | return _height; | |
28 | } | ||
29 | |||
30 | 3115706 | size_t Rect::width() const { | |
31 | 3115706 | return _width; | |
32 | } | ||
33 | |||
34 | 124064690 | size_t Rect::end_row() const { | |
35 | 124064690 | return _start_row + _height; | |
36 | } | ||
37 | |||
38 | 101374232 | size_t Rect::end_col() const { | |
39 | 101374232 | return _start_col + _width; | |
40 | } | ||
41 | |||
42 | 116108514 | bool Rect::contains(size_t row, size_t col) const { | |
43 |
6/6✓ Branch 0 taken 106824910 times.
✓ Branch 1 taken 9283604 times.
✓ Branch 2 taken 98650104 times.
✓ Branch 3 taken 8174806 times.
✓ Branch 4 taken 10335604 times.
✓ Branch 5 taken 88314500 times.
|
116108514 | return row >= _start_row && row < end_row() && col >= _start_col && col < end_col(); |
44 | } | ||
45 | |||
46 | ✗ | std::ostream& operator<<(std::ostream& os, const Rect& rect) { | |
47 | ✗ | return os << "[start_row=" << rect.start_row() << ", start_col=" << rect.start_col() << ", height=" << rect.height() | |
48 | ✗ | << ", width=" << rect.width() << "]"; | |
49 | } | ||
50 | |||
51 | } // namespace kai::test | ||
52 |