[PATCH v2] Tests for inttype.h methods

Joel Sherrill joel at rtems.org
Thu Apr 2 22:08:59 UTC 2020


You added a few test cases so they need to be added to the .doc file in the
same directory.

I don't think you changed the test output so the .scn (screen) file should
be OK.

--joel

On Thu, Apr 2, 2020 at 5:30 AM Eshan dhawan <eshandhawan51 at gmail.com> wrote:

> ---
>  testsuites/psxtests/psxinttypes01/init.c | 25 +++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/testsuites/psxtests/psxinttypes01/init.c
> b/testsuites/psxtests/psxinttypes01/init.c
> index 030aa2aa57..d86313b251 100644
> --- a/testsuites/psxtests/psxinttypes01/init.c
> +++ b/testsuites/psxtests/psxinttypes01/init.c
> @@ -6,6 +6,7 @@
>  /*
>   * SPDX-License-Identifier: BSD-2-Clause
>   *
> + * Copyright (C) 2020, Eshan Dhawan
>   * Copyright (C) 2019, Aditya Upadhyay and Vaibhav Gupta
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -64,11 +65,29 @@ rtems_task Init(rtems_task_argument ignored)
>    wchar_t  *nptr2_n_errange = L"-9999999999999999999999";
>    wchar_t  *endptr2         = NULL;
>
> -  intmax_t  result_strtoimax;
> +  intmax_t  result_strtoimax, result_imaxabs, input_1, input_2 ;
> +  imaxdiv_t result_exp, result_imaxdiv ;
>    uintmax_t result_strtoumax;
>
>    TEST_BEGIN();
> -
> +  /* Test for imaxabs */
> +  input_1 = -10 ;
> +  result_imaxabs = 10 ;
> +  rtems_test_assert( imaxabs(input_1) == result_imaxabs );
> +
> +  input_1 = 10 ;
> +  result_imaxabs = 10 ;
> +  rtems_test_assert( imaxabs(input_1) == result_imaxabs );
> +
> +  /* Test for imaxdiv */
> +  input_1 = 10 ;
> +  input_2 = 3 ;
> +  result_exp.quot = input_1 / input_2 ;
> +  result_exp.rem =  input_1 % input_2 ;
> +  result_imaxdiv = imaxdiv(input_1, input_2) ;
> +  rtems_test_assert( result_imaxdiv.quot == result_exp.quot &&
> +  result_imaxdiv.rem == result_exp.rem );
> +
>    /* Test for strtoimax  */
>    puts( "\nstrtoimax Testcases...." );
>    puts( "Valid Inputs - Positive Number" );
> @@ -83,7 +102,7 @@ rtems_task Init(rtems_task_argument ignored)
>    rtems_test_assert( result_strtoimax == -123 );
>
>    puts( "Final string pointed by endptr" );
> -  rtems_test_assert( endptr1 == ( nptr1_n + 4 ) );
> +  rtems_test_assert( endptr1 == ( nptr1_n + 4 ) );
>
>    puts( "Valid Input - Positive Number - Number out of Range" );
>    result_strtoimax = strtoimax( nptr1_p_errange, &endptr1, base );
> --
> 2.17.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200402/8c33f0fe/attachment.html>


More information about the devel mailing list