diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-09 11:27:24 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-09 11:27:24 +0300 |
commit | 9bb7d6ed68ef1aa0e6acc3e70901cb6b79c682d2 (patch) | |
tree | 843993222b8ee5c02451207404ceb113323ede6f /tests | |
parent | d8678e02ecec9375bec1dcf1388c6fc8b4ce3ad2 (diff) |
BLI: put C++ data structures in "blender" namespace instead of "BLI"
We plan to use the "blender" namespace in other modules as well.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gtests/blenlib/BLI_array_ref_test.cc | 8 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_array_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_index_mask_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_index_range_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_linear_allocator_test.cc | 6 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_map_test.cc | 54 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_optional_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_set_test.cc | 50 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_stack_cxx_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_string_ref_test.cc | 6 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_vector_set_test.cc | 2 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_vector_test.cc | 2 |
12 files changed, 69 insertions, 69 deletions
diff --git a/tests/gtests/blenlib/BLI_array_ref_test.cc b/tests/gtests/blenlib/BLI_array_ref_test.cc index 48137f32197..431e2d517f8 100644 --- a/tests/gtests/blenlib/BLI_array_ref_test.cc +++ b/tests/gtests/blenlib/BLI_array_ref_test.cc @@ -3,11 +3,11 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; -using IntVector = BLI::Vector<int>; -using IntArrayRef = BLI::ArrayRef<int>; -using MutableIntArrayRef = BLI::MutableArrayRef<int>; +using IntVector = blender::Vector<int>; +using IntArrayRef = blender::ArrayRef<int>; +using MutableIntArrayRef = blender::MutableArrayRef<int>; TEST(array_ref, FromSmallVector) { diff --git a/tests/gtests/blenlib/BLI_array_test.cc b/tests/gtests/blenlib/BLI_array_test.cc index 66f69f5c309..398acfef866 100644 --- a/tests/gtests/blenlib/BLI_array_test.cc +++ b/tests/gtests/blenlib/BLI_array_test.cc @@ -2,7 +2,7 @@ #include "BLI_strict_flags.h" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(array, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_index_mask_test.cc b/tests/gtests/blenlib/BLI_index_mask_test.cc index 057aed091a1..87e936a76ea 100644 --- a/tests/gtests/blenlib/BLI_index_mask_test.cc +++ b/tests/gtests/blenlib/BLI_index_mask_test.cc @@ -1,7 +1,7 @@ #include "BLI_index_mask.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(index_mask, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_index_range_test.cc b/tests/gtests/blenlib/BLI_index_range_test.cc index 8ee0f485ffe..578b37c5a27 100644 --- a/tests/gtests/blenlib/BLI_index_range_test.cc +++ b/tests/gtests/blenlib/BLI_index_range_test.cc @@ -3,7 +3,7 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(index_range, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_linear_allocator_test.cc b/tests/gtests/blenlib/BLI_linear_allocator_test.cc index 6cac60dea3b..33ca8c5e2b3 100644 --- a/tests/gtests/blenlib/BLI_linear_allocator_test.cc +++ b/tests/gtests/blenlib/BLI_linear_allocator_test.cc @@ -2,7 +2,7 @@ #include "BLI_strict_flags.h" #include "testing/testing.h" -using namespace BLI; +using namespace blender; static bool is_aligned(void *ptr, uint alignment) { @@ -30,7 +30,7 @@ TEST(linear_allocator, AllocationAlignment) TEST(linear_allocator, PackedAllocation) { LinearAllocator<> allocator; - BLI::AlignedBuffer<256, 32> buffer; + blender::AlignedBuffer<256, 32> buffer; allocator.provide_buffer(buffer); uintptr_t ptr1 = (uintptr_t)allocator.allocate(10, 4); /* 0 - 10 */ @@ -52,7 +52,7 @@ TEST(linear_allocator, PackedAllocation) TEST(linear_allocator, CopyString) { LinearAllocator<> allocator; - BLI::AlignedBuffer<256, 1> buffer; + blender::AlignedBuffer<256, 1> buffer; allocator.provide_buffer(buffer); StringRefNull ref1 = allocator.copy_string("Hello"); diff --git a/tests/gtests/blenlib/BLI_map_test.cc b/tests/gtests/blenlib/BLI_map_test.cc index 990683dcfc5..ec4cbb9e53e 100644 --- a/tests/gtests/blenlib/BLI_map_test.cc +++ b/tests/gtests/blenlib/BLI_map_test.cc @@ -6,7 +6,7 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(map, DefaultConstructor) { @@ -103,7 +103,7 @@ TEST(map, ValueIterator) map.add(1, 2.0f); map.add(7, -2.0f); - BLI::Set<float> values; + blender::Set<float> values; uint iterations = 0; for (float value : map.values()) { @@ -124,7 +124,7 @@ TEST(map, KeyIterator) map.add(2, 4.0f); map.add(1, 3.0f); - BLI::Set<int> keys; + blender::Set<int> keys; uint iterations = 0; for (int key : map.keys()) { @@ -145,8 +145,8 @@ TEST(map, ItemIterator) map.add(2, 9.0f); map.add(1, 0.0f); - BLI::Set<int> keys; - BLI::Set<float> values; + blender::Set<int> keys; + blender::Set<float> values; uint iterations = 0; for (auto item : map.items()) { @@ -423,63 +423,63 @@ BLI_NOINLINE void benchmark_random_ints(StringRef name, uint amount, uint factor TEST(map, Benchmark) { for (uint i = 0; i < 3; i++) { - benchmark_random_ints<BLI::Map<int, int>>("BLI::Map ", 1000000, 1); - benchmark_random_ints<BLI::StdUnorderedMapWrapper<int, int>>("std::unordered_map", 1000000, 1); + benchmark_random_ints<blender::Map<int, int>>("blender::Map ", 1000000, 1); + benchmark_random_ints<blender::StdUnorderedMapWrapper<int, int>>("std::unordered_map", 1000000, 1); } std::cout << "\n"; for (uint i = 0; i < 3; i++) { uint32_t factor = (3 << 10); - benchmark_random_ints<BLI::Map<int, int>>("BLI::Map ", 1000000, factor); - benchmark_random_ints<BLI::StdUnorderedMapWrapper<int, int>>( + benchmark_random_ints<blender::Map<int, int>>("blender::Map ", 1000000, factor); + benchmark_random_ints<blender::StdUnorderedMapWrapper<int, int>>( "std::unordered_map", 1000000, factor); } } /** - * Timer 'BLI::Map Add' took 61.7616 ms - * Timer 'BLI::Map Contains' took 18.4989 ms - * Timer 'BLI::Map Remove' took 20.5864 ms + * Timer 'blender::Map Add' took 61.7616 ms + * Timer 'blender::Map Contains' took 18.4989 ms + * Timer 'blender::Map Remove' took 20.5864 ms * Count: 1999755 * Timer 'std::unordered_map Add' took 188.674 ms * Timer 'std::unordered_map Contains' took 44.3741 ms * Timer 'std::unordered_map Remove' took 169.52 ms * Count: 1999755 - * Timer 'BLI::Map Add' took 37.9196 ms - * Timer 'BLI::Map Contains' took 16.7361 ms - * Timer 'BLI::Map Remove' took 20.9568 ms + * Timer 'blender::Map Add' took 37.9196 ms + * Timer 'blender::Map Contains' took 16.7361 ms + * Timer 'blender::Map Remove' took 20.9568 ms * Count: 1999755 * Timer 'std::unordered_map Add' took 166.09 ms * Timer 'std::unordered_map Contains' took 40.6133 ms * Timer 'std::unordered_map Remove' took 142.85 ms * Count: 1999755 - * Timer 'BLI::Map Add' took 37.3053 ms - * Timer 'BLI::Map Contains' took 16.6731 ms - * Timer 'BLI::Map Remove' took 18.8304 ms + * Timer 'blender::Map Add' took 37.3053 ms + * Timer 'blender::Map Contains' took 16.6731 ms + * Timer 'blender::Map Remove' took 18.8304 ms * Count: 1999755 * Timer 'std::unordered_map Add' took 170.964 ms * Timer 'std::unordered_map Contains' took 38.1824 ms * Timer 'std::unordered_map Remove' took 140.263 ms * Count: 1999755 * - * Timer 'BLI::Map Add' took 50.1131 ms - * Timer 'BLI::Map Contains' took 25.0491 ms - * Timer 'BLI::Map Remove' took 32.4225 ms + * Timer 'blender::Map Add' took 50.1131 ms + * Timer 'blender::Map Contains' took 25.0491 ms + * Timer 'blender::Map Remove' took 32.4225 ms * Count: 1889920 * Timer 'std::unordered_map Add' took 150.129 ms * Timer 'std::unordered_map Contains' took 34.6999 ms * Timer 'std::unordered_map Remove' took 120.907 ms * Count: 1889920 - * Timer 'BLI::Map Add' took 50.4438 ms - * Timer 'BLI::Map Contains' took 25.2677 ms - * Timer 'BLI::Map Remove' took 32.3047 ms + * Timer 'blender::Map Add' took 50.4438 ms + * Timer 'blender::Map Contains' took 25.2677 ms + * Timer 'blender::Map Remove' took 32.3047 ms * Count: 1889920 * Timer 'std::unordered_map Add' took 144.015 ms * Timer 'std::unordered_map Contains' took 36.3387 ms * Timer 'std::unordered_map Remove' took 119.109 ms * Count: 1889920 - * Timer 'BLI::Map Add' took 48.6995 ms - * Timer 'BLI::Map Contains' took 25.1846 ms - * Timer 'BLI::Map Remove' took 33.0283 ms + * Timer 'blender::Map Add' took 48.6995 ms + * Timer 'blender::Map Contains' took 25.1846 ms + * Timer 'blender::Map Remove' took 33.0283 ms * Count: 1889920 * Timer 'std::unordered_map Add' took 143.494 ms * Timer 'std::unordered_map Contains' took 34.8905 ms diff --git a/tests/gtests/blenlib/BLI_optional_test.cc b/tests/gtests/blenlib/BLI_optional_test.cc index 8d8be9a3a31..2fc2188563e 100644 --- a/tests/gtests/blenlib/BLI_optional_test.cc +++ b/tests/gtests/blenlib/BLI_optional_test.cc @@ -3,7 +3,7 @@ #include "testing/testing.h" #include <string> -using namespace BLI; +using namespace blender; TEST(optional, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_set_test.cc b/tests/gtests/blenlib/BLI_set_test.cc index 1f480f1d3b8..8e77a446a97 100644 --- a/tests/gtests/blenlib/BLI_set_test.cc +++ b/tests/gtests/blenlib/BLI_set_test.cc @@ -9,7 +9,7 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(set, DefaultConstructor) { @@ -191,7 +191,7 @@ TEST(set, AddMultipleNew) TEST(set, Iterator) { Set<int> set = {1, 3, 2, 5, 4}; - BLI::Vector<int> vec; + blender::Vector<int> vec; for (int value : set) { vec.append(value); } @@ -290,7 +290,7 @@ bool operator==(const Type2 &a, const Type1 &b) return a.value == b.value; } -template<> struct BLI::DefaultHash<Type1> { +template<> struct blender::DefaultHash<Type1> { uint32_t operator()(const Type1 &value) const { return value.value; @@ -445,64 +445,64 @@ BLI_NOINLINE void benchmark_random_ints(StringRef name, uint amount, uint factor TEST(set, Benchmark) { for (uint i = 0; i < 3; i++) { - benchmark_random_ints<BLI::Set<int>>("BLI::Set ", 100000, 1); - benchmark_random_ints<BLI::StdUnorderedSetWrapper<int>>("std::unordered_set", 100000, 1); + benchmark_random_ints<blender::Set<int>>("blender::Set ", 100000, 1); + benchmark_random_ints<blender::StdUnorderedSetWrapper<int>>("std::unordered_set", 100000, 1); } std::cout << "\n"; for (uint i = 0; i < 3; i++) { uint32_t factor = (3 << 10); - benchmark_random_ints<BLI::Set<int>>("BLI::Set ", 100000, factor); - benchmark_random_ints<BLI::StdUnorderedSetWrapper<int>>("std::unordered_set", 100000, factor); + benchmark_random_ints<blender::Set<int>>("blender::Set ", 100000, factor); + benchmark_random_ints<blender::StdUnorderedSetWrapper<int>>("std::unordered_set", 100000, factor); } } /** * Output of the rudimentary benchmark above on my hardware. * - * Timer 'BLI::Set Add' took 5.5573 ms - * Timer 'BLI::Set Contains' took 0.807384 ms - * Timer 'BLI::Set Remove' took 0.953436 ms + * Timer 'blender::Set Add' took 5.5573 ms + * Timer 'blender::Set Contains' took 0.807384 ms + * Timer 'blender::Set Remove' took 0.953436 ms * Count: 199998 * Timer 'std::unordered_set Add' took 12.551 ms * Timer 'std::unordered_set Contains' took 2.3323 ms * Timer 'std::unordered_set Remove' took 5.07082 ms * Count: 199998 - * Timer 'BLI::Set Add' took 2.62526 ms - * Timer 'BLI::Set Contains' took 0.407499 ms - * Timer 'BLI::Set Remove' took 0.472981 ms + * Timer 'blender::Set Add' took 2.62526 ms + * Timer 'blender::Set Contains' took 0.407499 ms + * Timer 'blender::Set Remove' took 0.472981 ms * Count: 199998 * Timer 'std::unordered_set Add' took 6.26945 ms * Timer 'std::unordered_set Contains' took 1.17236 ms * Timer 'std::unordered_set Remove' took 3.77402 ms * Count: 199998 - * Timer 'BLI::Set Add' took 2.59152 ms - * Timer 'BLI::Set Contains' took 0.415254 ms - * Timer 'BLI::Set Remove' took 0.477559 ms + * Timer 'blender::Set Add' took 2.59152 ms + * Timer 'blender::Set Contains' took 0.415254 ms + * Timer 'blender::Set Remove' took 0.477559 ms * Count: 199998 * Timer 'std::unordered_set Add' took 6.28129 ms * Timer 'std::unordered_set Contains' took 1.17562 ms * Timer 'std::unordered_set Remove' took 3.77811 ms * Count: 199998 * - * Timer 'BLI::Set Add' took 3.16514 ms - * Timer 'BLI::Set Contains' took 0.732895 ms - * Timer 'BLI::Set Remove' took 1.08171 ms + * Timer 'blender::Set Add' took 3.16514 ms + * Timer 'blender::Set Contains' took 0.732895 ms + * Timer 'blender::Set Remove' took 1.08171 ms * Count: 198790 * Timer 'std::unordered_set Add' took 6.57377 ms * Timer 'std::unordered_set Contains' took 1.17008 ms * Timer 'std::unordered_set Remove' took 3.7946 ms * Count: 198790 - * Timer 'BLI::Set Add' took 3.11439 ms - * Timer 'BLI::Set Contains' took 0.740159 ms - * Timer 'BLI::Set Remove' took 1.06749 ms + * Timer 'blender::Set Add' took 3.11439 ms + * Timer 'blender::Set Contains' took 0.740159 ms + * Timer 'blender::Set Remove' took 1.06749 ms * Count: 198790 * Timer 'std::unordered_set Add' took 6.35597 ms * Timer 'std::unordered_set Contains' took 1.17713 ms * Timer 'std::unordered_set Remove' took 3.77826 ms * Count: 198790 - * Timer 'BLI::Set Add' took 3.09876 ms - * Timer 'BLI::Set Contains' took 0.742072 ms - * Timer 'BLI::Set Remove' took 1.06622 ms + * Timer 'blender::Set Add' took 3.09876 ms + * Timer 'blender::Set Contains' took 0.742072 ms + * Timer 'blender::Set Remove' took 1.06622 ms * Count: 198790 * Timer 'std::unordered_set Add' took 6.4469 ms * Timer 'std::unordered_set Contains' took 1.16515 ms diff --git a/tests/gtests/blenlib/BLI_stack_cxx_test.cc b/tests/gtests/blenlib/BLI_stack_cxx_test.cc index 28d30f0ecfb..87d545a00ff 100644 --- a/tests/gtests/blenlib/BLI_stack_cxx_test.cc +++ b/tests/gtests/blenlib/BLI_stack_cxx_test.cc @@ -3,7 +3,7 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using namespace BLI; +using namespace blender; TEST(stack, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_string_ref_test.cc b/tests/gtests/blenlib/BLI_string_ref_test.cc index 6f15de282f6..6823a79da06 100644 --- a/tests/gtests/blenlib/BLI_string_ref_test.cc +++ b/tests/gtests/blenlib/BLI_string_ref_test.cc @@ -3,9 +3,9 @@ #include "BLI_vector.hh" #include "testing/testing.h" -using BLI::StringRef; -using BLI::StringRefNull; -using BLI::Vector; +using blender::StringRef; +using blender::StringRefNull; +using blender::Vector; TEST(string_ref_null, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_vector_set_test.cc b/tests/gtests/blenlib/BLI_vector_set_test.cc index 87162c9920a..1f8a830d134 100644 --- a/tests/gtests/blenlib/BLI_vector_set_test.cc +++ b/tests/gtests/blenlib/BLI_vector_set_test.cc @@ -2,7 +2,7 @@ #include "BLI_vector_set.hh" #include "testing/testing.h" -using BLI::VectorSet; +using blender::VectorSet; TEST(vector_set, DefaultConstructor) { diff --git a/tests/gtests/blenlib/BLI_vector_test.cc b/tests/gtests/blenlib/BLI_vector_test.cc index 7d16ef9e54d..2641c6ffb9a 100644 --- a/tests/gtests/blenlib/BLI_vector_test.cc +++ b/tests/gtests/blenlib/BLI_vector_test.cc @@ -3,7 +3,7 @@ #include "testing/testing.h" #include <forward_list> -using namespace BLI; +using namespace blender; TEST(vector, DefaultConstructor) { |