Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Sep 16, 2024
1 parent 93d5e36 commit d1215a1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cpp/tests/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ class TempDir {
std::filesystem::path _dir_path{};
};

/**
* @brief Help class for creating and comparing buffers.
*/
class DevBuffer {
public:
const std::size_t nelem;
const std::size_t nbytes;
void* ptr{nullptr};

DevBuffer(std::size_t nelem) : nelem{nelem}, nbytes{nelem * sizeof(std::int64_t)}
{
KVIKIO_CHECK_CUDA(cudaMalloc(&ptr, nbytes));
Expand Down Expand Up @@ -144,13 +151,9 @@ class DevBuffer {
}
std::cout << ")" << std::endl;
}

const std::size_t nelem;
const std::size_t nbytes;
void* ptr{nullptr};
};

void expect_equal(const DevBuffer& a, const DevBuffer& b)
inline void expect_equal(const DevBuffer& a, const DevBuffer& b)
{
EXPECT_EQ(a.nbytes, b.nbytes);
auto a_vec = a.to_vector();
Expand Down

0 comments on commit d1215a1

Please sign in to comment.