16 lines
507 B
C++
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;
|
|
}
|