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//===----------------------------------------------------------------------===//
8
9#include "hdr/types/fenv_t.h"
10#include "src/fenv/feupdateenv.h"
11
12#include "src/__support/FPUtil/FEnvImpl.h"
13#include "test/UnitTest/FEnvSafeTest.h"
14#include "test/UnitTest/Test.h"
15
16using LlvmLibcFEnvTest = LIBC_NAMESPACE::testing::FEnvSafeTest;
17
18TEST_F(LlvmLibcFEnvTest, UpdateEnvTest) {
19 LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT);
20 LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);
21
22 fenv_t env;
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);
28}
29

source code of libc/test/src/fenv/feupdateenv_test.cpp