Blender V4.3
BLI_array_utils_test.cc File Reference
#include "testing/testing.h"
#include "BLI_array_utils.h"
#include "BLI_array_utils.hh"
#include "BLI_utildefines.h"
#include "BLI_utildefines_stack.h"

Go to the source code of this file.

Macros

#define STACK_PUSH_AND_CHECK_FORWARD(v, i)
 
#define STACK_PUSH_AND_CHECK_BACKWARD(v, i)
 
#define STACK_PUSH_AND_CHECK_BOTH(v, i)
 
#define BINARY_AND_TEST(data_cmp, data_a, data_b, data_combine, length)
 
#define BINARY_OR_TEST(data_cmp, data_a, data_b, data_combine, length)
 
#define DEDUPLICATE_ORDERED_TEST(data, data_cmp)
 

Functions

 TEST (array_utils, ReverseStringEmpty)
 
 TEST (array_utils, ReverseStringSingle)
 
 TEST (array_utils, ReverseString4)
 
 TEST (array_utils, ReverseInt4)
 
 TEST (array_utils, FindIndexStringEmpty)
 
 TEST (array_utils, FindIndexStringSingle)
 
 TEST (array_utils, FindIndexStringSingleMissing)
 
 TEST (array_utils, FindIndexString4)
 
 TEST (array_utils, FindIndexInt4)
 
 TEST (array_utils, FindIndexInt4_DupeEnd)
 
 TEST (array_utils, FindIndexInt4_DupeMid)
 
 TEST (array_utils, FindIndexPointer)
 
 TEST (array_utils, BinaryAndInt4Zero)
 
 TEST (array_utils, BinaryAndInt4Mix)
 
 TEST (array_utils, BinaryOrInt4Alternate)
 
 TEST (array_utils, BinaryOrInt4Mix)
 
 TEST (array_utils, DeduplicateOrdered1)
 
 TEST (array_utils, DeduplicateOrdered2)
 
 TEST (array_utils, DeduplicateOrdered2Same)
 
 TEST (array_utils, DeduplicateOrdered3Same)
 
 TEST (array_utils, DeduplicateOrdered3)
 
static void find_all_ranges_test (const blender::Span< bool > data, const blender::Span< blender::IndexRange > data_cmp)
 
 TEST (array_utils, FindAllRanges1)
 
 TEST (array_utils, FindAllRanges2)
 
 TEST (array_utils, FindAllRanges3)
 
 TEST (array_utils, FindAllRanges4)
 
 TEST (array_utils, FindAllRanges5)
 

Macro Definition Documentation

◆ BINARY_AND_TEST

#define BINARY_AND_TEST ( data_cmp,
data_a,
data_b,
data_combine,
length )
Value:
{ \
BLI_array_binary_and(data_combine, data_a, data_b, length); \
EXPECT_EQ_ARRAY(data_cmp, data_combine, length); \
} \
((void)0)

Definition at line 149 of file BLI_array_utils_test.cc.

Referenced by TEST(), and TEST().

◆ BINARY_OR_TEST

#define BINARY_OR_TEST ( data_cmp,
data_a,
data_b,
data_combine,
length )
Value:
{ \
BLI_array_binary_or(data_combine, data_a, data_b, length); \
EXPECT_EQ_ARRAY(data_combine, data_cmp, length); \
} \
((void)0)

Definition at line 174 of file BLI_array_utils_test.cc.

Referenced by TEST(), and TEST().

◆ DEDUPLICATE_ORDERED_TEST

#define DEDUPLICATE_ORDERED_TEST ( data,
data_cmp )
Value:
{ \
const uint data_len_new = BLI_array_deduplicate_ordered(data, ARRAY_SIZE(data)); \
EXPECT_EQ(data_len_new, ARRAY_SIZE(data_cmp)); \
EXPECT_EQ_ARRAY(data, data_cmp, data_len_new); \
/* Ensure running a second time does nothing. */ \
const uint data_len_test = BLI_array_deduplicate_ordered(data, data_len_new); \
EXPECT_EQ(data_len_test, ARRAY_SIZE(data_cmp)); \
EXPECT_EQ_ARRAY(data, data_cmp, data_len_new); \
} \
((void)0)
#define BLI_array_deduplicate_ordered(arr, arr_len)
unsigned int uint
#define ARRAY_SIZE(arr)

Definition at line 197 of file BLI_array_utils_test.cc.

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ STACK_PUSH_AND_CHECK_BACKWARD

#define STACK_PUSH_AND_CHECK_BACKWARD ( v,
i )
Value:
{ \
STACK_PUSH(data, v); \
EXPECT_EQ(BLI_array_rfindindex(data, STACK_SIZE(data), &(v)), i); \
} \
((void)0)
#define BLI_array_rfindindex(arr, arr_len, p)
#define STACK_SIZE(stack)
ATTR_WARN_UNUSED_RESULT const BMVert * v

Referenced by TEST().

◆ STACK_PUSH_AND_CHECK_BOTH

