llvm/llvm/unittests/ADT/APFloatTest.cpp

//===- llvm/unittest/ADT/APFloat.cpp - APFloat unit tests ---------------------===//
//
// 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 "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
#include "gtest/gtest.h"
#include <cmath>
#include <ostream>
#include <string>
#include <tuple>

usingnamespacellvm;

static std::string convertToErrorFromString(StringRef Str) {}

static double convertToDoubleFromString(StringRef Str) {}

static std::string convertToString(double d, unsigned Prec, unsigned Pad,
                                   bool Tr = true) {}

namespace {

TEST(APFloatTest, isSignaling) {}

TEST(APFloatTest, next) {}

TEST(APFloatTest, FMA) {}

TEST(APFloatTest, MinNum) {}

TEST(APFloatTest, MaxNum) {}

TEST(APFloatTest, Minimum) {}

TEST(APFloatTest, Maximum) {}

TEST(APFloatTest, MinimumNumber) {}

TEST(APFloatTest, MaximumNumber) {}

TEST(APFloatTest, Denormal) {}

TEST(APFloatTest, IsSmallestNormalized) {}

TEST(APFloatTest, Zero) {}

TEST(APFloatTest, DecimalStringsWithoutNullTerminators) {}

TEST(APFloatTest, fromZeroDecimalString) {}

TEST(APFloatTest, fromZeroDecimalSingleExponentString) {}

TEST(APFloatTest, fromZeroDecimalLargeExponentString) {}

TEST(APFloatTest, fromZeroHexadecimalString) {}

TEST(APFloatTest, fromDecimalString) {}

TEST(APFloatTest, fromStringSpecials) {}

TEST(APFloatTest, fromToStringSpecials) {}

TEST(APFloatTest, fromHexadecimalString) {}

TEST(APFloatTest, toString) {}

TEST(APFloatTest, toInteger) {}

static APInt nanbitsFromAPInt(const fltSemantics &Sem, bool SNaN, bool Negative,
                              uint64_t payload) {}

TEST(APFloatTest, makeNaN) {}

#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(APFloatTest, SemanticsDeath) {
  EXPECT_DEATH(APFloat(APFloat::IEEEquad(), 0).convertToDouble(),
               "Float semantics is not representable by IEEEdouble");
  EXPECT_DEATH(APFloat(APFloat::IEEEdouble(), 0).convertToFloat(),
               "Float semantics is not representable by IEEEsingle");
}
#endif
#endif

TEST(APFloatTest, StringDecimalError) {}

TEST(APFloatTest, StringDecimalSignificandError) {}

TEST(APFloatTest, StringHexadecimalError) {}

TEST(APFloatTest, StringHexadecimalSignificandError) {}

TEST(APFloatTest, StringHexadecimalExponentError) {}

TEST(APFloatTest, exactInverse) {}

TEST(APFloatTest, roundToIntegral) {}

TEST(APFloatTest, isInteger) {}

TEST(DoubleAPFloatTest, isInteger) {}

// Test to check if the full range of Float8E8M0FNU
// values are being represented correctly.
TEST(APFloatTest, Float8E8M0FNUValues) {}

TEST(APFloatTest, getLargest) {}

TEST(APFloatTest, getSmallest) {}

TEST(APFloatTest, getSmallestNormalized) {}

TEST(APFloatTest, getZero) {}

TEST(APFloatTest, copySign) {}

TEST(APFloatTest, convert) {}

TEST(APFloatTest, Float8UZConvert) {}

TEST(APFloatTest, PPCDoubleDouble) {}

TEST(APFloatTest, isNegative) {}

TEST(APFloatTest, isNormal) {}

TEST(APFloatTest, isFinite) {}

TEST(APFloatTest, isInfinity) {}

TEST(APFloatTest, isNaN) {}

TEST(APFloatTest, isFiniteNonZero) {}

TEST(APFloatTest, add) {}

TEST(APFloatTest, subtract) {}

TEST(APFloatTest, multiply) {}

TEST(APFloatTest, divide) {}

TEST(APFloatTest, operatorOverloads) {}

TEST(APFloatTest, Comparisons) {}

TEST(APFloatTest, abs) {}

