[PATCH v2] Testsuite of inttypes methods.

Joel Sherrill joel at rtems.org
Tue Sep 5 21:41:05 UTC 2017


Unless I am doing something wrong, this is a diff to code which has
not been merged.  Can you send a complete patch with the entire
contents of the psxinttypes01 directory?

Sorry for being slow. It was a long holiday weekend here.

--joel

On Sat, Sep 2, 2017 at 11:45 AM, Aditya Upadhyay <aadit0402 at gmail.com>
wrote:

> ---
>  testsuites/psxtests/psxinttypes01/init.c           | 23
> +++++++++++-----------
>  .../psxtests/psxinttypes01/psxinttypes01.scn       |  6 +++---
>  2 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/testsuites/psxtests/psxinttypes01/init.c
> b/testsuites/psxtests/psxinttypes01/init.c
> index e593e43..8fc79f6 100644
> --- a/testsuites/psxtests/psxinttypes01/init.c
> +++ b/testsuites/psxtests/psxinttypes01/init.c
> @@ -13,12 +13,13 @@
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <errno.h>
> +#include <stdint.h>
>  #include <tmacros.h>
>
>  /* forward declarations to avoid warnings */
>
>  rtems_task Init(rtems_task_argument argument);
> -const char rtems_test_name[] = "PSXINTTYPE 01";
> +const char rtems_test_name[] = "PSXINTTYPES 01";
>  rtems_printer rtems_test_printer;
>
>  /*
> @@ -48,16 +49,16 @@ rtems_task Init(
>    /* Test for wcstoimax */
>
>    m = wcstoimax(nptr1, &endptr1, base);
> -  rtems_test_assert (m == ERANGE);
> -  rtems_test_assert (m == EINVAL);
> -
> +  rtems_test_assert (m != 0);
> +  rtems_test_assert (!(*endptr1));
> +
>    printf( "wcstoimax = %jd\n", m );
>
>    /* test for strtoumax */
>
>    j = strtoumax (nptr, &endptr, base);
> -  rtems_test_assert (j == ERANGE);
> -  rtems_test_assert (j == EINVAL);
> +  rtems_test_assert (j != 0);
> +  rtems_test_assert (*endptr);
>
>    printf( "strtoumax = %ju ( base %d )\n", j, base );
>    printf( "Stopped scan at %s\n\n", endptr );
> @@ -65,8 +66,8 @@ rtems_task Init(
>    /*test for wcstoumax */
>
>    k = wcstoumax (nptr1, &endptr1, base);
> -  rtems_test_assert (k == ERANGE);
> -  rtems_test_assert (k == EINVAL);
> +  rtems_test_assert (k != 0);
> +  rtems_test_assert (!(*endptr1));
>
>    printf( "wcstoumax = %ju\n", k );
>
> @@ -81,9 +82,9 @@ rtems_task Init(
>
>    /*Test for strtoimax */
>
> -  n = strtoimax ("11111111", &endptr, 2);
> -  rtems_test_assert (n == ERANGE);
> -  rtems_test_assert (n == EINVAL);
> +  n = strtoimax ("-123junk", &endptr, base);
> +  rtems_test_assert (n != 0);
> +  rtems_test_assert (*endptr);
>
>    printf( "strtoimax value = %jd\n", n);
>
> diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
> b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
> index 47a5416..79553be 100644
> --- a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
> +++ b/testsuites/psxtests/psxinttypes01/psxinttypes01.scn
> @@ -1,4 +1,4 @@
> -*** BEGIN OF TEST PSXINTTYPE 01 ***
> +*** BEGIN OF TEST PSXINTTYPES 01 ***
>  wcstoimax = 10110134932
>  strtoumax = 20690239864 ( base 10 )
>  Stopped scan at abc
> @@ -6,6 +6,6 @@ Stopped scan at abc
>  wcstoumax = 10110134932
>  imax div value = 3
>  imaxabs_value = 1234
> -strtoimax value = 255
> -*** END OF TEST PSXINTTYPE 01 ***
> +strtoimax value = -123
> +*** END OF TEST PSXINTTYPES 01 ***
>
> --
> 2.7.4
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170905/f7b259b1/attachment-0002.html>


More information about the devel mailing list