diff options
Diffstat (limited to 'tests/gtests/blenlib/BLI_span_test.cc')
-rw-r--r-- | tests/gtests/blenlib/BLI_span_test.cc | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/gtests/blenlib/BLI_span_test.cc b/tests/gtests/blenlib/BLI_span_test.cc index 32a6b978328..b122e8efdb4 100644 --- a/tests/gtests/blenlib/BLI_span_test.cc +++ b/tests/gtests/blenlib/BLI_span_test.cc @@ -5,7 +5,7 @@ using namespace blender; -TEST(array_ref, FromSmallVector) +TEST(span, FromSmallVector) { Vector<int> a = {1, 2, 3}; Span<int> a_span = a; @@ -15,7 +15,7 @@ TEST(array_ref, FromSmallVector) EXPECT_EQ(a_span[2], 3); } -TEST(array_ref, AddConstToPointer) +TEST(span, AddConstToPointer) { int a = 0; std::vector<int *> vec = {&a}; @@ -24,7 +24,7 @@ TEST(array_ref, AddConstToPointer) EXPECT_EQ(const_span.size(), 1); } -TEST(array_ref, IsReferencing) +TEST(span, IsReferencing) { int array[] = {3, 5, 8}; MutableSpan<int> span(array, ARRAY_SIZE(array)); @@ -34,7 +34,7 @@ TEST(array_ref, IsReferencing) EXPECT_EQ(span[1], 10); } -TEST(array_ref, DropBack) +TEST(span, DropBack) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).drop_back(2); @@ -43,14 +43,14 @@ TEST(array_ref, DropBack) EXPECT_EQ(slice[1], 5); } -TEST(array_ref, DropBackAll) +TEST(span, DropBackAll) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).drop_back(a.size()); EXPECT_EQ(slice.size(), 0); } -TEST(array_ref, DropFront) +TEST(span, DropFront) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).drop_front(1); @@ -60,14 +60,14 @@ TEST(array_ref, DropFront) EXPECT_EQ(slice[2], 7); } -TEST(array_ref, DropFrontAll) +TEST(span, DropFrontAll) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).drop_front(a.size()); EXPECT_EQ(slice.size(), 0); } -TEST(array_ref, TakeFront) +TEST(span, TakeFront) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).take_front(2); @@ -76,7 +76,7 @@ TEST(array_ref, TakeFront) EXPECT_EQ(slice[1], 5); } -TEST(array_ref, TakeBack) +TEST(span, TakeBack) { Vector<int> a = {5, 6, 7, 8}; auto slice = Span<int>(a).take_back(2); @@ -85,7 +85,7 @@ TEST(array_ref, TakeBack) EXPECT_EQ(slice[1], 8); } -TEST(array_ref, Slice) +TEST(span, Slice) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).slice(1, 2); @@ -94,14 +94,14 @@ TEST(array_ref, Slice) EXPECT_EQ(slice[1], 6); } -TEST(array_ref, SliceEmpty) +TEST(span, SliceEmpty) { Vector<int> a = {4, 5, 6, 7}; auto slice = Span<int>(a).slice(2, 0); EXPECT_EQ(slice.size(), 0); } -TEST(array_ref, SliceRange) +TEST(span, SliceRange) { Vector<int> a = {1, 2, 3, 4, 5}; auto slice = Span<int>(a).slice(IndexRange(2, 2)); @@ -110,7 +110,7 @@ TEST(array_ref, SliceRange) EXPECT_EQ(slice[1], 4); } -TEST(array_ref, Contains) +TEST(span, Contains) { Vector<int> a = {4, 5, 6, 7}; Span<int> a_span = a; @@ -122,7 +122,7 @@ TEST(array_ref, Contains) EXPECT_FALSE(a_span.contains(8)); } -TEST(array_ref, Count) +TEST(span, Count) { Vector<int> a = {2, 3, 4, 3, 3, 2, 2, 2, 2}; Span<int> a_span = a; @@ -142,12 +142,12 @@ static void test_ref_from_initializer_list(Span<int> span) EXPECT_EQ(span[3], 9); } -TEST(array_ref, FromInitializerList) +TEST(span, FromInitializerList) { test_ref_from_initializer_list({3, 6, 8, 9}); } -TEST(array_ref, FromVector) +TEST(span, FromVector) { std::vector<int> a = {1, 2, 3, 4}; Span<int> a_span(a); @@ -158,7 +158,7 @@ TEST(array_ref, FromVector) EXPECT_EQ(a_span[3], 4); } -TEST(array_ref, FromArray) +TEST(span, FromArray) { std::array<int, 2> a = {5, 6}; Span<int> a_span(a); @@ -167,7 +167,7 @@ TEST(array_ref, FromArray) EXPECT_EQ(a_span[1], 6); } -TEST(array_ref, Fill) +TEST(span, Fill) { std::array<int, 5> a = {4, 5, 6, 7, 8}; MutableSpan<int> a_span(a); @@ -179,7 +179,7 @@ TEST(array_ref, Fill) EXPECT_EQ(a[4], 1); } -TEST(array_ref, FillIndices) +TEST(span, FillIndices) { std::array<int, 5> a = {0, 0, 0, 0, 0}; MutableSpan<int> a_span(a); @@ -191,7 +191,7 @@ TEST(array_ref, FillIndices) EXPECT_EQ(a[4], 0); } -TEST(array_ref, SizeInBytes) +TEST(span, SizeInBytes) { std::array<int, 10> a; Span<int> a_span(a); @@ -199,7 +199,7 @@ TEST(array_ref, SizeInBytes) EXPECT_EQ(a_span.size_in_bytes(), 40); } -TEST(array_ref, FirstLast) +TEST(span, FirstLast) { std::array<int, 4> a = {6, 7, 8, 9}; Span<int> a_span(a); @@ -207,7 +207,7 @@ TEST(array_ref, FirstLast) EXPECT_EQ(a_span.last(), 9); } -TEST(array_ref, FirstLast_OneElement) +TEST(span, FirstLast_OneElement) { int a = 3; Span<int> a_span(&a, 1); @@ -215,7 +215,7 @@ TEST(array_ref, FirstLast_OneElement) EXPECT_EQ(a_span.last(), 3); } -TEST(array_ref, Get) +TEST(span, Get) { std::array<int, 3> a = {5, 6, 7}; Span<int> a_span(a); @@ -226,7 +226,7 @@ TEST(array_ref, Get) EXPECT_EQ(a_span.get(4, 42), 42); } -TEST(array_ref, ContainsPtr) +TEST(span, ContainsPtr) { std::array<int, 3> a = {5, 6, 7}; int other = 10; @@ -239,7 +239,7 @@ TEST(array_ref, ContainsPtr) EXPECT_FALSE(a_span.contains_ptr(&other)); } -TEST(array_ref, FirstIndex) +TEST(span, FirstIndex) { std::array<int, 5> a = {4, 5, 4, 2, 5}; Span<int> a_span(a); @@ -249,7 +249,7 @@ TEST(array_ref, FirstIndex) EXPECT_EQ(a_span.first_index(2), 3); } -TEST(array_ref, CastSameSize) +TEST(span, CastSameSize) { int value = 0; std::array<int *, 4> a = {&value, nullptr, nullptr, nullptr}; @@ -263,7 +263,7 @@ TEST(array_ref, CastSameSize) EXPECT_EQ(new_a_span[0], (float *)&value); } -TEST(array_ref, CastSmallerSize) +TEST(span, CastSmallerSize) { std::array<uint32_t, 4> a = {3, 4, 5, 6}; Span<uint32_t> a_span = a; @@ -273,7 +273,7 @@ TEST(array_ref, CastSmallerSize) EXPECT_EQ(new_a_span.size(), 8); } -TEST(array_ref, CastLargerSize) +TEST(span, CastLargerSize) { std::array<uint16_t, 4> a = {4, 5, 6, 7}; Span<uint16_t> a_span = a; |