[PATCH v2 4/4] test for fenv.h functions

Eshan dhawan eshandhawan51 at gmail.com
Tue Mar 3 19:49:54 UTC 2020


---
 testsuites/psxtests/psxfenv01/init.c | 75 +++++++++++++++++-----------
 1 file changed, 46 insertions(+), 29 deletions(-)

diff --git a/testsuites/psxtests/psxfenv01/init.c b/testsuites/psxtests/psxfenv01/init.c
index 4339139c58..dc9ec3c766 100644
--- a/testsuites/psxtests/psxfenv01/init.c
+++ b/testsuites/psxtests/psxfenv01/init.c
@@ -74,19 +74,25 @@ rtems_task Init(rtems_task_argument ignored)
     puts( "fesetenv(FE_DFL_ENV)." );
     r = fesetenv(FE_DFL_ENV);
     if (r)
-      printf("fesetenv ==> %d\n", r);
+      {
+        printf("fesetenv ==> %d\n", r);
+      }
     rtems_test_assert( r == 0 );
 
     /* 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 );
 
     r = fetestexcept( FE_ALL_EXCEPT );
     if (r)
-      printf("fetestexcept ==> 0x%x\n", r);
+     {
+        printf("fetestexcept ==> 0x%x\n", r);
+     }
     rtems_test_assert( r == 0 );
 
     /* Test 'FE_DIVBYZERO' */
@@ -95,56 +101,67 @@ 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);
-    if(r)
-      printf("fegetexceptflag ==> 0x%x\n", r);
+    /* Test 'fegetexceptflag()' and 'fesetexceptflag()'. */
+    r = fegetexceptflag(&excepts,FE_ALL_EXCEPT);
+    if (r)
+    {
+       printf("fegetexceptflag ==> 0x%x\n", r);
+    }
     rtems_test_assert(r == 0);
 
-    r=fesetexceptflag(&excepts, FE_ALL_EXCEPT);
-    if(r)
+    r = fesetexceptflag(&excepts, 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 seperated by ifdef*/
-    /* since all the architectures dont support them */
-    /*the test cases gets and sets the rounding directions */
+    /* 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
-    
-    r=fegetround();
-    if(r)
+    r = fegetround();
+    if (r)
+    {
        printf("fegetround ==> 0x%x\n", r);
+    }
     rtems_test_assert(r == FE_TONEAREST) ;   
 #endif
 #ifdef FE_TOWARDZERO    
-
-  r=fesetround(FE_TOWARDZERO);
-  if(r)
-       printf("fesetround ==> 0x%x\n", r);     
+  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);     
+  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);     
+  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);     
+  r = fesetround(FE_TONEAREST);
+  if (r)
+      { 
+        printf("fesetround ==> 0x%x\n", r);
+      }     
   rtems_test_assert(r == 0) ;
 #endif
 
-- 
2.17.1



More information about the devel mailing list