MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / REGISTER_TEST

Function REGISTER_TEST

test_conformance/integer_ops/test_upsample.cpp:223–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223REGISTER_TEST(integer_upsample)
224{
225 ExplicitType typesToTest[] = { kChar, kUChar, kShort, kUShort, kInt, kUInt, kNumExplicitTypes };
226 ExplicitType baseTypes[] = { kUChar, kUChar, kUShort, kUShort, kUInt, kUInt, kNumExplicitTypes };
227 ExplicitType outTypes[] = { kShort, kUShort, kInt, kUInt, kLong, kULong, kNumExplicitTypes };
228 int i, err = 0;
229 int sizeIndex;
230 size_t size;
231 void *sourceA, *sourceB, *expected;
232 RandomSeed seed(gRandomSeed );
233
234 for( i = 0; typesToTest[ i ] != kNumExplicitTypes; i++ )
235 {
236 if ((outTypes[i] == kLong || outTypes[i] == kULong) && !gHasLong)
237 {
238 log_info( "Longs unsupported on this device. Skipping...\n");
239 continue;
240 }
241
242 for( sizeIndex = 0; sizeIndex < NUM_VECTOR_SIZES; sizeIndex++)
243 {
244 size = (size_t)vector_sizes[sizeIndex];
245 log_info("running upsample test for %s %s vector size %d\n", get_explicit_type_name(typesToTest[i]), get_explicit_type_name(baseTypes[i]), (int)size);
246 sourceA = create_random_data( typesToTest[ i ], seed, 256 );
247 sourceB = create_random_data( baseTypes[ i ], seed, 256 );
248 expected = create_upsample_data( typesToTest[ i ], sourceA, sourceB, 256 );
249
250 if( test_upsample_2_param_fn( queue, context, "upsample",
251 typesToTest[ i ], baseTypes[ i ],
252 outTypes[ i ],
253 size, size, size,
254 256 / size,
255 sourceA, sourceB, expected ) != 0 )
256 {
257 log_error( "TEST FAILED: %s for %s%d\n", "upsample", get_explicit_type_name( typesToTest[ i ] ), (int)size );
258 err = -1;
259 }
260 free( sourceA );
261 free( sourceB );
262 free( expected );
263 }
264 }
265 return err;
266}

Callers

nothing calls this directly

Calls 4

get_explicit_type_nameFunction · 0.85
create_random_dataFunction · 0.85
create_upsample_dataFunction · 0.85
test_upsample_2_param_fnFunction · 0.85

Tested by

no test coverage detected