[PATCH v1] added test for fegetexeptflag and fesetexeptflag
Eshan dhawan
eshandhawan51 at gmail.com
Mon Feb 24 15:47:46 UTC 2020
---
testsuites/psxtests/psxfenv01/init.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/testsuites/psxtests/psxfenv01/init.c b/testsuites/psxtests/psxfenv01/init.c
index 8ffb9395b9..05f3cdc880 100644
--- a/testsuites/psxtests/psxfenv01/init.c
+++ b/testsuites/psxtests/psxfenv01/init.c
@@ -47,8 +47,9 @@
#include <rtems/test.h>
#include <tmacros.h>
#include <assert.h>
+#include <float.h>
+
-#define rtems_test_assert(x) assert(x)
const char rtems_test_name[] = "PSXFENV 01";
@@ -74,19 +75,19 @@ rtems_task Init(rtems_task_argument ignored)
r = fesetenv(FE_DFL_ENV);
if (r)
printf("fesetenv ==> %d\n", r);
- 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)
printf("feclearexcept ==> 0x%x\n", r);
- assert( r == 0 );
+ rtems_test_assert( r == 0 );
r = fetestexcept( FE_ALL_EXCEPT );
if (r)
printf("fetestexcept ==> 0x%x\n", r);
- assert( r == 0 );
+ rtems_test_assert( r == 0 );
/* Test 'FE_DIVBYZERO' */
puts( "Divide by zero and confirm fetestexcept()" );
@@ -98,18 +99,19 @@ rtems_task Init(rtems_task_argument ignored)
r=fegetexceptflag(&excepts,FE_ALL_EXCEPT);
if(r)
printf("fegetexceptflag ==> 0x%x\n", r);
- assert(r == 0);
+ rtems_test_assert(r == 0);
r=fesetexceptflag(&excepts, FE_ALL_EXCEPT);
if(r)
printf("fesetexceptflag ==> 0x%x\n", r);
- assert(r == 0);
+ rtems_test_assert(r == 0);
+
#ifdef FE_DIVBYZERO
r = feraiseexcept(FE_DIVBYZERO);
- assert( fetestexcept( FE_DIVBYZERO ) );
+ rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
#endif
/* Test 'FE_INEXACT' */
@@ -140,14 +142,3 @@ rtems_task Init(rtems_task_argument ignored)
/* end of file */
-/*
- fegetenv()
-
- fegetround()
- feholdexcept()
-
- fesetexceptflag()
- fesetround()
-
- feupdateenv()
-*/
--
2.17.1
More information about the devel
mailing list