Files
rocm-systems/projects/hip/tests/catch/stress/memory/memcpy.cc
T
cjatin ee8e6078f9 SWDEV-277697 - Adding Infra and dependent libs: Catch2 and json parser, for new HIP Testing framework
Change-Id: Iedfa041ec9acc13eeb631ff67e1677e2fe29463d


[ROCm/hip commit: 8084df7b49]
2021-05-19 00:47:00 -04:00

34 lines
801 B
C++

#include <hip_test_common.hh>
TEST_CASE("hipMalloc", "DifferentSizes") {
int* d_a = nullptr;
SECTION("Size 10") {
auto res = hipMalloc(&d_a, sizeof(10));
REQUIRE(res == hipSuccess);
hipFree(d_a);
d_a = nullptr;
}
SECTION("Size 100") {
auto res = hipMalloc(&d_a, sizeof(100));
REQUIRE(res == hipSuccess);
hipFree(d_a);
d_a = nullptr;
}
SECTION("Size 1000") {
auto res = hipMalloc(&d_a, sizeof(1000));
REQUIRE(res == hipSuccess);
hipFree(d_a);
d_a = nullptr;
}
SECTION("Size 10000") {
auto res = hipMalloc(&d_a, sizeof(10000));
REQUIRE(res == hipSuccess);
hipFree(d_a);
d_a = nullptr;
}
SECTION("Size MAX") {
auto res = hipMalloc(&d_a, ~(size_t)0);
REQUIRE(res == hipErrorOutOfMemory);
d_a = nullptr;
}
}