6 #include "testing/testing.h"
10 TEST(span, FromSmallVector)
20 TEST(span, AddConstToPointer)
23 std::vector<int *> vec = {&
a};
31 int array[] = {3, 5, 8};
65 TEST(span, DropFrontLargeN)
90 TEST(span, TakeFrontLargeN)
187 TEST(span, FromInitializerList)
194 std::vector<int>
a = {1, 2, 3, 4};
205 std::array<int, 2>
a = {5, 6};
214 std::array<int, 5>
a = {4, 5, 6, 7, 8};
226 std::array<int, 5>
a = {0, 0, 0, 0, 0};
238 std::array<int, 10>
a{};
246 std::array<int, 4>
a = {6, 7, 8, 9};
254 TEST(span, FirstLast_OneElement)
265 std::array<int, 3>
a = {5, 6, 7};
276 std::array<int, 3>
a = {5, 6, 7};
283 int *ptr_before =
reinterpret_cast<int *
>(
reinterpret_cast<uintptr_t>(
a.data()) - 1);
290 std::array<int, 5>
a = {4, 5, 4, 2, 5};
301 std::array<int *, 4>
a = {&value,
nullptr,
nullptr,
nullptr};
309 EXPECT_EQ(new_a_span[0], (
float *)&value);
314 std::array<uint32_t, 4>
a = {3, 4, 5, 6};
324 std::array<uint16_t, 4>
a = {4, 5, 6, 7};
344 std::array<int, 4>
src = {5, 6, 7, 8};
345 std::array<int, 4> dst = {1, 2, 3, 4};
357 std::array<int, 4>
src = {4, 5, 6, 7};
361 for (
auto it = span.
rbegin(); it != span.
rend(); ++it) {
365 EXPECT_EQ_ARRAY(reversed_vec.
data(),
Span({7, 6, 5, 4}).
data(), 4);
370 std::array<int, 0> src0 = {};
375 std::array<int, 1> src1 = {4};
380 std::array<int, 2> src2 = {4, 5};
385 std::array<int, 5> src5 = {4, 5, 6, 7, 8};
391 TEST(span, MutableReverseIterator)
393 std::array<int, 4>
src = {4, 5, 6, 7};
397 for (
auto it = span.
rbegin(); it != span.
rend(); ++it) {
402 EXPECT_EQ_ARRAY(reversed_vec.
data(),
Span({7, 6, 5, 4}).
data(), 4);
403 EXPECT_EQ_ARRAY(
src.data(),
Span({14, 15, 16, 17}).
data(), 4);
408 static constexpr std::array<int, 3>
src = {3, 2, 1};
415 std::integral_constant<
bool, span.first_index(1) == 2> ic;
421 TEST(span, ImplicitConversions)
435 std::array<int, 3>
a = {3, 4, 5};
436 std::array<int, 4>
b = {3, 4, 5, 6};
440 EXPECT_TRUE(
Span(
a) ==
Span(
b).take_front(3));
446 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)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
constexpr int64_t size() const
constexpr void fill(const T &value)
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr bool is_empty() const
constexpr MutableSpan take_back(const int64_t n) const
constexpr MutableSpan drop_front(const int64_t n) const
constexpr void fill_indices(Span< int64_t > indices, const T &value)
constexpr void copy_from(Span< T > values)
constexpr std::reverse_iterator< T * > rend() const
constexpr std::reverse_iterator< T * > rbegin() const
constexpr T * data() const
constexpr MutableSpan take_front(const int64_t n) const
constexpr std::reverse_iterator< const T * > rend() const
constexpr Span drop_front(int64_t n) const
constexpr std::reverse_iterator< const T * > rbegin() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size_in_bytes() const
constexpr Span take_back(int64_t n) const
constexpr const T * data() const
constexpr Span drop_back(int64_t n) const
constexpr T get(int64_t index, const T &fallback) const
constexpr int64_t count(const T &value) const
constexpr const T & first() const
constexpr const T & last(const int64_t n=0) const
constexpr int64_t first_index(const T &search_value) const
constexpr int64_t size() const
constexpr Span< NewT > cast() 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)
SyclQueue void void * src
static void test_ref_from_initializer_list(Span< int > span)
TEST(any, DefaultConstructor)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
_W64 unsigned int uintptr_t