From 7920a24c6e24721b32a1c125923801a23da28634 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 29 Jul 2011 20:29:13 +0000 Subject: 2011-07-29 Pawel Zagorski PR 1865/tests * stringto01/Makefile.am, stringto01/init.c, stringto01/stringto01.doc, stringto01/stringto01.scn, stringto01/stringto_test_template.h: Improve coverage of string conversion routines. --- .../libtests/stringto01/stringto_test_template.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'testsuites/libtests/stringto01/stringto_test_template.h') diff --git a/testsuites/libtests/stringto01/stringto_test_template.h b/testsuites/libtests/stringto01/stringto_test_template.h index a69284448c..6cd51f4782 100644 --- a/testsuites/libtests/stringto01/stringto_test_template.h +++ b/testsuites/libtests/stringto01/stringto_test_template.h @@ -139,6 +139,23 @@ void TEST_STRING_TO_NAME(void) rtems_test_assert( endptr ); #endif + + /* Conversion of number that is too large for unsigned char */ + #if defined(TEST_TOO_LARGE_FOR_UCHAR) + endptr = NULL; + value = 0; + puts( + STRING_TO_NAME_METHOD_STRING " - overflow - RTEMS_INVALID_NUMBER" ); + #if defined(STRING_TO_INTEGER) + status = STRING_TO_NAME_METHOD( + TEST_TOO_LARGE_FOR_UCHAR, &value, &endptr, 10 ); + #endif + if ( status != RTEMS_INVALID_NUMBER ) + printf( "ERROR = %s\n", rtems_status_text(status) ); + rtems_test_assert( status == RTEMS_INVALID_NUMBER ); + rtems_test_assert( endptr ); + #endif + /* Conversion of number that is too small */ #if defined(TEST_TOO_SMALL_STRING) endptr = NULL; @@ -170,3 +187,4 @@ void TEST_STRING_TO_NAME(void) #undef BAD_VALUE_STRING #undef TEST_TOO_LARGE_STRING #undef TEST_TOO_SMALL_STRING +#undef TEST_TOO_LARGE_FOR_UCHAR -- cgit v1.2.3