@@ -18,7 +18,7 @@ typedef api_tests clCreateProgramWithILKHRTests;
18
18
19
19
namespace ULT {
20
20
21
- TEST_F (clCreateProgramWithBinaryTests, returnsSuccess ) {
21
+ TEST_F (clCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgramWithBinaryThenProgramIsCreatedAndSuccessIsReturned ) {
22
22
cl_program pProgram = nullptr ;
23
23
cl_int binaryStatus = CL_INVALID_VALUE;
24
24
void *pBinary = nullptr ;
@@ -63,7 +63,7 @@ TEST_F(clCreateProgramWithBinaryTests, returnsSuccess) {
63
63
EXPECT_EQ (nullptr , pProgram);
64
64
}
65
65
66
- TEST_F (clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue ) {
66
+ TEST_F (clCreateProgramWithILTests, GivenInvalidContextWhenCreatingProgramWithIlThenInvalidContextErrorIsReturned ) {
67
67
const uint32_t spirv[16 ] = {0x03022307 };
68
68
69
69
cl_int err = CL_SUCCESS;
@@ -72,24 +72,23 @@ TEST_F(clCreateProgramWithILTests, whenContextIsInvalidThenReturnsInvalidValue)
72
72
EXPECT_EQ (nullptr , prog);
73
73
}
74
74
75
- TEST_F (clCreateProgramWithILTests, whenIntermediateRepresentationIsEmptyThenReturnsInvalidValue) {
76
- const uint32_t spirv[16 ] = {0x03022307 };
77
-
75
+ TEST_F (clCreateProgramWithILTests, GivenNullIlWhenCreatingProgramWithIlThenInvalidValueErrorIsReturned) {
78
76
cl_int err = CL_SUCCESS;
79
77
cl_program prog = clCreateProgramWithIL (pContext, nullptr , 0 , &err);
80
78
EXPECT_EQ (CL_INVALID_VALUE, err);
81
79
EXPECT_EQ (nullptr , prog);
80
+ }
82
81
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 };
87
84
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);
89
88
EXPECT_EQ (nullptr , prog);
90
89
}
91
90
92
- TEST_F (clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlvmBCThenReturnsInvalidValue ) {
91
+ TEST_F (clCreateProgramWithILTests, GivenIncorrectIlWhenCreatingProgramWithIlThenInvalidBinaryErrorIsReturned ) {
93
92
const uint32_t notSpirv[16 ] = {0xDEADBEEF };
94
93
95
94
cl_int err = CL_SUCCESS;
@@ -98,7 +97,14 @@ TEST_F(clCreateProgramWithILTests, whenIntermediateRepresentationIsNotSpirvOrLlv
98
97
EXPECT_EQ (nullptr , prog);
99
98
}
100
99
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) {
102
108
const uint32_t spirv[16 ] = {0x03022307 };
103
109
104
110
cl_int err = CL_INVALID_VALUE;
@@ -110,7 +116,7 @@ TEST_F(clCreateProgramWithILKHRTests, whenValidInputParametersThenReturnsSuccess
110
116
EXPECT_EQ (CL_SUCCESS, retVal);
111
117
}
112
118
113
- TEST_F (clCreateProgramWithILKHRTests, whenInvalidInputParameterThenReturnsNull ) {
119
+ TEST_F (clCreateProgramWithILKHRTests, GivenNullIlWhenCreatingProgramWithIlkhrThenNullProgramIsReturned ) {
114
120
cl_program program = clCreateProgramWithILKHR (pContext, nullptr , 0 , nullptr );
115
121
EXPECT_EQ (nullptr , program);
116
122
}
0 commit comments