diff --git a/test_conformance/printf/test_printf.cpp b/test_conformance/printf/test_printf.cpp index d59e06825b..9debd06b32 100644 --- a/test_conformance/printf/test_printf.cpp +++ b/test_conformance/printf/test_printf.cpp @@ -1017,6 +1017,12 @@ int test_mixed_format_random(cl_device_id deviceID, cl_context context, return doTest(gQueue, gContext, TYPE_MIXED_FORMAT_RANDOM, deviceID); } +int test_length_specifier(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + return doTest(gQueue, gContext, TYPE_LENGTH_SPECIFIER, deviceID); +} + int test_buffer_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { @@ -1060,6 +1066,7 @@ test_definition test_list[] = { ADD_TEST(address_space), ADD_TEST(buffer_size), ADD_TEST(mixed_format_random), + ADD_TEST(length_specifier), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/printf/test_printf.h b/test_conformance/printf/test_printf.h index 51f351170f..9f84db260e 100644 --- a/test_conformance/printf/test_printf.h +++ b/test_conformance/printf/test_printf.h @@ -61,6 +61,7 @@ enum PrintfTestType TYPE_VECTOR, TYPE_ADDRESS_SPACE, TYPE_MIXED_FORMAT_RANDOM, + TYPE_LENGTH_SPECIFIER, TYPE_COUNT }; diff --git a/test_conformance/printf/util_printf.cpp b/test_conformance/printf/util_printf.cpp index 5b96e8683d..0f2c2a9972 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -1397,6 +1397,104 @@ testCase testCaseMixedFormat = { TYPE_MIXED_FORMAT_RANDOM, correctBufferMixedFormat, printMixedFormatGenParameters, NULL }; + +//============================================================= + +// length sub-specifier format + +//============================================================= + +std::vector printLenSpecGenParameters = { + + { { "%hd" }, "32767" }, + + { { "%hhd" }, "127" }, + + { { "%ld" }, "9223372036854775807L" }, + + { { "%hhd" }, "-128" }, + + { { "%ld" }, "-9223372036854775807L" }, + + { { "%hx" }, "32767" }, + + { { "%hhx" }, "127" }, + + { { "%lx" }, "9223372036854775807L" }, + + { { "%hhx" }, "-128" }, + + { { "%lx" }, "-9223372036854775807L" }, + + { { "%ho" }, "32767" }, + + { { "%hho" }, "127" }, + + { { "%lo" }, "9223372036854775807L" }, + + { { "%hho" }, "-128" }, + + { { "%lo" }, "-9223372036854775807L" }, +}; + +//--------------------------------------------------------- + +// Lookup table -[string] length specified correct buffer + +//--------------------------------------------------------- + +std::vector correctBufferLenSpec = { + + "32767", + + "127", + + "9223372036854775807", + + "-128", + + "-9223372036854775807", + + "7fff", + + "7f", + + "7fffffffffffffff", + + "80", + + "8000000000000001", + + "77777", + + "177", + + "777777777777777777777", + + "200", + + "1000000000000000000001", +}; + + +//---------------------------------------------------------- + +// Test case for length specified values + +//---------------------------------------------------------- + +testCase testCaseLenSpec = { + + TYPE_LENGTH_SPECIFIER, + + correctBufferLenSpec, + + printLenSpecGenParameters, + + NULL + +}; + //------------------------------------------------------------------------------- //All Test cases | @@ -1409,7 +1507,7 @@ std::vector allTestCase = { &testCaseDoubleLimits, &testCaseOctal, &testCaseUnsigned, &testCaseHexadecimal, &testCaseChar, &testCaseString, &testCaseFormatString, &testCaseVector, &testCaseAddrSpace, - &testCaseMixedFormat + &testCaseMixedFormat, &testCaseLenSpec }; //-----------------------------------------