usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-fenv.c
blob1698299edd9133d901e04c4f09d43c6a845b1673
1 /* Test of <fenv.h> substitute.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2023. */
19 #include <config.h>
21 /* Specification. */
22 #include <fenv.h>
24 #include "verify.h"
26 /* Check that the various FE_* macros are defined. */
27 int r[] =
29 #ifdef FE_DOWNWARD
30 FE_DOWNWARD,
31 #endif
32 #ifdef FE_UPWARD
33 FE_UPWARD,
34 #endif
35 #ifdef FE_TOWARDZERO
36 FE_TOWARDZERO,
37 #endif
38 FE_TONEAREST
40 int e[] = { FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW, FE_UNDERFLOW };
42 /* Check that the types are all defined. */
43 fenv_t t1;
44 fexcept_t t2;
46 /* On many platforms, other FE_* constants are included in FE_ALL_EXCEPT,
47 therefore in general
48 FE_ALL_EXCEPT == (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
49 does not hold. */
50 verify (((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
51 & ~FE_ALL_EXCEPT)
52 == 0);
54 int
55 main (void)
57 /* Ensure no overlap in FE_*. */
58 switch (FE_INVALID)
60 case FE_DIVBYZERO:
61 case FE_INEXACT:
62 case FE_INVALID:
63 case FE_OVERFLOW:
64 case FE_UNDERFLOW:
68 return 0;