7#include <gtest/gtest.h>
14 EXPECT_EQ(a.size(), b.size());
15 for (
size_t i = 0; i < a.size(); ++i) {
16 EXPECT_EQ(a[i], b[i]);
31 fData = {1, 2, 3, 4, 5, 6, 7, 8, 9};
45 EXPECT_EQ(vec.
Size(0), 2);
47 EXPECT_EQ(vec.
Size(0), 2);
48 EXPECT_EQ(vec[0].
size(), 2);
53 EXPECT_EQ(part.first.size(), vec.
Size(0));
54 EXPECT_EQ(part.second, vec.
Address(0));
56 EXPECT_EQ(vec.
Size(1), 4);
57 EXPECT_EQ(vec[1].
size(), 4);
58 EXPECT_EQ(vec.
Address(1), 0x100);
62 EXPECT_EQ(part.first.size(), vec.
Size(1));
63 EXPECT_EQ(part.second, vec.
Address(1));
65 EXPECT_EQ(vec.
Size(2), 3);
66 EXPECT_EQ(vec[2].
size(), 3);
67 EXPECT_EQ(vec.
Address(2), 0x200);
71 EXPECT_EQ(part.first.size(), vec.
Size(2));
72 EXPECT_EQ(part.second, vec.
Address(2));
115 EXPECT_THROW(
PartitionedSpan vec(fData, fOffsets, fAddressesInvalid), std::runtime_error);
120 EXPECT_THROW(
PartitionedSpan vec(fData, fOffsetsInvalid, fAddresses), std::runtime_error);
127 EXPECT_THROW(vec[3], std::out_of_range);
128 EXPECT_THROW(vec.
Partition(3), std::out_of_range);
129 EXPECT_THROW(vec.
Address(3), std::out_of_range);
130 EXPECT_THROW(vec.
Size(3), std::out_of_range);
static constexpr size_t size()
TEST_F(PartitionedSpanTest, IsDefaultConstructable)
void EXPECT_CONTAINER_EQ(gsl::span< T > a, std::vector< i32 > b)
std::vector< size_t > fSizes
std::vector< size_t > fOffsets
std::vector< size_t > fOffsetsInvalid
std::vector< u32 > fAddressesInvalid
std::vector< u32 > fAddresses
void Ensure(const PartitionedSpan< T > &vec)
std::pair< gsl::span< T >, u32 > Partition(size_t i) const
u32 Address(size_t i) const
size_t NPartitions() const
size_t Size(size_t i) const
A vector that is partitioned into multiple subvectors.