Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Jul 4, 2024
1 parent 900a2a9 commit b69a4ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ __host__ __device__ constexpr void test()
assert(!size_value_grow.empty());
assert(cuda::std::equal(size_value_grow.begin(), size_value_grow.end(), expected.begin(), expected.end()));
}

{
using iter = cpp17_input_iterator<const T*>;
const cuda::std::array<T, 0> expected = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ __host__ __device__ constexpr void test_copy_move()
cuda::std::inplace_vector<T, 0> no_capacity_move(cuda::std::move(input));
assert(no_capacity_move.empty());
}

{
cuda::std::inplace_vector<T, 42> input{};
cuda::std::inplace_vector<T, 42> with_capacity_empty_copy(input);
Expand All @@ -73,6 +74,7 @@ __host__ __device__ constexpr void test_copy_move()
cuda::std::inplace_vector<T, 42> with_capacity_empty_move(cuda::std::move(input));
assert(with_capacity_empty_move.empty());
}

{
cuda::std::inplace_vector<T, 42> input{T(1), T(42), T(1337), T(0)};
cuda::std::inplace_vector<T, 42> with_capacity_copy(input);
Expand Down Expand Up @@ -150,28 +152,33 @@ __host__ __device__ constexpr void test_iter()
cuda::std::inplace_vector<T, 0> from_input_iter_no_capacity(iter{input}, iter{input});
assert(from_input_iter_no_capacity.empty());
}

{
using iter = forward_iterator<const T*>;
cuda::std::inplace_vector<T, 0> from_forward_iter_no_capacity(iter{input}, iter{input});
assert(from_forward_iter_no_capacity.empty());
}

{
using iter = cpp17_input_iterator<const T*>;
cuda::std::inplace_vector<T, 42> from_input_iter_empty(iter{input}, iter{input});
assert(from_input_iter_empty.empty());
}

{
using iter = forward_iterator<const T*>;
cuda::std::inplace_vector<T, 42> from_forward_iter_empty(iter{input}, iter{input});
assert(from_forward_iter_empty.empty());
}

{
using iter = cpp17_input_iterator<const T*>;
cuda::std::inplace_vector<T, 42> from_input_iter_non_empty(iter{input}, iter{input + 3});
assert(!from_input_iter_non_empty.empty());
assert(from_input_iter_non_empty.size() == 3);
assert(cuda::std::equal(from_input_iter_non_empty.begin(), from_input_iter_non_empty.end(), input, input + 3));
}

{
using iter = forward_iterator<const T*>;
cuda::std::inplace_vector<T, 42> from_forward_iter_non_empty(iter{input}, iter{input + 3});
Expand All @@ -189,11 +196,13 @@ __host__ __device__ constexpr void test_init_list()
cuda::std::inplace_vector<T, 0> no_capacity(input);
assert(no_capacity.empty());
}

{
cuda::std::initializer_list<T> input{};
cuda::std::inplace_vector<T, 42> from_empty(input);
assert(from_empty.empty());
}

{
cuda::std::initializer_list<T> input{T(1), T(42), T(1337), T(0)};
cuda::std::inplace_vector<T, 42> from_non_empty(input);
Expand All @@ -211,10 +220,12 @@ __host__ __device__ constexpr void test_range()
cuda::std::inplace_vector<T, 0> no_capacity(Range<T, 0>{});
assert(no_capacity.empty());
}

{
cuda::std::inplace_vector<T, 42> from_empty(Range<T, 0>{});
assert(from_empty.empty());
}

{
const cuda::std::array<T, 4> expected{T(1), T(42), T(1337), T(0)};
cuda::std::inplace_vector<T, 42> from_non_empty(Range<T, 4>{T(1), T(42), T(1337), T(0)});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ __host__ __device__ constexpr void test()
shrink_to_fit.shrink_to_fit();
assert(cuda::std::equal(shrink_to_fit.begin(), shrink_to_fit.end(), expected.begin(), expected.end()));
}

{
cuda::std::initializer_list<T> expected{T(1), T(1337), T(1), T(12), T(0), T(-1)};
vec reserve{T(1), T(1337), T(1), T(12), T(0), T(-1)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ __host__ __device__ constexpr void test()
assert(cuda::std::equal(left.begin(), left.end(), expected_left.begin(), expected_left.end()));
assert(cuda::std::equal(right.begin(), right.end(), expected_right.begin(), expected_right.end()));
}

{
using vec = cuda::std::inplace_vector<T, 0>;
vec empty{};
Expand Down

0 comments on commit b69a4ac

Please sign in to comment.