TEST(APFloatTest, neg) {}

TEST(APFloatTest, ilogb) {}

TEST(APFloatTest, scalbn) {}

TEST(APFloatTest, frexp) {}

TEST(APFloatTest, mod) {}

TEST(APFloatTest, remainder) {}

TEST(APFloatTest, PPCDoubleDoubleAddSpecial) {}

TEST(APFloatTest, PPCDoubleDoubleAdd) {}

TEST(APFloatTest, PPCDoubleDoubleSubtract) {}

TEST(APFloatTest, PPCDoubleDoubleMultiplySpecial) {}

TEST(APFloatTest, PPCDoubleDoubleMultiply) {}

TEST(APFloatTest, PPCDoubleDoubleDivide) {}

TEST(APFloatTest, PPCDoubleDoubleRemainder) {}

TEST(APFloatTest, PPCDoubleDoubleMod) {}

TEST(APFloatTest, PPCDoubleDoubleFMA) {}

TEST(APFloatTest, PPCDoubleDoubleRoundToIntegral) {}

TEST(APFloatTest, PPCDoubleDoubleCompare) {}

TEST(APFloatTest, PPCDoubleDoubleBitwiseIsEqual) {}

TEST(APFloatTest, PPCDoubleDoubleHashValue) {}

TEST(APFloatTest, PPCDoubleDoubleChangeSign) {}

TEST(APFloatTest, PPCDoubleDoubleFactories) {}

TEST(APFloatTest, PPCDoubleDoubleIsDenormal) {}

TEST(APFloatTest, PPCDoubleDoubleScalbn) {}

TEST(APFloatTest, PPCDoubleDoubleFrexp) {}

TEST(APFloatTest, x87Largest) {}

TEST(APFloatTest, x87Next) {}

TEST(APFloatTest, Float8ExhaustivePair) {}

TEST(APFloatTest, Float8E8M0FNUExhaustivePair) {}

TEST(APFloatTest, Float6ExhaustivePair) {}

TEST(APFloatTest, Float4ExhaustivePair) {}

TEST(APFloatTest, ConvertE4M3FNToE5M2) {}

TEST(APFloatTest, ConvertE5M2ToE4M3FN) {}

TEST(APFloatTest, Float8E4M3FNGetInf) {}

TEST(APFloatTest, Float8E4M3FNFromString) {}

TEST(APFloatTest, Float8E4M3FNAdd) {}

TEST(APFloatTest, Float8E4M3FNDivideByZero) {}

TEST(APFloatTest, Float8E4M3FNNext) {}

TEST(APFloatTest, Float8E4M3FNExhaustive) {}

TEST(APFloatTest, Float8E8M0FNUExhaustive) {}

TEST(APFloatTest, Float8E5M2FNUZNext) {}

TEST(APFloatTest, Float8E5M2FNUZChangeSign) {}

TEST(APFloatTest, Float8E5M2FNUZFromString) {}

TEST(APFloatTest, UnsignedZeroArithmeticSpecial) {}

TEST(APFloatTest, Float8E5M2FNUZAdd) {}

TEST(APFloatTest, Float8E5M2FNUZDivideByZero) {}

TEST(APFloatTest, Float8UnsignedZeroExhaustive) {}

TEST(APFloatTest, Float8E4M3FNUZNext) {}

TEST(APFloatTest, Float8E4M3FNUZChangeSign) {}

TEST(APFloatTest, Float8E4M3FNUZFromString) {}

TEST(APFloatTest, Float8E4M3FNUZAdd) {}

TEST(APFloatTest, Float8E4M3FNUZDivideByZero) {}

TEST(APFloatTest, ConvertE5M2FNUZToE4M3FNUZ) {}

TEST(APFloatTest, ConvertE4M3FNUZToE5M2FNUZ) {}

TEST(APFloatTest, F8ToString) {}

TEST(APFloatTest, BitsToF8ToBits) {}

TEST(APFloatTest, F8ToBitsToF8) {}

TEST(APFloatTest, IEEEdoubleToDouble) {}

TEST(APFloatTest, IEEEsingleToDouble) {}

TEST(APFloatTest, IEEEhalfToDouble) {}

