Skip to content

Commit b3fd643

Browse files
ULT renaming: Create Program from IL
Change-Id: I129f8b2d3f0e36815db2b8f517ae4ea8aeab2209 Signed-off-by: Cetnerowski, Adam <[email protected]>
1 parent 31c6e03 commit b3fd643

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

unit_tests/api/cl_create_program_with_binary_tests.inl

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef api_tests clCreateProgramWithILKHRTests;
1818

1919
namespace ULT {
2020

21-
TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) {
21+
TEST_F(clCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgramWithBinaryThenProgramIsCreatedAndSuccessIsReturned) {
2222
cl_program pProgram = nullptr;
2323
cl_int binaryStatus = CL_INVALID_VALUE;
2424
void *pBinary = nullptr;
@@ -63,7 +63,7 @@ TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) {
6363
EXPECT_EQ(nullptr, pProgram);
6464
}
6565

66-
TEST_F(clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue) {
66+
TEST_F(clCreateProgramWithILTests, GivenInvalidContextWhenCreatingProgramWithIlThenInvalidContextErrorIsReturned) {
6767
const uint32_t spirv[16] = {0x03022307};
6868

6969
cl_int err = CL_SUCCESS;
@@ -72,24 +72,23 @@ TEST_F(clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue)
7272
EXPECT_EQ(nullptr, prog);
7373
}
7474

75-
TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsEmptyThenReturnsInvalidValue) {
76-
const uint32_t spirv[16] = {0x03022307};
77-
75+
TEST_F(clCreateProgramWithILTests, GivenNullIlWhenCreatingProgramWithIlThenInvalidValueErrorIsReturned) {
7876
cl_int err = CL_SUCCESS;
7977
cl_program prog = clCreateProgramWithIL(pContext, nullptr, 0, &err);
8078
EXPECT_EQ(CL_INVALID_VALUE, err);
8179
EXPECT_EQ(nullptr, prog);
80+
}
8281

83-
err = CL_SUCCESS;
84-
prog = clCreateProgramWithIL(pContext, spirv, 0, &err);
85-
EXPECT_EQ(CL_INVALID_BINARY, err);
86-
EXPECT_EQ(nullptr, prog);
82+
TEST_F(clCreateProgramWithILTests, GivenIncorrectIlSizeWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
83+
const uint32_t spirv[16] = {0x03022307};
8784

88-
prog = clCreateProgramWithIL(pContext, spirv, 0, nullptr);
85+
cl_int err = CL_SUCCESS;
86+
cl_program prog = clCreateProgramWithIL(pContext, spirv, 0, &err);
87+
EXPECT_EQ(CL_INVALID_BINARY, err);
8988
EXPECT_EQ(nullptr, prog);
9089
}
9190

92-
TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlvmBCThenReturnsInvalidValue) {
91+
TEST_F(clCreateProgramWithILTests, GivenIncorrectIlWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
9392
const uint32_t notSpirv[16] = {0xDEADBEEF};
9493

9594
cl_int err = CL_SUCCESS;
@@ -98,7 +97,14 @@ TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlv
9897
EXPECT_EQ(nullptr, prog);
9998
}
10099

101-
TEST_F(clCreateProgramWithILKHRTests, whenValidInputParametersThenReturnsSuccessAndProgram) {
100+
TEST_F(clCreateProgramWithILTests, GivenIncorrectIlAndNoErrorPointerWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned) {
101+
const uint32_t notSpirv[16] = {0xDEADBEEF};
102+
103+
cl_program prog = clCreateProgramWithIL(pContext, notSpirv, sizeof(notSpirv), nullptr);
104+
EXPECT_EQ(nullptr, prog);
105+
}
106+
107+
TEST_F(clCreateProgramWithILKHRTests, GivenCorrectParametersWhenCreatingProgramWithIlkhrThenProgramIsCreatedAndSuccessIsReturned) {
102108
const uint32_t spirv[16] = {0x03022307};
103109

104110
cl_int err = CL_INVALID_VALUE;
@@ -110,7 +116,7 @@ TEST_F(clCreateProgramWithILKHRTests, whenValidInputParametersThenReturnsSuccess
110116
EXPECT_EQ(CL_SUCCESS, retVal);
111117
}
112118

113-
TEST_F(clCreateProgramWithILKHRTests, whenInvalidInputParameterThenReturnsNull) {
119+
TEST_F(clCreateProgramWithILKHRTests, GivenNullIlWhenCreatingProgramWithIlkhrThenNullProgramIsReturned) {
114120
cl_program program = clCreateProgramWithILKHR(pContext, nullptr, 0, nullptr);
115121
EXPECT_EQ(nullptr, program);
116122
}

0 commit comments

Comments
 (0)