#define STACK_PUSH_AND_CHECK_BOTH ( v,
i )
Value:
{ \
STACK_PUSH(data, v); \
EXPECT_EQ(BLI_array_findindex(data, STACK_SIZE(data), &(v)), i); \
EXPECT_EQ(BLI_array_rfindindex(data, STACK_SIZE(data), &(v)), i); \
} \
((void)0)
#define BLI_array_findindex(arr, arr_len, p)

Referenced by TEST().

◆ STACK_PUSH_AND_CHECK_FORWARD

#define STACK_PUSH_AND_CHECK_FORWARD ( v,
i )
Value:
{ \
STACK_PUSH(data, v); \
EXPECT_EQ(BLI_array_findindex(data, STACK_SIZE(data), &(v)), i); \
} \
((void)0)

Referenced by TEST().

Function Documentation

◆ find_all_ranges_test()

static void find_all_ranges_test ( const blender::Span< bool > data,
const blender::Span< blender::IndexRange > data_cmp )
static

Definition at line 246 of file BLI_array_utils_test.cc.

References blender::Span< T >::data(), EXPECT_EQ(), and blender::Span< T >::size().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ TEST() [1/26]

TEST ( array_utils ,
BinaryAndInt4Mix  )

Definition at line 164 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BINARY_AND_TEST.

◆ TEST() [2/26]

TEST ( array_utils ,
BinaryAndInt4Zero  )

Definition at line 156 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BINARY_AND_TEST.

◆ TEST() [3/26]

TEST ( array_utils ,
BinaryOrInt4Alternate  )

Definition at line 181 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BINARY_OR_TEST.

◆ TEST() [4/26]

TEST ( array_utils ,
BinaryOrInt4Mix  )

Definition at line 188 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BINARY_OR_TEST.

◆ TEST() [5/26]

TEST ( array_utils ,
DeduplicateOrdered1  )

Definition at line 209 of file BLI_array_utils_test.cc.

References DEDUPLICATE_ORDERED_TEST.

◆ TEST() [6/26]

TEST ( array_utils ,
DeduplicateOrdered2  )

Definition at line 216 of file BLI_array_utils_test.cc.

References DEDUPLICATE_ORDERED_TEST.

◆ TEST() [7/26]

TEST ( array_utils ,
DeduplicateOrdered2Same  )

Definition at line 223 of file BLI_array_utils_test.cc.

References DEDUPLICATE_ORDERED_TEST.

◆ TEST() [8/26]

TEST ( array_utils ,
DeduplicateOrdered3  )

Definition at line 237 of file BLI_array_utils_test.cc.

References DEDUPLICATE_ORDERED_TEST.

◆ TEST() [9/26]

TEST ( array_utils ,
DeduplicateOrdered3Same  )

Definition at line 230 of file BLI_array_utils_test.cc.

References DEDUPLICATE_ORDERED_TEST.

◆ TEST() [10/26]

TEST ( array_utils ,
FindAllRanges1  )

Definition at line 255 of file BLI_array_utils_test.cc.

References EXPECT_EQ().

◆ TEST() [11/26]

TEST ( array_utils ,
FindAllRanges2  )

Definition at line 263 of file BLI_array_utils_test.cc.

References find_all_ranges_test().

◆ TEST() [12/26]

TEST ( array_utils ,
FindAllRanges3  )

Definition at line 271 of file BLI_array_utils_test.cc.

References find_all_ranges_test().

◆ TEST() [13/26]

TEST ( array_utils ,
FindAllRanges4  )

Definition at line 279 of file BLI_array_utils_test.cc.

References find_all_ranges_test().

◆ TEST() [14/26]

TEST ( array_utils ,
FindAllRanges5  )

Definition at line 287 of file BLI_array_utils_test.cc.

References find_all_ranges_test().

◆ TEST() [15/26]

TEST ( array_utils ,
FindIndexInt4  )

◆ TEST() [16/26]

TEST ( array_utils ,
FindIndexInt4_DupeEnd  )

◆ TEST() [17/26]

TEST ( array_utils ,
FindIndexInt4_DupeMid  )

◆ TEST() [18/26]

TEST ( array_utils ,
FindIndexPointer  )

◆ TEST() [19/26]

TEST ( array_utils ,
FindIndexString4  )

◆ TEST() [20/26]

TEST ( array_utils ,
FindIndexStringEmpty  )

◆ TEST() [21/26]

TEST ( array_utils ,
FindIndexStringSingle  )

◆ TEST() [22/26]

TEST ( array_utils ,
FindIndexStringSingleMissing  )

◆ TEST() [23/26]

TEST ( array_utils ,
ReverseInt4  )

Definition at line 37 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BLI_array_reverse.

◆ TEST() [24/26]

TEST ( array_utils ,
ReverseString4  )

Definition at line 30 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BLI_array_reverse.

◆ TEST() [25/26]

TEST ( array_utils ,
ReverseStringEmpty  )

Definition at line 16 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BLI_array_reverse.

◆ TEST() [26/26]

TEST ( array_utils ,
ReverseStringSingle  )

Definition at line 23 of file BLI_array_utils_test.cc.

References ARRAY_SIZE, and BLI_array_reverse.