aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2011-08-29 17:54:20 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2011-08-29 17:54:20 +0000
commit9d74909378eb084ab55f407d134fb68f25c803a0 (patch)
treeea67ce9e0e8fbe8fa8244aa01c70db159c880e1b /unittests
parent41dfabb0e301f319550731d46ba24a79b9fb0fdb (diff)
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
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/APFloatTest.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp
index 08ac2a0525..3c40a13d36 100644
--- a/unittests/ADT/APFloatTest.cpp
+++ b/unittests/ADT/APFloatTest.cpp
@@ -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) {