Blender V4.3
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"
9#include "BLI_vector.hh"
10
11#include "BLI_strict_flags.h" /* Keep last. */
12
14
15TEST(offset_indices, SumSizes)
16{
17 Vector<int> data = {3, 2, 1, 5, -1};
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(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
int sum_group_sizes(OffsetIndices< int > offsets, const IndexMask &mask)