Fix a test that wasn't testing the right thing.

The APFloat "Zero" test was actually calling the
APFloat(const fltSemantics &, integerPart) constructor, and EXPECT_EQ was
treating 0 and -0 as equal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138745 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Beaumont-Gay 2011-08-29 17:54:20 +00:00
parent 41dfabb0e3
commit 9d74909378

View File

@ -34,11 +34,13 @@ static std::string convertToString(double d, unsigned Prec, unsigned Pad) {
namespace {
TEST(APFloatTest, Zero) {
EXPECT_EQ(0.0f, APFloat(APFloat::IEEEsingle, 0.0f).convertToFloat());
EXPECT_EQ(-0.0f, APFloat(APFloat::IEEEsingle, -0.0f).convertToFloat());
EXPECT_EQ(0.0f, APFloat(0.0f).convertToFloat());
EXPECT_EQ(-0.0f, APFloat(-0.0f).convertToFloat());
EXPECT_TRUE(APFloat(-0.0f).isNegative());
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, 0.0).convertToDouble());
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, -0.0).convertToDouble());
EXPECT_EQ(0.0, APFloat(0.0).convertToDouble());
EXPECT_EQ(-0.0, APFloat(-0.0).convertToDouble());
EXPECT_TRUE(APFloat(-0.0).isNegative());
}
TEST(APFloatTest, fromZeroDecimalString) {