5#include "testing/testing.h"
24TEST(span, AddConstToPointer)
27 std::vector<int *> vec = {&a};
35 int array[] = {3, 5, 8};
198 std::vector<int> a = {1, 2, 3, 4};
209 std::array<int, 2> a = {5, 6};
218 std::array<int, 5> a = {4, 5, 6, 7, 8};
230 std::array<int, 5> a = {0, 0, 0, 0, 0};
242 std::array<int, 10> a{};
250 std::array<int, 4> a = {6, 7, 8, 9};
258TEST(span, FirstLast_OneElement)
269 std::array<int, 3> a = {5, 6, 7};
276 int *ptr_before =
reinterpret_cast<int *
>(
uintptr_t(a.data()) - 1);
283 std::array<int, 5> a = {4, 5, 4, 2, 5};
294 std::array<int *, 4> a = {&value,
nullptr,
nullptr,
nullptr};
302 EXPECT_EQ(new_a_span[0], (
float *)&value);
307 std::array<uint32_t, 4> a = {3, 4, 5, 6};
317 std::array<uint16_t, 4> a = {4, 5, 6, 7};
337 std::array<int, 4> src = {5, 6, 7, 8};
338 std::array<int, 4> dst = {1, 2, 3, 4};
350 std::array<int, 4> src = {4, 5, 6, 7};
354 for (
auto it = span.
rbegin(); it != span.
rend(); ++it) {
358 EXPECT_EQ_ARRAY(reversed_vec.
data(),
Span({7, 6, 5, 4}).
data(), 4);
363 std::array<int, 0> src0 = {};
368 std::array<int, 1> src1 = {4};
373 std::array<int, 2> src2 = {4, 5};
378 std::array<int, 5> src5 = {4, 5, 6, 7, 8};
384TEST(span, MutableReverseIterator)
386 std::array<int, 4> src = {4, 5, 6, 7};
390 for (
auto it = span.
rbegin(); it != span.
rend(); ++it) {
395 EXPECT_EQ_ARRAY(reversed_vec.
data(),
Span({7, 6, 5, 4}).
data(), 4);
396 EXPECT_EQ_ARRAY(src.data(),
Span({14, 15, 16, 17}).
data(), 4);
401 static constexpr std::array<int, 3> src = {3, 2, 1};
408 std::integral_constant<bool, span.
first_index(1) == 2> ic;
428 std::array<int, 3> a = {3, 4, 5};
429 std::array<int, 4>
b = {3, 4, 5, 6};
433 EXPECT_TRUE(
Span(a) ==
Span(
b).take_front(3));
439 EXPECT_FALSE(
Span(a) !=
Span(
b).take_front(3));
#define BLI_STATIC_ASSERT(a, msg)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
constexpr int64_t size() const
constexpr std::reverse_iterator< T * > rbegin() const
constexpr bool is_empty() const
constexpr MutableSpan take_back(const int64_t n) const
constexpr T * data() const
constexpr void fill(const T &value) const
constexpr MutableSpan slice_safe(const int64_t start, const int64_t size) const
constexpr MutableSpan drop_front(const int64_t n) const
constexpr void reverse() const
constexpr std::reverse_iterator< T * > rend() const
constexpr void copy_from(Span< T > values) const
constexpr void fill_indices(Span< IndexT > indices, const T &value) const
constexpr MutableSpan take_front(const int64_t n) const
constexpr Span drop_front(int64_t n) const
Span< NewT > constexpr cast() const
constexpr Span slice_safe(const int64_t start, const int64_t size) const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size_in_bytes() const
constexpr std::reverse_iterator< const T * > rend() const
constexpr std::reverse_iterator< const T * > rbegin() const
constexpr const T * data() const
constexpr Span take_back(int64_t n) const
constexpr Span drop_back(int64_t n) const
constexpr int64_t count(const T &value) const
constexpr const T & first() const
constexpr bool has_duplicates__linear_search() const
constexpr int64_t first_index(const T &search_value) const
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) const
constexpr Span take_front(int64_t n) const
constexpr bool is_empty() const
constexpr bool contains(const T &value) const
constexpr bool contains_ptr(const T *ptr) const
void append(const T &value)
local_group_size(16, 16) .push_constant(Type b
static void test_ref_from_initializer_list(Span< int > span)
TEST(any, DefaultConstructor)
_W64 unsigned int uintptr_t