Skip to content

Commit

Permalink
everything in its right place
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Jan 30, 2025
1 parent e1515cf commit 56fa95a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
18 changes: 6 additions & 12 deletions cudax/test/containers/uninitialized_async_buffer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,6 @@ TEMPLATE_TEST_CASE(
cuda::experimental::device_memory_resource resource{};
cuda::experimental::stream stream{};

if (false)
{
uninitialized_async_buffer buf{resource, stream, 42};
uninitialized_async_buffer const& cbuf = buf;
static_assert(cuda::std::is_same<decltype(buf.begin()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.begin()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.end()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.end()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.data()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.data()), TestType const*>::value, "");
}

SECTION("construction")
{
{
Expand Down Expand Up @@ -149,6 +137,9 @@ TEMPLATE_TEST_CASE(
SECTION("access")
{
uninitialized_async_buffer buf{resource, stream, 42};
static_assert(cuda::std::is_same<decltype(buf.begin()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.end()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.data()), TestType*>::value, "");
CUDAX_CHECK(buf.data() != nullptr);
CUDAX_CHECK(buf.size() == 42);
CUDAX_CHECK(buf.size_bytes() == 42 * sizeof(TestType));
Expand All @@ -157,6 +148,9 @@ TEMPLATE_TEST_CASE(
CUDAX_CHECK(buf.get_stream() == stream);
CUDAX_CHECK(buf.get_memory_resource() == resource);

static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).begin()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).end()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).data()), TestType const*>::value, "");
CUDAX_CHECK(cuda::std::as_const(buf).data() != nullptr);
CUDAX_CHECK(cuda::std::as_const(buf).size() == 42);
CUDAX_CHECK(cuda::std::as_const(buf).size_bytes() == 42 * sizeof(TestType));
Expand Down
18 changes: 6 additions & 12 deletions cudax/test/containers/uninitialized_buffer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,6 @@ TEMPLATE_TEST_CASE(

cudax::device_memory_resource resource{};

if (false)
{
uninitialized_buffer buf{resource, 42};
uninitialized_buffer const& cbuf = buf;
static_assert(cuda::std::is_same<decltype(buf.begin()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.begin()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.end()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.end()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.data()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(cbuf.data()), TestType const*>::value, "");
}

SECTION("construction")
{
static_assert(!cuda::std::is_copy_constructible<uninitialized_buffer>::value, "");
Expand Down Expand Up @@ -167,13 +155,19 @@ TEMPLATE_TEST_CASE(
SECTION("access")
{
uninitialized_buffer buf{resource, 42};
static_assert(cuda::std::is_same<decltype(buf.begin()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.end()), TestType*>::value, "");
static_assert(cuda::std::is_same<decltype(buf.data()), TestType*>::value, "");
CUDAX_CHECK(buf.data() != nullptr);
CUDAX_CHECK(buf.size() == 42);
CUDAX_CHECK(buf.size_bytes() == 42 * sizeof(TestType));
CUDAX_CHECK(buf.begin() == buf.data());
CUDAX_CHECK(buf.end() == buf.begin() + buf.size());
CUDAX_CHECK(buf.get_memory_resource() == resource);

static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).begin()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).end()), TestType const*>::value, "");
static_assert(cuda::std::is_same<decltype(cuda::std::as_const(buf).data()), TestType const*>::value, "");
CUDAX_CHECK(cuda::std::as_const(buf).data() != nullptr);
CUDAX_CHECK(cuda::std::as_const(buf).size() == 42);
CUDAX_CHECK(cuda::std::as_const(buf).begin() == buf.data());
Expand Down

0 comments on commit 56fa95a

Please sign in to comment.