Adding a test
This commit is contained in:
parent
81d04d6332
commit
a53e5f87be
2 changed files with 17 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ include(CatchAddTests)
|
|||
|
||||
add_executable(tests
|
||||
tests_stream.cpp
|
||||
tests_safe_allocation.cpp
|
||||
)
|
||||
target_link_libraries(tests Catch2::Catch2WithMain raiiSafeCuda)
|
||||
set_target_properties(tests PROPERTIES
|
||||
|
|
|
|||
16
tests/tests_safe_allocation.cpp
Normal file
16
tests/tests_safe_allocation.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue