diff --git a/test_conformance/printf/test_printf.cpp b/test_conformance/printf/test_printf.cpp index 73f0e205..0d5dfa7b 100644 --- a/test_conformance/printf/test_printf.cpp +++ b/test_conformance/printf/test_printf.cpp @@ -1029,6 +1029,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) { @@ -1055,15 +1061,25 @@ int test_buffer_size(cl_device_id deviceID, cl_context context, } test_definition test_list[] = { - ADD_TEST(int), ADD_TEST(long), - ADD_TEST(half), ADD_TEST(half_limits), - ADD_TEST(float), ADD_TEST(float_limits), - ADD_TEST(double), ADD_TEST(double_limits), - ADD_TEST(octal), ADD_TEST(unsigned), - ADD_TEST(hexadecimal), ADD_TEST(char), - ADD_TEST(string), ADD_TEST(format_string), - ADD_TEST(vector), ADD_TEST(address_space), - ADD_TEST(buffer_size), ADD_TEST(mixed_format_random), + ADD_TEST(int), + ADD_TEST(long), + ADD_TEST(half), + ADD_TEST(half_limits), + ADD_TEST(float), + ADD_TEST(float_limits), + ADD_TEST(double), + ADD_TEST(double_limits), + ADD_TEST(octal), + ADD_TEST(unsigned), + ADD_TEST(hexadecimal), + ADD_TEST(char), + ADD_TEST(string), + ADD_TEST(format_string), + ADD_TEST(vector), + 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 ad1e08fb..993a6126 100644 --- a/test_conformance/printf/test_printf.h +++ b/test_conformance/printf/test_printf.h @@ -62,6 +62,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 4584b8cc..cd84c01a 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -1491,6 +1491,116 @@ testCase testCaseMixedFormat = { TYPE_MIXED_FORMAT_RANDOM, correctBufferMixedFormat, printMixedFormatGenParameters, NULL }; + +//============================================================= + +// length sub-specifier format + +//============================================================= + +std::vector printLenSpecGenParameters = { + + { { "%hd" }, "32767" }, + + { { "%hhd" }, "127" }, + + { { "%ld" }, "9223372036854775807L" }, + + { { "%hd" }, "-32767" }, + + { { "%hhd" }, "-128" }, + + { { "%ld" }, "-9223372036854775807L" }, + + { { "%hx" }, "32767" }, + + { { "%hhx" }, "127" }, + + { { "%lx" }, "9223372036854775807L" }, + + { { "%hx" }, "-32767" }, + + { { "%hhx" }, "-128" }, + + { { "%lx" }, "-9223372036854775807L" }, + + { { "%ho" }, "32767" }, + + { { "%hho" }, "127" }, + + { { "%lo" }, "9223372036854775807L" }, + + { { "%ho" }, "-32767" }, + + { { "%hho" }, "-128" }, + + { { "%lo" }, "-9223372036854775807L" }, +}; + +//--------------------------------------------------------- + +// Lookup table -[string] length specified correct buffer + +//--------------------------------------------------------- + +std::vector correctBufferLenSpec = { + + "32767", + + "127", + + "9223372036854775807", + + "-32767", + + "-128", + + "-9223372036854775807", + + "7fff", + + "7f", + + "7fffffffffffffff", + + "8001", + + "80", + + "8000000000000001", + + "77777", + + "177", + + "777777777777777777777", + + "100001", + + "200", + + "1000000000000000000001", +}; + + +//---------------------------------------------------------- + +// Test case for length specified values + +//---------------------------------------------------------- + +testCase testCaseLenSpec = { + + TYPE_LENGTH_SPECIFIER, + + correctBufferLenSpec, + + printLenSpecGenParameters, + + NULL + +}; + //------------------------------------------------------------------------------- //All Test cases | @@ -1503,7 +1613,7 @@ std::vector allTestCase = { &testCaseDouble, &testCaseDoubleLimits, &testCaseOctal, &testCaseUnsigned, &testCaseHexadecimal, &testCaseChar, &testCaseString, &testCaseFormatString, &testCaseVector, - &testCaseAddrSpace, &testCaseMixedFormat + &testCaseAddrSpace, &testCaseMixedFormat, &testCaseLenSpec }; //-----------------------------------------