TEST(APFloatTest, BFloatToDouble) {}

TEST(APFloatTest, Float8E5M2ToDouble) {}

TEST(APFloatTest, Float8E4M3ToDouble) {}

TEST(APFloatTest, Float8E4M3FNToDouble) {}

TEST(APFloatTest, Float8E5M2FNUZToDouble) {}

TEST(APFloatTest, Float8E4M3FNUZToDouble) {}

TEST(APFloatTest, Float8E3M4ToDouble) {}

TEST(APFloatTest, FloatTF32ToDouble) {}

TEST(APFloatTest, Float8E5M2FNUZToFloat) {}

TEST(APFloatTest, Float8E4M3FNUZToFloat) {}

TEST(APFloatTest, IEEEsingleToFloat) {}

TEST(APFloatTest, IEEEhalfToFloat) {}

TEST(APFloatTest, BFloatToFloat) {}

TEST(APFloatTest, Float8E5M2ToFloat) {}

TEST(APFloatTest, Float8E4M3ToFloat) {}

TEST(APFloatTest, Float8E4M3FNToFloat) {}

TEST(APFloatTest, Float8E3M4ToFloat) {}

TEST(APFloatTest, FloatTF32ToFloat) {}

TEST(APFloatTest, getExactLog2) {}

TEST(APFloatTest, Float8E8M0FNUGetZero) {}

TEST(APFloatTest, Float8E8M0FNUGetSignedValues) {}

TEST(APFloatTest, Float8E8M0FNUGetInf) {}

TEST(APFloatTest, Float8E8M0FNUFromString) {}

TEST(APFloatTest, Float8E8M0FNUDivideByZero) {}

TEST(APFloatTest, Float8E8M0FNUGetExactLog2) {}

TEST(APFloatTest, Float8E8M0FNUSmallest) {}

TEST(APFloatTest, Float8E8M0FNUNext) {}

TEST(APFloatTest, Float8E8M0FNUFMA) {}

TEST(APFloatTest, ConvertDoubleToE8M0FNU) {}

TEST(APFloatTest, Float6E3M2FNFromString) {}

TEST(APFloatTest, Float6E2M3FNFromString) {}

TEST(APFloatTest, Float4E2M1FNFromString) {}

TEST(APFloatTest, ConvertE3M2FToE2M3F) {}

TEST(APFloatTest, ConvertE2M3FToE3M2F) {}

TEST(APFloatTest, ConvertDoubleToE2M1F) {}

TEST(APFloatTest, Float6E3M2FNNext) {}

TEST(APFloatTest, Float6E2M3FNNext) {}

TEST(APFloatTest, Float4E2M1FNNext) {}

#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(APFloatTest, Float6E3M2FNGetInfNaN) {
  EXPECT_DEATH(APFloat::getInf(APFloat::Float6E3M2FN()),
               "This floating point format does not support Inf");
  EXPECT_DEATH(APFloat::getNaN(APFloat::Float6E3M2FN()),
               "This floating point format does not support NaN");
}

TEST(APFloatTest, Float6E2M3FNGetInfNaN) {
  EXPECT_DEATH(APFloat::getInf(APFloat::Float6E2M3FN()),
               "This floating point format does not support Inf");
  EXPECT_DEATH(APFloat::getNaN(APFloat::Float6E2M3FN()),
               "This floating point format does not support NaN");
}

TEST(APFloatTest, Float4E2M1FNGetInfNaN) {
  EXPECT_DEATH(APFloat::getInf(APFloat::Float4E2M1FN()),
               "This floating point format does not support Inf");
  EXPECT_DEATH(APFloat::getNaN(APFloat::Float4E2M1FN()),
               "This floating point format does not support NaN");
}
#endif
#endif

TEST(APFloatTest, Float6E3M2FNToDouble) {}

TEST(APFloatTest, Float6E2M3FNToDouble) {}

TEST(APFloatTest, Float4E2M1FNToDouble) {}

TEST(APFloatTest, Float6E3M2FNToFloat) {}

TEST(APFloatTest, Float6E2M3FNToFloat) {}

TEST(APFloatTest, Float4E2M1FNToFloat) {}
} // namespace