1
0
Fork 0
raii-safe-cuda/tests/tests_safe_allocation.cpp
2025-12-13 12:34:38 +01:00

16 lines
507 B
C++

//
// Created by postaron on 13/12/2025.
//
#include <iostream>
#include <catch2/catch_all.hpp>
#include "../include/malloc_unmanaged.hpp"
TEST_CASE("Managed allocation", "[safe_alloc][0]") {
std::cout << "Safely allocates memory in CUDA" << std::endl;
const auto [safe_ptr, error] = safe_cuda::cuda_malloc<int, safe_cuda::allocType::Managed>(sizeof(int));
REQUIRE(safe_ptr != nullptr);
REQUIRE(error == cudaSuccess);
std::cout << "Safely deallocates memory in CUDA" << std::endl;
}