Changeset e41e75de in rtems


Ignore:
Timestamp:
Jul 19, 2010, 1:10:48 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
741343ad
Parents:
24db9ba
Message:

2010-07-19 Joel Sherrill <joel.sherrill@…>

  • stringto01/init.c, stringto01/stringto01.scn, stringto01/stringto_test_template.h: Attempt to pick up a few more error paths.
Location:
testsuites/libtests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    r24db9ba re41e75de  
     12010-07-19      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * stringto01/init.c, stringto01/stringto01.scn,
     4        stringto01/stringto_test_template.h: Attempt to pick up a few more
     5        error paths.
     6
    172010-07-15      Bharath Suri <bharath.s.jois@gmail.com>
    28
  • testsuites/libtests/stringto01/init.c

    r24db9ba re41e75de  
    1212#include "tmacros.h"
    1313#include <rtems/stringto.h>
     14#include <limits.h>
     15#include <math.h>
    1416
    1517#include <stdio.h>
     18
     19#define __STRING(x)     #x              /* stringify without expanding x */
     20#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
    1621
    1722/* Test pointer conversions */
     
    3439/* Test integer conversions */
    3540#define TEST_STRING_TO_TYPE          int
     41#define STRING_TO_MAX                LONG_MAX
     42#define STRING_TO_MAX_STRING         __XSTRING(LONG_MAX)
    3643#define TEST_STRING_TO_NAME          test_rtems_string_to_int
    3744#define STRING_TO_NAME_METHOD        rtems_string_to_int
     
    5259/* Test long conversions */
    5360#define TEST_STRING_TO_TYPE          long
     61#define STRING_TO_MAX                LONG_MAX
     62#define STRING_TO_MAX_STRING         __XSTRING(LONG_MAX)
    5463#define TEST_STRING_TO_NAME          test_rtems_string_to_long
    5564#define STRING_TO_NAME_METHOD        rtems_string_to_long
     
    7180/* Test long long conversions */
    7281#define TEST_STRING_TO_TYPE          long long
     82#define STRING_TO_MAX                LONG_LONG_MAX
     83#define STRING_TO_MAX_STRING         __XSTRING(LONG_LONG_MAX)
    7384#define TEST_STRING_TO_NAME          test_rtems_string_to_long_long
    7485#define STRING_TO_NAME_METHOD        rtems_string_to_long_long
  • testsuites/libtests/stringto01/stringto01.scn

    r24db9ba re41e75de  
    1818rtems_string_to_int - NULL return value - RTEMS_INVALID_ADDRESS
    1919rtems_string_to_int - 123 NULL endptr return value - RTEMS_SUCCESSFUL
     20rtems_string_to_int - MAXIMUM VALUE w/endptr return value - RTEMS_SUCCESSFUL
    2021rtems_string_to_int - 123 w/endptr return value - RTEMS_SUCCESSFUL
    2122rtems_string_to_int - YYY w/endptr return value - RTEMS_NOT_DEFINED
     
    3435rtems_string_to_long - NULL return value - RTEMS_INVALID_ADDRESS
    3536rtems_string_to_long - 123 NULL endptr return value - RTEMS_SUCCESSFUL
     37rtems_string_to_long - MAXIMUM VALUE w/endptr return value - RTEMS_SUCCESSFUL
    3638rtems_string_to_long - 123 w/endptr return value - RTEMS_SUCCESSFUL
    3739rtems_string_to_long - YYY w/endptr return value - RTEMS_NOT_DEFINED
     
    5153rtems_string_to_long_long - NULL return value - RTEMS_INVALID_ADDRESS
    5254rtems_string_to_long_long - 123 NULL endptr return value - RTEMS_SUCCESSFUL
     55rtems_string_to_long_long - MAXIMUM VALUE w/endptr return value - RTEMS_SUCCESSFUL
    5356rtems_string_to_long_long - 123 w/endptr return value - RTEMS_SUCCESSFUL
    5457rtems_string_to_long_long - YYY w/endptr return value - RTEMS_NOT_DEFINED
  • testsuites/libtests/stringto01/stringto_test_template.h

    r24db9ba re41e75de  
    5858  rtems_test_assert( status == RTEMS_SUCCESSFUL );
    5959  rtems_test_assert( value == (TEST_STRING_TO_TYPE)GOOD_VALUE );
     60
     61  #if defined(STRING_TO_MAX)
     62    /* Basic conversion works for return value */
     63    endptr = NULL;
     64    puts(
     65      STRING_TO_NAME_METHOD_STRING " - MAXIMUM VALUE"
     66      " w/endptr return value - RTEMS_SUCCESSFUL"
     67    );
     68    #if defined(STRING_TO_INTEGER)
     69      status = STRING_TO_NAME_METHOD(
     70        STRING_TO_MAX_STRING, &value, &endptr, 10 );
     71    #elif defined(STRING_TO_POINTER) || defined(STRING_TO_FLOAT)
     72      status = STRING_TO_NAME_METHOD( STRING_TO_MAX_STRING, &value, &endptr );
     73    #endif
     74    rtems_test_assert( status == RTEMS_SUCCESSFUL );
     75    rtems_test_assert( endptr );
     76    rtems_test_assert( value == (TEST_STRING_TO_TYPE)STRING_TO_MAX );
     77  #endif
    6078
    6179  /* Basic conversion works for return value */
     
    146164#undef STRING_TO_POINTER
    147165#undef STRING_TO_FLOAT
     166#undef STRING_TO_MAX
     167#undef STRING_TO_MAX_STRING
    148168#undef GOOD_VALUE
    149169#undef GOOD_VALUE_STRING
Note: See TracChangeset for help on using the changeset viewer.