Blender V4.3
BLI_bit_group_vector_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "testing/testing.h"
6
8
9#include "BLI_strict_flags.h" /* Keep last. */
10
12
13TEST(bit_group_vector, DefaultConstruct)
14{
15 BitGroupVector<> groups;
16 EXPECT_EQ(groups.size(), 0);
17}
18
19TEST(bit_group_vector, Construct)
20{
21 BitGroupVector<> groups(12, 5);
22
23 EXPECT_EQ(groups.size(), 12);
24 EXPECT_EQ(groups[0].size(), 5);
25 EXPECT_EQ(groups[4].size(), 5);
26}
27
28TEST(bit_group_vector, CopyConstruct)
29{
30 BitGroupVector<> groups(12, 5);
31 for (const int64_t i : groups.index_range()) {
32 MutableBoundedBitSpan span = groups[i];
33 for (const int64_t j : span.index_range()) {
34 span[j].set(j % 2 == 0);
35 }
36 }
37
38 BitGroupVector<> copy(groups);
39
40 EXPECT_EQ(groups.size(), copy.size());
41 EXPECT_EQ(groups.group_size(), copy.group_size());
42 for (const int64_t i : groups.index_range()) {
43 BoundedBitSpan span = groups[i];
44 BoundedBitSpan copy_span = copy[i];
45 for (const int64_t j : span.index_range()) {
46 EXPECT_EQ(span[j].test(), copy_span[j].test());
47 }
48 }
49}
50
51} // namespace blender::bits::tests
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
IndexRange index_range() const
IndexRange index_range() const
TEST(bit_group_vector, DefaultConstruct)
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)
__int64 int64_t
Definition stdint.h:89