Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-06-09 11:10:56 +0300
committerJacques Lucke <jacques@blender.org>2020-06-09 11:15:43 +0300
commitd8678e02ecec9375bec1dcf1388c6fc8b4ce3ad2 (patch)
tree6e7d2a7452091877f73d413d830e6cb12e86745f /tests/gtests/blenlib/BLI_array_ref_test.cc
parent50258d55e7c1360274d40e303386cf70b16c8b2f (diff)
BLI: generally improve C++ data structures
The main focus here was to improve the docs significantly. Furthermore, I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually) faster, simpler and more customizable. I also rewrote `Stack` to make it more efficient by avoiding unnecessary copies. Thanks to everyone who helped with constructive feedback. Approved by brecht and sybren. Differential Revision: https://developer.blender.org/D7931
Diffstat (limited to 'tests/gtests/blenlib/BLI_array_ref_test.cc')
-rw-r--r--tests/gtests/blenlib/BLI_array_ref_test.cc40
1 files changed, 4 insertions, 36 deletions
diff --git a/tests/gtests/blenlib/BLI_array_ref_test.cc b/tests/gtests/blenlib/BLI_array_ref_test.cc
index 7a1f54e7458..48137f32197 100644
--- a/tests/gtests/blenlib/BLI_array_ref_test.cc
+++ b/tests/gtests/blenlib/BLI_array_ref_test.cc
@@ -1,4 +1,5 @@
#include "BLI_array_ref.hh"
+#include "BLI_strict_flags.h"
#include "BLI_vector.hh"
#include "testing/testing.h"
@@ -136,14 +137,6 @@ TEST(array_ref, Count)
EXPECT_EQ(a_ref.count(5), 0);
}
-TEST(array_ref, ToSmallVector)
-{
- IntVector a = {1, 2, 3, 4};
- IntArrayRef a_ref = a;
- IntVector b = a_ref;
- IntVector::all_equal(a, b);
-}
-
static void test_ref_from_initializer_list(IntArrayRef ref)
{
EXPECT_EQ(ref.size(), 4);
@@ -202,37 +195,12 @@ TEST(array_ref, FillIndices)
EXPECT_EQ(a[4], 0);
}
-TEST(array_ref, CopyFrom)
-{
- std::array<int, 3> a = {3, 4, 5};
- MutableIntArrayRef a_ref(a);
- EXPECT_EQ(a[0], 3);
- EXPECT_EQ(a[1], 4);
- EXPECT_EQ(a[2], 5);
- a_ref.copy_from({1, 2, 3});
- EXPECT_EQ(a[0], 1);
- EXPECT_EQ(a[1], 2);
- EXPECT_EQ(a[2], 3);
-}
-
-TEST(array_ref, ByteSize)
+TEST(array_ref, SizeInBytes)
{
std::array<int, 10> a;
IntArrayRef a_ref(a);
- EXPECT_EQ(a_ref.byte_size(), sizeof(a));
- EXPECT_EQ(a_ref.byte_size(), 40);
-}
-
-TEST(array_ref, CopyTo)
-{
- std::array<int, 3> a = {5, 6, 7};
- int b[3] = {0};
- IntArrayRef a_ref(a);
- a_ref.copy_to(b);
-
- EXPECT_EQ(b[0], 5);
- EXPECT_EQ(b[1], 6);
- EXPECT_EQ(b[2], 7);
+ EXPECT_EQ(a_ref.size_in_bytes(), sizeof(a));
+ EXPECT_EQ(a_ref.size_in_bytes(), 40);
}
TEST(array_ref, FirstLast)