Re: [PATCH v7] tests for fenv.h functions

2020-03-22 Thread Gedare Bloom
On Sun, Mar 22, 2020 at 3:59 AM Eshan Dhawan  wrote:
>
>
>
> On Sun, Mar 22, 2020 at 12:21 AM Gedare Bloom  wrote:
>>
>> I liked it better before, when the test prints nothing if it is
>> successful. I think this is the trend we are heading toward in rtems
>> tests.
>>
> I will incorporate more changes to the test so there is minimal printing if 
> the test is successful
> The test is originally written by @Vaibhav Gupta
> it would require to do minor changes in the previous parts of the test as well
> should i do that ??
Yes that would be good.

>>
>> On Sat, Mar 21, 2020 at 11:46 AM Eshan Dhawan  
>> wrote:
>> >
>> > I ran the code using qemu for risc-v architecture.
>> > The value of r = 0 for the function to run without error
>> > while the error is raised when the value is not matched with the correct 
>> > value defined in
>> > rtems_test_assert().
>> >
>> > ___
>> > devel mailing list
>> > devel@rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v7] tests for fenv.h functions

2020-03-22 Thread Eshan Dhawan
On Sun, Mar 22, 2020 at 12:21 AM Gedare Bloom  wrote:

> I liked it better before, when the test prints nothing if it is
> successful. I think this is the trend we are heading toward in rtems
> tests.
>
> I will incorporate more changes to the test so there is minimal printing
if the test is successful
The test is originally written by @Vaibhav Gupta 

it would require to do minor changes in the previous parts of the test as
well
should i do that ??

> On Sat, Mar 21, 2020 at 11:46 AM Eshan Dhawan 
> wrote:
> >
> > I ran the code using qemu for risc-v architecture.
> > The value of r = 0 for the function to run without error
> > while the error is raised when the value is not matched with the correct
> value defined in
> > rtems_test_assert().
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Gedare Bloom
PS: This is getting better incrementally, you're doing a good job
getting through your first real patch :) It can be a real challenge
sometimes especially since there are a lot of nit-picky things to
learn with the coding style issues.

On Sat, Mar 21, 2020 at 12:51 PM Gedare Bloom  wrote:
>
> I liked it better before, when the test prints nothing if it is
> successful. I think this is the trend we are heading toward in rtems
> tests.
>
> On Sat, Mar 21, 2020 at 11:46 AM Eshan Dhawan  wrote:
> >
> > I ran the code using qemu for risc-v architecture.
> > The value of r = 0 for the function to run without error
> > while the error is raised when the value is not matched with the correct 
> > value defined in
> > rtems_test_assert().
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Gedare Bloom
I liked it better before, when the test prints nothing if it is
successful. I think this is the trend we are heading toward in rtems
tests.

