1 //===-- Unittests for feupdateenv -----------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "hdr/types/fenv_t.h"
10 #include "src/fenv/feupdateenv.h"
12 #include "src/__support/FPUtil/FEnvImpl.h"
13 #include "test/UnitTest/FEnvSafeTest.h"
14 #include "test/UnitTest/Test.h"
16 using LlvmLibcFEnvTest
= LIBC_NAMESPACE::testing::FEnvSafeTest
;
18 TEST_F(LlvmLibcFEnvTest
, UpdateEnvTest
) {
19 LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT
);
20 LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT
);
23 ASSERT_EQ(LIBC_NAMESPACE::fputil::get_env(&env
), 0);
24 LIBC_NAMESPACE::fputil::set_except(FE_INVALID
| FE_INEXACT
);
25 ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env
), 0);
26 ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID
| FE_INEXACT
),
27 FE_INVALID
| FE_INEXACT
);