|
Blender V4.3
|
#include "testing/testing.h"#include "MEM_guardedalloc.h"#include "BLI_array_store.h"#include "BLI_array_utils.h"#include "BLI_listbase.h"#include "BLI_rand.h"#include "BLI_ressource_strings.h"#include "BLI_string.h"#include "BLI_sys_types.h"#include "BLI_utildefines.h"Go to the source code of this file.
Classes | |
| struct | TestChunk |
| struct | TestBuffer |
Macros | |
| #define | testbuffer_list_state_from_string_array(lb, data_array) |
| #define | TESTBUFFER_STRINGS_CREATE(lb, ...) |
| #define | TESTBUFFER_STRINGS(stride, chunk_count, ...) |
| #define | D "#1#2#3#4" |
| #define | WORDS words10k, sizeof(words10k) |
Functions | |
| static TestChunk * | testchunk_list_add (ListBase *lb, const void *data, size_t data_len) |
| static void | testchunk_list_free (ListBase *lb) |
| static char * | testchunk_as_data_array (TestChunk **tc_array, int tc_array_len, size_t *r_data_len) |
| static TestBuffer * | testbuffer_list_add (ListBase *lb, const void *data, size_t data_len) |
| static TestBuffer * | testbuffer_list_add_copydata (ListBase *lb, const void *data, size_t data_len) |
| static void | testbuffer_list_state_from_data (ListBase *lb, const char *data, const size_t data_len) |
| static void | testbuffer_list_state_from_data__stride_expand (ListBase *lb, const char *data, const size_t data_len, const size_t stride) |
| static bool | testbuffer_item_validate (TestBuffer *tb) |
| static bool | testbuffer_list_validate (const ListBase *lb) |
| static void | testbuffer_list_data_randomize (ListBase *lb, uint random_seed) |
| static void | testbuffer_list_store_populate (BArrayStore *bs, ListBase *lb) |
| static void | testbuffer_list_store_clear (BArrayStore *bs, ListBase *lb) |
| static void | testbuffer_list_free (ListBase *lb) |
| static void | testbuffer_run_tests_single (BArrayStore *bs, ListBase *lb) |
| static void | testbuffer_run_tests (BArrayStore *bs, ListBase *lb) |
| static void | testbuffer_run_tests_simple (ListBase *lb, const int stride, const int chunk_count) |
| TEST (array_store, Nop) | |
| TEST (array_store, NopState) | |
| TEST (array_store, Single) | |
| TEST (array_store, DoubleNop) | |
| TEST (array_store, DoubleDiff) | |
| TEST (array_store, TextMixed) | |
| TEST (array_store, TextDupeIncreaseDecrease) | |
| static void | plain_text_helper (const char *words, int words_len, const char word_delim, const int stride, const int chunk_count, const int random_seed) |
| TEST (array_store, TextSentences_Chunk1) | |
| TEST (array_store, TextSentences_Chunk2) | |
| TEST (array_store, TextSentences_Chunk8) | |
| TEST (array_store, TextSentences_Chunk32) | |
| TEST (array_store, TextSentences_Chunk128) | |
| TEST (array_store, TextSentences_Chunk1024) | |
| TEST (array_store, TextSentences_Chunk3) | |
| TEST (array_store, TextSentences_Chunk13) | |
| TEST (array_store, TextSentences_Chunk131) | |
| TEST (array_store, TextWords_Chunk1) | |
| TEST (array_store, TextWords_Chunk2) | |
| TEST (array_store, TextWords_Chunk8) | |
| TEST (array_store, TextWords_Chunk32) | |
| TEST (array_store, TextWords_Chunk128) | |
| TEST (array_store, TextWords_Chunk1024) | |
| TEST (array_store, TextWords_Chunk3) | |
| TEST (array_store, TextWords_Chunk13) | |
| TEST (array_store, TextWords_Chunk131) | |
| TEST (array_store, TextSentencesRandom_Stride3_Chunk3) | |
| TEST (array_store, TextSentencesRandom_Stride8_Chunk8) | |
| TEST (array_store, TextSentencesRandom_Stride32_Chunk1) | |
| TEST (array_store, TextSentencesRandom_Stride12_Chunk512) | |
| TEST (array_store, TextSentencesRandom_Stride128_Chunk6) | |
| static uint | rand_range_i (RNG *rng, uint min_i, uint max_i, uint step) |
| static void | testbuffer_list_state_random_data (ListBase *lb, const size_t stride, const size_t data_min_len, const size_t data_max_len, const uint mutate, RNG *rng) |
| static void | random_data_mutate_helper (const int items_size_min, const int items_size_max, const int items_total, const int stride, const int chunk_count, const int random_seed, const int mutate) |
| TEST (array_store, TestData_Stride1_Chunk32_Mutate2) | |
| TEST (array_store, TestData_Stride8_Chunk512_Mutate2) | |
| TEST (array_store, TestData_Stride12_Chunk48_Mutate2) | |
| TEST (array_store, TestData_Stride32_Chunk64_Mutate1) | |
| TEST (array_store, TestData_Stride32_Chunk64_Mutate8) | |
| static void | random_chunk_generate (ListBase *lb, const int chunks_per_buffer, const int stride, const int chunk_count, const int random_seed) |
| static void | random_chunk_mutate_helper (const int chunks_per_buffer, const int items_total, const int stride, const int chunk_count, const int random_seed) |
| TEST (array_store, TestChunk_Rand8_Stride1_Chunk64) | |
| TEST (array_store, TestChunk_Rand32_Stride1_Chunk64) | |
| TEST (array_store, TestChunk_Rand64_Stride8_Chunk32) | |
| TEST (array_store, TestChunk_Rand31_Stride11_Chunk21) | |
| #define D "#1#2#3#4" |
Referenced by background_light_sample(), background_portal_sample(), bsdf_microfacet_eval(), bsdf_microfacet_sample(), btDoSimplex4(), camera_sample_panorama(), camera_sample_perspective(), libmv::ComputeTrackingEquation(), blender::bke::subdiv::evaluate_vertex_and_apply_displacement_copy(), blender::compositor::DirectionalBlurOperation::init_execution(), integrate_surface_bsdf_bssrdf_bounce(), integrator_init_from_bake(), Freestyle::GeomUtils::intersect2dSegPoly(), light_sample(), md5_process_block(), phase_sample_direction(), SolveP2(), blender::bke::subdiv::subdiv_accumulate_vertex_displacement(), and triangle_light_valid_ray_segment().
| #define testbuffer_list_state_from_string_array | ( | lb, | |
| data_array ) |
Definition at line 171 of file BLI_array_store_test.cc.
| #define TESTBUFFER_STRINGS | ( | stride, | |
| chunk_count, | |||
| ... ) |
Definition at line 192 of file BLI_array_store_test.cc.
Referenced by TEST().
| #define TESTBUFFER_STRINGS_CREATE | ( | lb, | |
| ... ) |
Definition at line 183 of file BLI_array_store_test.cc.
Referenced by TEST().
|
static |
Test that uses text input with different params for the array-store to ensure no corner cases fail.
Definition at line 427 of file BLI_array_store_test.cc.
References BLI_listbase_clear(), ELEM, testbuffer_list_data_randomize(), testbuffer_list_free(), testbuffer_list_state_from_data__stride_expand(), and testbuffer_run_tests_simple().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
Definition at line 562 of file BLI_array_store_test.cc.
References BLI_assert, BLI_rng_get_uint(), max_i(), min_i(), and range.
Referenced by testbuffer_list_state_random_data().
|
static |
Definition at line 707 of file BLI_array_store_test.cc.
References BLI_rng_free(), BLI_rng_get_char_n(), BLI_rng_new(), MEM_mallocN, and testchunk_list_add().
Referenced by random_chunk_mutate_helper().
|
static |
Add random chunks, then re-order them to ensure chunk de-duplication is working.
Definition at line 726 of file BLI_array_store_test.cc.
References BLI_array_store_calc_size_compacted_get(), BLI_array_store_create(), BLI_array_store_destroy(), BLI_assert, BLI_listbase_clear(), BLI_rng_free(), BLI_rng_new(), BLI_rng_shuffle_array(), EXPECT_EQ(), ListBase::first, MEM_freeN(), MEM_mallocN, TestChunk::next, random_chunk_generate(), testbuffer_list_add(), testbuffer_list_free(), testbuffer_run_tests_single(), testchunk_as_data_array(), and testchunk_list_free().
|
static |
Definition at line 655 of file BLI_array_store_test.cc.
References BLI_listbase_clear(), BLI_rng_free(), BLI_rng_new(), testbuffer_list_free(), testbuffer_list_state_random_data(), and testbuffer_run_tests_simple().
| TEST | ( | array_store | , |
| DoubleDiff | ) |
Definition at line 354 of file BLI_array_store_test.cc.
References BLI_array_store_calc_size_compacted_get(), BLI_array_store_calc_size_expanded_get(), BLI_array_store_create(), BLI_array_store_destroy(), BLI_array_store_state_add(), BLI_array_store_state_data_get_alloc(), EXPECT_EQ(), and MEM_freeN().
| TEST | ( | array_store | , |
| DoubleNop | ) |
Definition at line 328 of file BLI_array_store_test.cc.
References BLI_array_store_calc_size_compacted_get(), BLI_array_store_calc_size_expanded_get(), BLI_array_store_create(), BLI_array_store_destroy(), BLI_array_store_state_add(), BLI_array_store_state_data_get_alloc(), EXPECT_EQ(), and MEM_freeN().
| TEST | ( | array_store | , |
| Nop | ) |
Definition at line 298 of file BLI_array_store_test.cc.
References BLI_array_store_create(), and BLI_array_store_destroy().
| TEST | ( | array_store | , |
| NopState | ) |
Definition at line 304 of file BLI_array_store_test.cc.
References BLI_array_store_create(), BLI_array_store_destroy(), BLI_array_store_state_add(), BLI_array_store_state_remove(), BLI_array_store_state_size_get(), EXPECT_EQ(), and state.
| TEST | ( | array_store | , |
| Single | ) |
Definition at line 314 of file BLI_array_store_test.cc.
References BLI_array_store_create(), BLI_array_store_destroy(), BLI_array_store_state_add(), BLI_array_store_state_data_get_alloc(), EXPECT_EQ(), MEM_freeN(), and state.
| TEST | ( | array_store | , |
| TestChunk_Rand31_Stride11_Chunk21 | ) |
Definition at line 788 of file BLI_array_store_test.cc.
References random_chunk_mutate_helper().
| TEST | ( | array_store | , |
| TestChunk_Rand32_Stride1_Chunk64 | ) |
Definition at line 780 of file BLI_array_store_test.cc.
References random_chunk_mutate_helper().
| TEST | ( | array_store | , |
| TestChunk_Rand64_Stride8_Chunk32 | ) |
Definition at line 784 of file BLI_array_store_test.cc.
References random_chunk_mutate_helper().
| TEST | ( | array_store | , |
| TestChunk_Rand8_Stride1_Chunk64 | ) |
Definition at line 776 of file BLI_array_store_test.cc.
References random_chunk_mutate_helper().
| TEST | ( | array_store | , |
| TestData_Stride12_Chunk48_Mutate2 | ) |
Definition at line 691 of file BLI_array_store_test.cc.
References random_data_mutate_helper().
| TEST | ( | array_store | , |
| TestData_Stride1_Chunk32_Mutate2 | ) |
Definition at line 683 of file BLI_array_store_test.cc.
References random_data_mutate_helper().
| TEST | ( | array_store | , |
| TestData_Stride32_Chunk64_Mutate1 | ) |
Definition at line 695 of file BLI_array_store_test.cc.
References random_data_mutate_helper().
| TEST | ( | array_store | , |
| TestData_Stride32_Chunk64_Mutate8 | ) |
Definition at line 699 of file BLI_array_store_test.cc.
References random_data_mutate_helper().
| TEST | ( | array_store | , |
| TestData_Stride8_Chunk512_Mutate2 | ) |
Definition at line 687 of file BLI_array_store_test.cc.
References random_data_mutate_helper().
| TEST | ( | array_store | , |
| TextDupeIncreaseDecrease | ) |
Definition at line 389 of file BLI_array_store_test.cc.
References BLI_array_store_calc_size_compacted_get(), BLI_array_store_create(), BLI_array_store_destroy(), BLI_array_store_is_valid(), BLI_listbase_reverse(), EXPECT_EQ(), testbuffer_list_free(), testbuffer_list_store_clear(), testbuffer_list_store_populate(), testbuffer_list_validate(), and TESTBUFFER_STRINGS_CREATE.
| TEST | ( | array_store | , |
| TextMixed | ) |
Definition at line 379 of file BLI_array_store_test.cc.
References TESTBUFFER_STRINGS.
| TEST | ( | array_store | , |
| TextSentences_Chunk1 | ) |
Definition at line 458 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk1024 | ) |
Definition at line 478 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk128 | ) |
Definition at line 474 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk13 | ) |
Definition at line 487 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk131 | ) |
Definition at line 491 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk2 | ) |
Definition at line 462 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk3 | ) |
Definition at line 483 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk32 | ) |
Definition at line 470 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentences_Chunk8 | ) |
Definition at line 466 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentencesRandom_Stride128_Chunk6 | ) |
Definition at line 552 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentencesRandom_Stride12_Chunk512 | ) |
Definition at line 548 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentencesRandom_Stride32_Chunk1 | ) |
Definition at line 544 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentencesRandom_Stride3_Chunk3 | ) |
Definition at line 536 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextSentencesRandom_Stride8_Chunk8 | ) |
Definition at line 540 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk1 | ) |
Definition at line 497 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk1024 | ) |
Definition at line 517 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk128 | ) |
Definition at line 513 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk13 | ) |
Definition at line 526 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk131 | ) |
Definition at line 530 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk2 | ) |
Definition at line 501 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk3 | ) |
Definition at line 522 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk32 | ) |
Definition at line 509 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
| TEST | ( | array_store | , |
| TextWords_Chunk8 | ) |
Definition at line 505 of file BLI_array_store_test.cc.
References plain_text_helper(), and WORDS.
|
static |
Definition at line 203 of file BLI_array_store_test.cc.
References BLI_array_store_state_data_get_alloc(), TestBuffer::data, TestBuffer::data_len, MEM_freeN(), and TestBuffer::state.
Referenced by testbuffer_list_validate().
|
static |
Definition at line 125 of file BLI_array_store_test.cc.
References BLI_addtail(), data, TestBuffer::data, TestBuffer::data_len, MEM_mallocN, and TestBuffer::state.
Referenced by random_chunk_mutate_helper(), testbuffer_list_add_copydata(), testbuffer_list_state_from_data__stride_expand(), and testbuffer_list_state_random_data().
|
static |
Definition at line 135 of file BLI_array_store_test.cc.
References MEM_mallocN, and testbuffer_list_add().
Referenced by testbuffer_list_state_from_data().
Definition at line 229 of file BLI_array_store_test.cc.
References BLI_array_randomize(), and LISTBASE_FOREACH.
Referenced by plain_text_helper().
|
static |
Definition at line 254 of file BLI_array_store_test.cc.
References BLI_listbase_clear(), ListBase::first, and MEM_freeN().
Referenced by plain_text_helper(), random_chunk_mutate_helper(), random_data_mutate_helper(), and TEST().
|
static |
Definition at line 142 of file BLI_array_store_test.cc.
References testbuffer_list_add_copydata().
Referenced by testbuffer_list_state_from_data__stride_expand().
|
static |
A version of testbuffer_list_state_from_data that expand data by stride, handy so we can test data at different strides.
Definition at line 151 of file BLI_array_store_test.cc.
References MEM_mallocN, testbuffer_list_add(), and testbuffer_list_state_from_data().
Referenced by plain_text_helper().
|
static |
Definition at line 575 of file BLI_array_store_test.cc.
References _bli_array_wrap(), BLI_assert_unreachable, BLI_rng_get_char_n(), BLI_rng_get_uint(), data, TestBuffer::data, TestBuffer::data_len, ListBase::last, MEM_mallocN, MEM_reallocN, rand_range_i(), and testbuffer_list_add().
Referenced by random_data_mutate_helper().
|
static |
Definition at line 246 of file BLI_array_store_test.cc.
References BLI_array_store_state_remove(), and LISTBASE_FOREACH.
Referenced by TEST(), and testbuffer_run_tests().
|
static |
Definition at line 236 of file BLI_array_store_test.cc.
References BLI_array_store_state_add(), and ListBase::first.
Referenced by TEST(), and testbuffer_run_tests_single().
|
static |
Definition at line 218 of file BLI_array_store_test.cc.
References LISTBASE_FOREACH, and testbuffer_item_validate().
Referenced by TEST(), and testbuffer_run_tests_single().
|
static |
Definition at line 275 of file BLI_array_store_test.cc.
References BLI_listbase_reverse(), testbuffer_list_store_clear(), and testbuffer_run_tests_single().
Referenced by testbuffer_run_tests_simple().
|
static |
Definition at line 288 of file BLI_array_store_test.cc.
References BLI_array_store_create(), BLI_array_store_destroy(), and testbuffer_run_tests().
Referenced by plain_text_helper(), and random_data_mutate_helper().
|
static |
Definition at line 264 of file BLI_array_store_test.cc.
References BLI_array_store_is_valid(), testbuffer_list_store_populate(), and testbuffer_list_validate().
Referenced by random_chunk_mutate_helper(), and testbuffer_run_tests().
|
static |
Definition at line 93 of file BLI_array_store_test.cc.
References data, TestChunk::data, TestChunk::data_len, and MEM_mallocN.
Referenced by random_chunk_mutate_helper().
Definition at line 43 of file BLI_array_store_test.cc.
References BLI_addtail(), data, TestChunk::data, TestChunk::data_len, and MEM_mallocN.
Referenced by random_chunk_generate().
|
static |
Definition at line 62 of file BLI_array_store_test.cc.
References BLI_listbase_clear(), ListBase::first, and MEM_freeN().
Referenced by random_chunk_mutate_helper().