Blender
V4.3
source
blender
blenlib
tests
BLI_offset_indices_test.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2024 Blender Authors
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#include "testing/testing.h"
6
7
#include "
BLI_index_mask.hh
"
8
#include "
BLI_offset_indices.hh
"
9
#include "
BLI_vector.hh
"
10
11
#include "
BLI_strict_flags.h
"
/* Keep last. */
12
13
namespace
blender::offset_indices::tests
{
14
15
TEST
(offset_indices, SumSizes)
16
{
17
Vector<int>
data = {3, 2, 1, 5, -1};
18
const
OffsetIndices<int>
offsets =
accumulate_counts_to_offsets
(data);
19
EXPECT_EQ
(
sum_group_sizes
(offsets, {0, 1, 2, 3}), 11);
20
EXPECT_EQ
(
sum_group_sizes
(offsets, {3, 2, 1, 0}), 11);
21
EXPECT_EQ
(
sum_group_sizes
(offsets, {3, 0}), 8);
22
EXPECT_EQ
(
sum_group_sizes
(offsets,
IndexRange
(4)), 11);
23
EXPECT_EQ
(
sum_group_sizes
(offsets,
IndexMask
(4)), 11);
24
EXPECT_EQ
(
sum_group_sizes
(offsets,
IndexMask
(1)), 3);
25
}
26
27
}
// namespace blender::offset_indices::tests
EXPECT_EQ
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
BLI_index_mask.hh
BLI_offset_indices.hh
BLI_strict_flags.h
BLI_vector.hh
blender::IndexRange
Definition
BLI_index_range.hh:50
blender::Vector
Definition
BLI_vector.hh:65
blender::index_mask::IndexMask
Definition
BLI_index_mask.hh:184
blender::offset_indices::OffsetIndices
Definition
BLI_offset_indices.hh:29
blender::offset_indices::tests
Definition
BLI_offset_indices_test.cc:13
blender::offset_indices::tests::TEST
TEST(offset_indices, SumSizes)
Definition
BLI_offset_indices_test.cc:15
blender::offset_indices::accumulate_counts_to_offsets
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
Definition
offset_indices.cc:11
blender::offset_indices::sum_group_sizes
int sum_group_sizes(OffsetIndices< int > offsets, const IndexMask &mask)
Definition
offset_indices.cc:106
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0