2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-12 18:27:28 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cl_api_tests.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
typedef api_tests clReleaseContextTests;
|
|
|
|
|
|
|
|
namespace ULT {
|
|
|
|
|
2019-07-11 06:01:14 +08:00
|
|
|
TEST_F(clReleaseContextTests, GivenValidContextWhenReleasingContextThenSuccessIsReturned) {
|
2017-12-21 07:45:38 +08:00
|
|
|
auto context = clCreateContext(
|
|
|
|
nullptr,
|
2020-02-12 18:27:28 +08:00
|
|
|
1u,
|
|
|
|
&testedClDevice,
|
2017-12-21 07:45:38 +08:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
&retVal);
|
|
|
|
|
|
|
|
EXPECT_NE(nullptr, context);
|
|
|
|
ASSERT_EQ(CL_SUCCESS, retVal);
|
|
|
|
|
|
|
|
retVal = clReleaseContext(context);
|
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
}
|
|
|
|
|
2019-07-11 06:01:14 +08:00
|
|
|
TEST_F(clReleaseContextTests, GivenNullContextWhenReleasingContextThenClInvalidContextIsReturned) {
|
2017-12-21 07:45:38 +08:00
|
|
|
auto retVal = clReleaseContext(nullptr);
|
|
|
|
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
|
|
|
}
|
|
|
|
} // namespace ULT
|