[PATCH] test for fegetround and fesetround

Eshan Dhawan eshandhawan51 at gmail.com
Mon Mar 2 18:11:02 UTC 2020


On Mon, Mar 2, 2020 at 9:38 PM Gedare Bloom <gedare at rtems.org> wrote:

> On Tue, Feb 25, 2020 at 7:56 AM Eshan dhawan <eshandhawan51 at gmail.com>
> wrote:
> >
> > ---
> >  testsuites/psxtests/psxfenv01/init.c | 42 +++++++++++++++++++++++++++-
> >  1 file changed, 41 insertions(+), 1 deletion(-)
> >
> > diff --git a/testsuites/psxtests/psxfenv01/init.c
> b/testsuites/psxtests/psxfenv01/init.c
> > index 05f3cdc880..4339139c58 100644
> > --- a/testsuites/psxtests/psxfenv01/init.c
> > +++ b/testsuites/psxtests/psxfenv01/init.c
> > @@ -106,7 +106,47 @@ rtems_task Init(rtems_task_argument ignored)
> >        printf("fesetexceptflag ==> 0x%x\n", r);
> >      rtems_test_assert(r == 0);
>


> >Similarly, the ability to trigger coverity scan on a
>

How to do that, could you guide me through

thanks

> > -
> > +
> > +    /*test for fegetround() and fesetround()*/
> add white space around text
>
> > +    /*they have four main macros to be tested seperated by ifdef*/
> typo: separated
>
> > +    /* since all the architectures dont support them */
> typo: don't
> grammer: "since not all architectures support them" would be better.
> "all the architectures don't support them" means there is no support
> at all.
>
> > +    /*the test cases gets and sets the rounding directions */
> typo: case
>
> > +#ifdef FE_TONEAREST
> > +
> no blank line needed/wanted after #ifdef statements
> > +    r=fegetround();
>
> whitespace needed around =. Please review
> https://docs.rtems.org/branches/master/eng/coding.html
>
> > +    if(r)
> whitespace needed, and brackets needed even for 1-line blocks.
>
> > +       printf("fegetround ==> 0x%x\n", r);
> > +    rtems_test_assert(r == FE_TONEAREST) ;
> > +#endif
> > +#ifdef FE_TOWARDZERO
> > +
> The same errors from above repeat here and below. fix all.
>
> > +  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
> > --
> > 2.17.1
> >
> > _______________________________________________
> > 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/20200302/4ada199f/attachment.html>


More information about the devel mailing list