llvm/libc/test/src/fenv/getenv_and_setenv_test.cpp

//===-- Unittests for fegetenv and fesetenv -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "hdr/types/fenv_t.h"
#include "src/fenv/fegetenv.h"
#include "src/fenv/fegetround.h"
#include "src/fenv/fesetenv.h"
#include "src/fenv/fesetround.h"

#include "src/__support/FPUtil/FEnvImpl.h"
#include "test/UnitTest/FEnvSafeTest.h"
#include "test/UnitTest/Test.h"

#include "excepts.h"

LlvmLibcFEnvTest;

TEST_F(LlvmLibcFEnvTest, GetEnvAndSetEnv) {}

TEST_F(LlvmLibcFEnvTest, Set_FE_DFL_ENV) {}

#ifdef _WIN32
TEST_F(LlvmLibcFEnvTest, Windows_Set_Get_Test) {
  // If a valid fenv_t is written, then reading it back out should be identical.
  fenv_t setEnv = {0x7e00053e, 0x0f00000f};
  fenv_t getEnv;
  ASSERT_EQ(LIBC_NAMESPACE::fesetenv(&setEnv), 0);
  ASSERT_EQ(LIBC_NAMESPACE::fegetenv(&getEnv), 0);

  ASSERT_EQ(setEnv._Fe_ctl, getEnv._Fe_ctl);
  ASSERT_EQ(setEnv._Fe_stat, getEnv._Fe_stat);
}
#endif