[PATCH v2 1/4] added fesetexeptflag() test to the psxfenv test

Gedare Bloom gedare at rtems.org
Wed Mar 4 16:40:57 UTC 2020


On Tue, Mar 3, 2020 at 12:50 PM Eshan dhawan <eshandhawan51 at gmail.com> wrote:
>
> ---
>  testsuites/psxtests/psxfenv01/init.c | 36 ++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 5 deletions(-)
>
> diff --git a/testsuites/psxtests/psxfenv01/init.c b/testsuites/psxtests/psxfenv01/init.c
> index cdb0fa596e..8ffb9395b9 100644
> --- a/testsuites/psxtests/psxfenv01/init.c
> +++ b/testsuites/psxtests/psxfenv01/init.c
> @@ -46,6 +46,9 @@
>  #include <string.h>
>  #include <rtems/test.h>
>  #include <tmacros.h>
> +#include <assert.h>
> +
> +#define rtems_test_assert(x) assert(x)
>
Why do you add this? It should be coming in from tmacros.h already.

>  const char rtems_test_name[] = "PSXFENV 01";
>
> @@ -71,19 +74,19 @@ rtems_task Init(rtems_task_argument ignored)
>      r = fesetenv(FE_DFL_ENV);
>      if (r)
>        printf("fesetenv ==> %d\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
Why do you change this?

>
>      /* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
>      puts( "feclearexcept(FE_ALL_EXCEPT)." );
>      r = feclearexcept(FE_ALL_EXCEPT);
>      if (r)
>        printf("feclearexcept ==> 0x%x\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
>
>      r = fetestexcept( FE_ALL_EXCEPT );
>      if (r)
>        printf("fetestexcept ==> 0x%x\n", r);
> -    rtems_test_assert( r == 0 );
> +    assert( r == 0 );
>
>      /* Test 'FE_DIVBYZERO' */
>      puts( "Divide by zero and confirm fetestexcept()" );
> @@ -91,12 +94,22 @@ rtems_task Init(rtems_task_argument ignored)
>      b = 1.0;
>      c = b/a;
>      (void) c;
> +    /* Test fegetexceptflag() and fesetexceptflag().*/
> +    r=fegetexceptflag(&excepts,FE_ALL_EXCEPT);
white space is still wrong. please reread the coding conventions, it
should be more like
r = fegetexceptflag( &excepts, FE_ALL_EXCEPT );


> +    if(r)
> +      printf("fegetexceptflag ==> 0x%x\n", r);
> +    assert(r == 0);
> +
> +    r=fesetexceptflag(&excepts, FE_ALL_EXCEPT);
> +    if(r)
> +      printf("fesetexceptflag ==> 0x%x\n", r);
> +    assert(r == 0);
> +
>
> -    fegetexceptflag(&excepts,FE_ALL_EXCEPT);
>
>  #ifdef FE_DIVBYZERO
>      r = feraiseexcept(FE_DIVBYZERO);
> -    rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
> +    assert( fetestexcept( FE_DIVBYZERO ) );
>  #endif
>
>      /* Test 'FE_INEXACT' */
> @@ -125,3 +138,16 @@ rtems_task Init(rtems_task_argument ignored)
>  #define CONFIGURE_INIT
>  #include <rtems/confdefs.h>
>  /* end of file */
> +
> +
> +/*
Why is this added here?

It is also odd to have stuff after a comment that says "end of file"?

> +    fegetenv()
> +
> +    fegetround()
> +    feholdexcept()
> +
> +    fesetexceptflag()
> +    fesetround()
> +
> +    feupdateenv()
> +*/
> --
> 2.17.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list