2018-08-09 16:57:53 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2018-08-09 16:57:53 +08:00
|
|
|
|
|
|
|
#include "runtime/context/context.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "cl_api_tests.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2018-08-09 16:57:53 +08:00
|
|
|
|
|
|
|
typedef api_tests clCreateSamplerTests;
|
|
|
|
|
|
|
|
namespace ULT {
|
|
|
|
|
2018-11-26 17:53:46 +08:00
|
|
|
TEST_F(clCreateSamplerTests, GivenCorrectParametersWhenCreatingSamplerThenSamplerIsCreatedAndSuccessReturned) {
|
2018-08-09 16:57:53 +08:00
|
|
|
auto sampler = clCreateSampler(
|
|
|
|
pContext,
|
|
|
|
CL_TRUE,
|
|
|
|
CL_ADDRESS_CLAMP,
|
|
|
|
CL_FILTER_NEAREST,
|
|
|
|
&retVal);
|
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
EXPECT_NE(nullptr, sampler);
|
|
|
|
|
|
|
|
retVal = clReleaseSampler(sampler);
|
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
}
|
|
|
|
|
2018-11-26 17:53:46 +08:00
|
|
|
TEST_F(clCreateSamplerTests, GivenCorrectParametersAndNullReturnPointerWhenCreatingSamplerThenSamplerIsCreated) {
|
2018-08-09 16:57:53 +08:00
|
|
|
auto sampler = clCreateSampler(
|
|
|
|
pContext,
|
|
|
|
CL_TRUE,
|
|
|
|
CL_ADDRESS_CLAMP,
|
|
|
|
CL_FILTER_NEAREST,
|
|
|
|
nullptr);
|
|
|
|
EXPECT_NE(nullptr, sampler);
|
|
|
|
|
|
|
|
retVal = clReleaseSampler(sampler);
|
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
}
|
|
|
|
|
2018-11-26 17:53:46 +08:00
|
|
|
TEST_F(clCreateSamplerTests, GivenInvalidContextWhenCreatingSamplerThenInvalidContextErrorIsReturned) {
|
2018-08-09 16:57:53 +08:00
|
|
|
auto sampler = clCreateSampler(
|
|
|
|
nullptr,
|
|
|
|
CL_FALSE,
|
|
|
|
CL_ADDRESS_CLAMP_TO_EDGE,
|
|
|
|
CL_FILTER_LINEAR,
|
|
|
|
&retVal);
|
|
|
|
EXPECT_EQ(CL_INVALID_CONTEXT, retVal);
|
|
|
|
EXPECT_EQ(nullptr, sampler);
|
|
|
|
delete sampler;
|
|
|
|
}
|
|
|
|
} // namespace ULT
|