Changeset 7920a24c in rtems


Ignore:
Timestamp:
Jul 29, 2011, 8:29:13 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 5, master
Children:
25715ecc
Parents:
6662754
Message:

2011-07-29 Pawel Zagorski <pzagor@…>

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.
Location:
testsuites/libtests
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    r6662754 r7920a24c  
     12011-07-29      Pawel Zagorski <pzagor@agh.edu.pl>
     2
     3        PR 1865/tests
     4        * stringto01/Makefile.am, stringto01/init.c, stringto01/stringto01.doc,
     5        stringto01/stringto01.scn, stringto01/stringto_test_template.h:
     6        Improve coverage of string conversion routines.
     7
    182011-07-29      Ralf Corsépius <ralf.corsepius@rtems.org>
    29
  • testsuites/libtests/stringto01/Makefile.am

    r6662754 r7920a24c  
    1515include $(top_srcdir)/../automake/leaf.am
    1616
    17 stringto01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
    1817
    1918AM_CPPFLAGS += -I$(top_srcdir)/../support/include
  • testsuites/libtests/stringto01/init.c

    r6662754 r7920a24c  
    4646#define STRING_TO_NAME_METHOD        rtems_string_to_unsigned_char
    4747#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_unsigned_char"
    48 /* #define TEST_TOO_LARGE_STRING        "987654321123456789123456789" */
     48#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
     49#define TEST_TOO_LARGE_FOR_UCHAR     "256"
    4950#define STRING_TO_INTEGER
    5051#include "stringto_test_template.h"
     
    5859#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_int"
    5960#define TEST_TOO_LARGE_STRING        "987654321123456789123456789"
     61#define TEST_TOO_SMALL_STRING        "-98765432198765432123456789"
    6062#define STRING_TO_INTEGER
    6163#include "stringto_test_template.h"
     
    118120#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_float"
    119121#define TEST_TOO_LARGE_STRING        "9.87654321123456789123456789E10240"
     122#define TEST_TOO_SMALL_STRING        "-9.87654321123456789123456789E10240"
    120123#define STRING_TO_FLOAT
    121124#include "stringto_test_template.h"
     
    127130#define STRING_TO_NAME_METHOD_STRING "rtems_string_to_double"
    128131#define TEST_TOO_LARGE_STRING        "9.87654321123456789123456789E10240"
     132#define TEST_TOO_SMALL_STRING        "-9.87654321123456789123456789E10240"
    129133#define STRING_TO_FLOAT
    130134#include "stringto_test_template.h"
  • testsuites/libtests/stringto01/stringto01.scn

    r6662754 r7920a24c  
     1
     2
    13*** STRING TO CONVERSION TEST ***
    24
     
    1416rtems_string_to_unsigned_char - YYY w/endptr return value - RTEMS_NOT_DEFINED
    1517rtems_string_to_unsigned_char - empty string - w/endptr return value - RTEMS_NOT_DEFINED
     18rtems_string_to_unsigned_char - overflow - RTEMS_INVALID_NUMBER
     19rtems_string_to_unsigned_char - overflow - RTEMS_INVALID_NUMBER
    1620
    1721Testing rtems_string_to_int
     
    2327rtems_string_to_int - empty string - w/endptr return value - RTEMS_NOT_DEFINED
    2428rtems_string_to_int - overflow - RTEMS_INVALID_NUMBER
     29rtems_string_to_int- RTEMS_INVALID_NUMBER
    2530
    2631Testing rtems_string_to_unsigned_int
     
    7580rtems_string_to_float - empty string - w/endptr return value - RTEMS_NOT_DEFINED
    7681rtems_string_to_float - overflow - RTEMS_INVALID_NUMBER
     82rtems_string_to_float- RTEMS_INVALID_NUMBER
    7783
    7884Testing rtems_string_to_double
     
    8389rtems_string_to_double - empty string - w/endptr return value - RTEMS_NOT_DEFINED
    8490rtems_string_to_double - overflow - RTEMS_INVALID_NUMBER
     91rtems_string_to_double- RTEMS_INVALID_NUMBER
    8592*** END OF STRING TO CONVERSION TEST ***
  • testsuites/libtests/stringto01/stringto_test_template.h

    r6662754 r7920a24c  
    140140  #endif
    141141
     142
     143  /* Conversion of number that is too large for unsigned char */
     144  #if defined(TEST_TOO_LARGE_FOR_UCHAR)
     145    endptr = NULL;
     146    value = 0;
     147    puts(
     148    STRING_TO_NAME_METHOD_STRING " - overflow - RTEMS_INVALID_NUMBER" );
     149    #if defined(STRING_TO_INTEGER)
     150      status = STRING_TO_NAME_METHOD(
     151                 TEST_TOO_LARGE_FOR_UCHAR, &value, &endptr, 10 );
     152    #endif
     153    if ( status != RTEMS_INVALID_NUMBER )
     154      printf( "ERROR = %s\n", rtems_status_text(status) );
     155    rtems_test_assert( status == RTEMS_INVALID_NUMBER );
     156    rtems_test_assert( endptr );
     157  #endif
     158
    142159  /* Conversion of number that is too small */
    143160  #if defined(TEST_TOO_SMALL_STRING)
     
    171188#undef TEST_TOO_LARGE_STRING
    172189#undef TEST_TOO_SMALL_STRING
     190#undef TEST_TOO_LARGE_FOR_UCHAR
Note: See TracChangeset for help on using the changeset viewer.