On Sat, Mar 21, 2020 at 11:46 AM Eshan Dhawan  wrote:
>
> I ran the code using qemu for risc-v architecture.
> The value of r = 0 for the function to run without error
> while the error is raised when the value is not matched with the correct 
> value defined in
> rtems_test_assert().
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Eshan Dhawan
I ran the code using qemu for risc-v architecture.
The value of r = 0 for the function to run without error
while the error is raised when the value is not matched with the correct
value defined in
rtems_test_assert().
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Aditya Upadhyay
On Sat, Mar 21, 2020 at 11:04 PM Eshan Dhawan  wrote:
>
>
>
> On Sat, Mar 21, 2020 at 10:48 PM Aditya Upadhyay  wrote:
>>
>> On Sat, Mar 21, 2020 at 9:32 PM Eshan Dhawan  wrote:
>> >
>> > I have added the changes as told by Aditya
>> > I would like to know is any other changes are required to be made to make 
>> > the patch usable
>> >
>> > Thanks
>> > Eshan
>> > > On 21-Mar-2020, at 8:20 PM, Eshan dhawan  wrote:
>> > >
>> > > ---
>> > > testsuites/psxtests/psxfenv01/init.c | 89 ++--
>> > > 1 file changed, 71 insertions(+), 18 deletions(-)
>> > >
>> > > diff --git a/testsuites/psxtests/psxfenv01/init.c 
>> > > b/testsuites/psxtests/psxfenv01/init.c
>> > > index cdb0fa596e..0ea820c523 100644
>> > > --- a/testsuites/psxtests/psxfenv01/init.c
>> > > +++ b/testsuites/psxtests/psxfenv01/init.c
>> > > @@ -46,11 +46,12 @@
>> > > #include 
>> > > #include 
>> > > #include 
>> > > +#include 
>> > >
>> > > const char rtems_test_name[] ="PSXFENV 01";
>> > >
>> > > /* forward declarations to avoid warnings */
>> > > -rtems_task Init(rtems_task_argument ignored);
>> > > +rtems_task Init( rtems_task_argument ignored );
>> > >
>> > > /* Test Function Begins */
>> > > rtems_task Init(rtems_task_argument ignored)
>> > > @@ -62,28 +63,31 @@ rtems_task Init(rtems_task_argument ignored)
>> > >
>> > >  /*
>> > >   * 'FE_ALL_EXCEPT' will be defined only when 'feclearexcept()',
>> > > -   * 'fegetexceptflag()', 'feraiseexcept()', 'fesetexceptflag()' and
>> > > -   * 'fetestexcept()' functions are supported by the architecture.
>> > > +   * fegetexceptflag() , feraiseexcept(), fesetexceptflag() and
>> > > +   * fetestexcept() functions are supported by the architecture.
>> > >   * Hence their testcases can be wrapped under #ifdef and #endif.
>> > >   */
>> > >  #ifdef FE_ALL_EXCEPT /* floating-point exceptions */
>> > >puts( "fesetenv(FE_DFL_ENV)." );
>> > > -r = fesetenv(FE_DFL_ENV);
>> > > -if (r)
>> > > +r = fesetenv ( FE_DFL_ENV );
>>
>> It should be like r = fesetenv( FE_DFL_ENV).
>>
>> > > +if ( r ) {
>> > >  printf("fesetenv ==> %d\n", r);
>>
>> After (, one space needed.
>> > > -rtems_test_assert( r == 0 );
>> > > +}
>> > > +rtems_test_assert ( r == 0 );
>>
>> Same here, Remove this unnecessary space, assert and (.
>>
>> > >
>> > > -/* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
>> > > -puts( "feclearexcept(FE_ALL_EXCEPT)." );
>> > > -r = feclearexcept(FE_ALL_EXCEPT);
>> > > -if (r)
>> > > +/* 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 );
>> > > +}
>> > > +rtems_test_assert ( r == 0 );
>> > >
>> Same here.
>>
>> > > -r = fetestexcept( FE_ALL_EXCEPT );
>> > > -if (r)
>> > > +r = fetestexcept ( FE_ALL_EXCEPT );
>> > > +if ( r ) {
>> > >  printf("fetestexcept ==> 0x%x\n", r);
>> > > -rtems_test_assert( r == 0 );
>> > > +}
>> > > +rtems_test_assert ( r == 0 );
>> > >
>> > >/* Test 'FE_DIVBYZERO' */
>> > >puts( "Divide by zero and confirm fetestexcept()" );
>> > > @@ -91,11 +95,60 @@ rtems_task Init(rtems_task_argument ignored)
>> > >b = 1.0;
>> > >c = b/a;
>> > >(void) c;
>> > > -
>> > > -fegetexceptflag(,FE_ALL_EXCEPT);
>> > > -
>> > > +/* Test fegetexceptflag() and fesetexceptflag() */
>> > > +r = fegetexceptflag ( , FE_ALL_EXCEPT );
>> > > +if ( r ) {
>> > > +  printf("fegetexceptflag ==> 0x%x\n", r);
>> > > +}
>> > > +rtems_test_assert ( r == 0 );
>> > > +
>> > > +r = fesetexceptflag ( , FE_ALL_EXCEPT );
>> > > +if ( r ) {
>> > > +  printf("fesetexceptflag ==> 0x%x\n", r);
>> > > +}
>> > > +rtems_test_assert ( r == 0 );
>> > > +
>> > > +/* Test for fegetround() and fesetround()
>> > > + * They have four main macros to be tested separated by ifdef
>> > > + * Since not all architectures support them
>> > > + * The test case gets and sets the rounding directions */
>> > > +#ifdef FE_TONEAREST
>> > > +rtems_test_assert ( fegetround() == FE_TONEAREST );
>> > > +#endif
>> > > +#ifdef FE_TOWARDZERO
>> > > +  r = fesetround ( FE_TOWARDZERO );
>> > > +  if ( r ) {
>> > > +  printf("fesetround ==> 0x%x\n", r);
>> > > +}
>> > > +  rtems_test_assert ( r == 0 );
>> > > +  rtems_test_assert ( fegetround() == FE_TOWARDZERO );
>> > > +#endif
>> > > +#ifdef FE_DOWNWARD
>> > > +  r = fesetround ( FE_DOWNWARD );
>> > > +  if ( r ) {
>> > > +  printf("fesetround ==> 0x%x\n", r);
>> > > +}
>> > > +  rtems_test_assert ( r == 0 );
>> > > +  rtems_test_assert ( fegetround() == FE_DOWNWARD );
>> > > +#endif
>> > > +#ifdef FE_UPWARD
>> > > +  r = fesetround ( FE_UPWARD );
>> > > +  if ( r ) {
>> > > +  printf("fesetround ==> 0x%x\n", r);
>> > > +}
>> > > +  rtems_test_assert ( r == 0 

Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Eshan Dhawan
On Sat, Mar 21, 2020 at 10:48 PM Aditya Upadhyay 
wrote:

> On Sat, Mar 21, 2020 at 9:32 PM Eshan Dhawan 
> wrote:
> >
> > I have added the changes as told by Aditya
> > I would like to know is any other changes are required to be made to
> make the patch usable
> >
> > Thanks
> > Eshan
> > > On 21-Mar-2020, at 8:20 PM, Eshan dhawan 
> wrote:
> > >
> > > ---
> > > testsuites/psxtests/psxfenv01/init.c | 89 ++--
> > > 1 file changed, 71 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/testsuites/psxtests/psxfenv01/init.c
> b/testsuites/psxtests/psxfenv01/init.c
> > > index cdb0fa596e..0ea820c523 100644
> > > --- a/testsuites/psxtests/psxfenv01/init.c
> > > +++ b/testsuites/psxtests/psxfenv01/init.c
> > > @@ -46,11 +46,12 @@
> > > #include 
> > > #include 
> > > #include 
> > > +#include 
> > >
> > > const char rtems_test_name[] ="PSXFENV 01";
> > >
> > > /* forward declarations to avoid warnings */
> > > -rtems_task Init(rtems_task_argument ignored);
> > > +rtems_task Init( rtems_task_argument ignored );
> > >
> > > /* Test Function Begins */
> > > rtems_task Init(rtems_task_argument ignored)
> > > @@ -62,28 +63,31 @@ rtems_task Init(rtems_task_argument ignored)
> > >
> > >  /*
> > >   * 'FE_ALL_EXCEPT' will be defined only when 'feclearexcept()',
> > > -   * 'fegetexceptflag()', 'feraiseexcept()', 'fesetexceptflag()' and
> > > -   * 'fetestexcept()' functions are supported by the architecture.
> > > +   * fegetexceptflag() , feraiseexcept(), fesetexceptflag() and
> > > +   * fetestexcept() functions are supported by the architecture.
> > >   * Hence their testcases can be wrapped under #ifdef and #endif.
> > >   */
> > >  #ifdef FE_ALL_EXCEPT /* floating-point exceptions */
> > >puts( "fesetenv(FE_DFL_ENV)." );
> > > -r = fesetenv(FE_DFL_ENV);
> > > -if (r)
> > > +r = fesetenv ( FE_DFL_ENV );
>
> It should be like r = fesetenv( FE_DFL_ENV).
>
> > > +if ( r ) {
> > >  printf("fesetenv ==> %d\n", r);
>
> After (, one space needed.
> > > -rtems_test_assert( r == 0 );
> > > +}
> > > +rtems_test_assert ( r == 0 );
>
> Same here, Remove this unnecessary space, assert and (.
>
> > >
> > > -/* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
> > > -puts( "feclearexcept(FE_ALL_EXCEPT)." );
> > > -r = feclearexcept(FE_ALL_EXCEPT);
> > > -if (r)
> > > +/* 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 );
> > > +}
> > > +rtems_test_assert ( r == 0 );
> > >
> Same here.
>
> > > -r = fetestexcept( FE_ALL_EXCEPT );
> > > -if (r)
> > > +r = fetestexcept ( FE_ALL_EXCEPT );
> > > +if ( r ) {
> > >  printf("fetestexcept ==> 0x%x\n", r);
> > > -rtems_test_assert( r == 0 );
> > > +}
> > > +rtems_test_assert ( r == 0 );
> > >
> > >/* Test 'FE_DIVBYZERO' */
> > >puts( "Divide by zero and confirm fetestexcept()" );
> > > @@ -91,11 +95,60 @@ rtems_task Init(rtems_task_argument ignored)
> > >b = 1.0;
> > >c = b/a;
> > >(void) c;
> > > -
> > > -fegetexceptflag(,FE_ALL_EXCEPT);
> > > -
> > > +/* Test fegetexceptflag() and fesetexceptflag() */
> > > +r = fegetexceptflag ( , FE_ALL_EXCEPT );
> > > +if ( r ) {
> > > +  printf("fegetexceptflag ==> 0x%x\n", r);
> > > +}
> > > +rtems_test_assert ( r == 0 );
> > > +
> > > +r = fesetexceptflag ( , FE_ALL_EXCEPT );
> > > +if ( r ) {
> > > +  printf("fesetexceptflag ==> 0x%x\n", r);
> > > +}
> > > +rtems_test_assert ( r == 0 );
> > > +
> > > +/* Test for fegetround() and fesetround()
> > > + * They have four main macros to be tested separated by ifdef
> > > + * Since not all architectures support them
> > > + * The test case gets and sets the rounding directions */
> > > +#ifdef FE_TONEAREST
> > > +rtems_test_assert ( fegetround() == FE_TONEAREST );
> > > +#endif
> > > +#ifdef FE_TOWARDZERO
> > > +  r = fesetround ( FE_TOWARDZERO );
> > > +  if ( r ) {
> > > +  printf("fesetround ==> 0x%x\n", r);
> > > +}
> > > +  rtems_test_assert ( r == 0 );
> > > +  rtems_test_assert ( fegetround() == FE_TOWARDZERO );
> > > +#endif
> > > +#ifdef FE_DOWNWARD
> > > +  r = fesetround ( FE_DOWNWARD );
> > > +  if ( r ) {
> > > +  printf("fesetround ==> 0x%x\n", r);
> > > +}
> > > +  rtems_test_assert ( r == 0 );
> > > +  rtems_test_assert ( fegetround() == FE_DOWNWARD );
> > > +#endif
> > > +#ifdef FE_UPWARD
> > > +  r = fesetround ( FE_UPWARD );
> > > +  if ( r ) {
> > > +  printf("fesetround ==> 0x%x\n", r);
> > > +}
> > > +  rtems_test_assert ( r == 0 );
> > > +  rtems_test_assert ( fegetround() == FE_UPWARD );
> > > +#endif
> > > +#ifdef FE_TONEAREST
> > > +  r = fesetround ( FE_TONEAREST );
> > > +  if ( r ) {
> > > +  printf("fesetround ==> 

Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Aditya Upadhyay
On Sat, Mar 21, 2020 at 9:32 PM Eshan Dhawan  wrote:
>
> I have added the changes as told by Aditya
> I would like to know is any other changes are required to be made to make the 
> patch usable
>
> Thanks
> Eshan
> > On 21-Mar-2020, at 8:20 PM, Eshan dhawan  wrote:
> >
> > ---
> > testsuites/psxtests/psxfenv01/init.c | 89 ++--
> > 1 file changed, 71 insertions(+), 18 deletions(-)
> >
> > diff --git a/testsuites/psxtests/psxfenv01/init.c 
> > b/testsuites/psxtests/psxfenv01/init.c
> > index cdb0fa596e..0ea820c523 100644
> > --- a/testsuites/psxtests/psxfenv01/init.c
> > +++ b/testsuites/psxtests/psxfenv01/init.c
> > @@ -46,11 +46,12 @@
> > #include 
> > #include 
> > #include 
> > +#include 
> >
> > const char rtems_test_name[] ="PSXFENV 01";
> >
> > /* forward declarations to avoid warnings */
> > -rtems_task Init(rtems_task_argument ignored);
> > +rtems_task Init( rtems_task_argument ignored );
> >
> > /* Test Function Begins */
> > rtems_task Init(rtems_task_argument ignored)
> > @@ -62,28 +63,31 @@ rtems_task Init(rtems_task_argument ignored)
> >
> >  /*
> >   * 'FE_ALL_EXCEPT' will be defined only when 'feclearexcept()',
> > -   * 'fegetexceptflag()', 'feraiseexcept()', 'fesetexceptflag()' and
> > -   * 'fetestexcept()' functions are supported by the architecture.
> > +   * fegetexceptflag() , feraiseexcept(), fesetexceptflag() and
> > +   * fetestexcept() functions are supported by the architecture.
> >   * Hence their testcases can be wrapped under #ifdef and #endif.
> >   */
> >  #ifdef FE_ALL_EXCEPT /* floating-point exceptions */
> >puts( "fesetenv(FE_DFL_ENV)." );
> > -r = fesetenv(FE_DFL_ENV);
> > -if (r)
> > +r = fesetenv ( FE_DFL_ENV );

It should be like r = fesetenv( FE_DFL_ENV).

> > +if ( r ) {
> >  printf("fesetenv ==> %d\n", r);

After (, one space needed.
> > -rtems_test_assert( r == 0 );
> > +}
> > +rtems_test_assert ( r == 0 );

Same here, Remove this unnecessary space, assert and (.

> >
> > -/* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
> > -puts( "feclearexcept(FE_ALL_EXCEPT)." );
> > -r = feclearexcept(FE_ALL_EXCEPT);
> > -if (r)
> > +/* 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 );
> > +}
> > +rtems_test_assert ( r == 0 );
> >
Same here.

> > -r = fetestexcept( FE_ALL_EXCEPT );
> > -if (r)
> > +r = fetestexcept ( FE_ALL_EXCEPT );
> > +if ( r ) {
> >  printf("fetestexcept ==> 0x%x\n", r);
> > -rtems_test_assert( r == 0 );
> > +}
> > +rtems_test_assert ( r == 0 );
> >
> >/* Test 'FE_DIVBYZERO' */
> >puts( "Divide by zero and confirm fetestexcept()" );
> > @@ -91,11 +95,60 @@ rtems_task Init(rtems_task_argument ignored)
> >b = 1.0;
> >c = b/a;
> >(void) c;
> > -
> > -fegetexceptflag(,FE_ALL_EXCEPT);
> > -
> > +/* Test fegetexceptflag() and fesetexceptflag() */
> > +r = fegetexceptflag ( , FE_ALL_EXCEPT );
> > +if ( r ) {
> > +  printf("fegetexceptflag ==> 0x%x\n", r);
> > +}
> > +rtems_test_assert ( r == 0 );
> > +
> > +r = fesetexceptflag ( , FE_ALL_EXCEPT );
> > +if ( r ) {
> > +  printf("fesetexceptflag ==> 0x%x\n", r);
> > +}
> > +rtems_test_assert ( r == 0 );
> > +
> > +/* Test for fegetround() and fesetround()
> > + * They have four main macros to be tested separated by ifdef
> > + * Since not all architectures support them
> > + * The test case gets and sets the rounding directions */
> > +#ifdef FE_TONEAREST
> > +rtems_test_assert ( fegetround() == FE_TONEAREST );
> > +#endif
> > +#ifdef FE_TOWARDZERO
> > +  r = fesetround ( FE_TOWARDZERO );
> > +  if ( r ) {
> > +  printf("fesetround ==> 0x%x\n", r);
> > +}
> > +  rtems_test_assert ( r == 0 );
> > +  rtems_test_assert ( fegetround() == FE_TOWARDZERO );
> > +#endif
> > +#ifdef FE_DOWNWARD
> > +  r = fesetround ( FE_DOWNWARD );
> > +  if ( r ) {
> > +  printf("fesetround ==> 0x%x\n", r);
> > +}
> > +  rtems_test_assert ( r == 0 );
> > +  rtems_test_assert ( fegetround() == FE_DOWNWARD );
> > +#endif
> > +#ifdef FE_UPWARD
> > +  r = fesetround ( FE_UPWARD );
> > +  if ( r ) {
> > +  printf("fesetround ==> 0x%x\n", r);
> > +}
> > +  rtems_test_assert ( r == 0 );
> > +  rtems_test_assert ( fegetround() == FE_UPWARD );
> > +#endif
> > +#ifdef FE_TONEAREST
> > +  r = fesetround ( FE_TONEAREST );
> > +  if ( r ) {
> > +  printf("fesetround ==> 0x%x\n", r);
> > +}
> > +  rtems_test_assert ( r == 0 );
> > +#endif
> > +
> > #ifdef FE_DIVBYZERO
> > -r = feraiseexcept(FE_DIVBYZERO);
> > +r = feraiseexcept ( FE_DIVBYZERO ) ;
> >rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
> > #endif
> >
> > --
> > 2.17.1

I would suggest you go through the existing test-cases 

Re: [PATCH v7] tests for fenv.h functions

2020-03-21 Thread Eshan Dhawan
I have added the changes as told by Aditya 
I would like to know is any other changes are required to be made to make the 
patch usable 

Thanks 
Eshan 
> On 21-Mar-2020, at 8:20 PM, Eshan dhawan  wrote:
> 
> ---
> testsuites/psxtests/psxfenv01/init.c | 89 ++--
> 1 file changed, 71 insertions(+), 18 deletions(-)
> 
> diff --git a/testsuites/psxtests/psxfenv01/init.c 
> b/testsuites/psxtests/psxfenv01/init.c
> index cdb0fa596e..0ea820c523 100644
> --- a/testsuites/psxtests/psxfenv01/init.c
> +++ b/testsuites/psxtests/psxfenv01/init.c
> @@ -46,11 +46,12 @@
> #include 
> #include 
> #include 
> +#include 
> 
> const char rtems_test_name[] ="PSXFENV 01";
> 
> /* forward declarations to avoid warnings */
> -rtems_task Init(rtems_task_argument ignored);
> +rtems_task Init( rtems_task_argument ignored );
> 
> /* Test Function Begins */
> rtems_task Init(rtems_task_argument ignored)
> @@ -62,28 +63,31 @@ rtems_task Init(rtems_task_argument ignored)
> 
>  /*
>   * 'FE_ALL_EXCEPT' will be defined only when 'feclearexcept()',
> -   * 'fegetexceptflag()', 'feraiseexcept()', 'fesetexceptflag()' and
> -   * 'fetestexcept()' functions are supported by the architecture.
> +   * fegetexceptflag() , feraiseexcept(), fesetexceptflag() and
> +   * fetestexcept() functions are supported by the architecture.
>   * Hence their testcases can be wrapped under #ifdef and #endif.
>   */
>  #ifdef FE_ALL_EXCEPT /* floating-point exceptions */
>puts( "fesetenv(FE_DFL_ENV)." );
> -r = fesetenv(FE_DFL_ENV);
> -if (r)
> +r = fesetenv ( FE_DFL_ENV );
> +if ( r ) {
>  printf("fesetenv ==> %d\n", r);
> -rtems_test_assert( r == 0 );
> +}
> +rtems_test_assert ( r == 0 );
> 
> -/* Test 'feclearexcept()' and 'fetestexcept()' in one go. */
> -puts( "feclearexcept(FE_ALL_EXCEPT)." );
> -r = feclearexcept(FE_ALL_EXCEPT);
> -if (r)
> +/* 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 );
> +}
> +rtems_test_assert ( r == 0 );
> 
> -r = fetestexcept( FE_ALL_EXCEPT );
> -if (r)
> +r = fetestexcept ( FE_ALL_EXCEPT );
> +if ( r ) {
>  printf("fetestexcept ==> 0x%x\n", r);
> -rtems_test_assert( r == 0 );
> +}
> +rtems_test_assert ( r == 0 );
> 
>/* Test 'FE_DIVBYZERO' */
>puts( "Divide by zero and confirm fetestexcept()" );
> @@ -91,11 +95,60 @@ rtems_task Init(rtems_task_argument ignored)
>b = 1.0;
>c = b/a;
>(void) c;
> -
> -fegetexceptflag(,FE_ALL_EXCEPT);
> -
> +/* Test fegetexceptflag() and fesetexceptflag() */
> +r = fegetexceptflag ( , FE_ALL_EXCEPT );
> +if ( r ) {
> +  printf("fegetexceptflag ==> 0x%x\n", r);
> +}
> +rtems_test_assert ( r == 0 );
> +
> +r = fesetexceptflag ( , FE_ALL_EXCEPT );
> +if ( r ) {
> +  printf("fesetexceptflag ==> 0x%x\n", r);
> +}
> +rtems_test_assert ( r == 0 );
> +
> +/* Test for fegetround() and fesetround()
> + * They have four main macros to be tested separated by ifdef
> + * Since not all architectures support them 
> + * The test case gets and sets the rounding directions */
> +#ifdef FE_TONEAREST
> +rtems_test_assert ( fegetround() == FE_TONEAREST );   
> +#endif
> +#ifdef FE_TOWARDZERO
> +  r = fesetround ( FE_TOWARDZERO );
> +  if ( r ) {
> +  printf("fesetround ==> 0x%x\n", r); 
> +} 
> +  rtems_test_assert ( r == 0 );
> +  rtems_test_assert ( fegetround() == FE_TOWARDZERO );
> +#endif
> +#ifdef FE_DOWNWARD
> +  r = fesetround ( FE_DOWNWARD );
> +  if ( r ) {
> +  printf("fesetround ==> 0x%x\n", r); 
> +} 
> +  rtems_test_assert ( r == 0 );
> +  rtems_test_assert ( fegetround() == FE_DOWNWARD );
> +#endif
> +#ifdef FE_UPWARD
> +  r = fesetround ( FE_UPWARD );
> +  if ( r ) {
> +  printf("fesetround ==> 0x%x\n", r); 
> +}   
> +  rtems_test_assert ( r == 0 );
> +  rtems_test_assert ( fegetround() == FE_UPWARD );
> +#endif
> +#ifdef FE_TONEAREST
> +  r = fesetround ( FE_TONEAREST );
> +  if ( r ) {
> +  printf("fesetround ==> 0x%x\n", r);
> +} 
> +  rtems_test_assert ( r == 0 );
> +#endif
> +  
> #ifdef FE_DIVBYZERO
> -r = feraiseexcept(FE_DIVBYZERO);
> +r = feraiseexcept ( FE_DIVBYZERO ) ;
>rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
> #endif
> 
> -- 
> 2.17.1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel