1 /* Test return value when setting FE_NOMASK_ENV (BZ16918, BZ17009).
2 Copyright (C) 2014-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
21 #include <math-tests.h>
23 static int count_errors
;
26 test_feenableexcept (void)
28 #if defined FE_ALL_EXCEPT
31 fedisableexcept (FE_ALL_EXCEPT
);
33 res
= feenableexcept (FE_ALL_EXCEPT
);
35 if (!EXCEPTION_ENABLE_SUPPORTED (FE_ALL_EXCEPT
) && (res
== -1))
37 puts ("feenableexcept (FE_ALL_EXCEPT) not supported, cannot test.");
42 puts ("feenableexcept (FE_ALL_EXCEPT) failed");
46 if (fegetexcept () != FE_ALL_EXCEPT
)
48 puts ("feenableexcept did not set all exceptions");
57 #if defined FE_NOMASK_ENV && defined FE_ALL_EXCEPT
60 fedisableexcept (FE_ALL_EXCEPT
);
62 res
= fesetenv (FE_NOMASK_ENV
);
64 if (!EXCEPTION_ENABLE_SUPPORTED (FE_ALL_EXCEPT
) && (res
!= 0))
66 puts ("fesetenv (FE_NOMASK_ENV) not supported, cannot test.");
71 puts ("fesetenv (FE_NOMASK_ENV) failed");
75 if (fegetexcept () != FE_ALL_EXCEPT
)
77 puts ("fesetenv did not set all exceptions");
84 test_feupdateenv (void)
86 #if defined FE_NOMASK_ENV && defined FE_ALL_EXCEPT
89 fedisableexcept (FE_ALL_EXCEPT
);
91 res
= feupdateenv (FE_NOMASK_ENV
);
93 if (!EXCEPTION_ENABLE_SUPPORTED (FE_ALL_EXCEPT
) && (res
!= 0))
95 puts ("feupdateenv (FE_NOMASK_ENV)) not supported, cannot test.");
100 puts ("feupdateenv (FE_NOMASK_ENV) failed");
104 if (fegetexcept () != FE_ALL_EXCEPT
)
106 puts ("feupdateenv did not set all exceptions");
115 test_feenableexcept ();
119 return count_errors
!= 0 ? 1 : 0;
122 #define TEST_FUNCTION do_test ()
123 #include "../test-skeleton.c"