Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libc / test / src / fenv / feupdateenv_test.cpp
blob96f253f76077a0f24db26c1bcba2aabc23e71482
1 //===-- Unittests for feupdateenv -----------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "src/fenv/feupdateenv.h"
11 #include "src/__support/FPUtil/FEnvImpl.h"
12 #include "test/UnitTest/Test.h"
14 #include <fenv.h>
15 #include <signal.h>
17 TEST(LlvmLibcFEnvTest, UpdateEnvTest) {
18 LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
19 LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
21 fenv_t env;
22 ASSERT_EQ(LIBC_NAMESPACE::fputil::get_env(&env), 0);
23 LIBC_NAMESPACE::fputil::set_except(FE_INVALID | FE_INEXACT);
24 ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env), 0);
25 ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID | FE_INEXACT),
26 FE_INVALID | FE_INEXACT);