[llvm] r182896 - Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.

Michael Gottesman mgottesman at apple.com
Wed May 29 17:18:44 PDT 2013


Author: mgottesman
Date: Wed May 29 19:18:44 2013
New Revision: 182896

URL: http://llvm.org/viewvc/llvm-project?rev=182896&view=rev
Log:
Added code to the unittest for APFloat::getSmallest to double check that we consider the result to be denormal.

I additionally changed certain checks to use EXPECT_FALSE instead of a boolean
complement with EXPECT_TRUE.

Modified:
    llvm/trunk/unittests/ADT/APFloatTest.cpp

Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=182896&r1=182895&r2=182896&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/APFloatTest.cpp (original)
+++ llvm/trunk/unittests/ADT/APFloatTest.cpp Wed May 29 19:18:44 2013
@@ -797,26 +797,30 @@ TEST(APFloatTest, getLargest) {
 TEST(APFloatTest, getSmallest) {
   APFloat test = APFloat::getSmallest(APFloat::IEEEsingle, false);
   APFloat expected = APFloat(APFloat::IEEEsingle, "0x0.000002p-126");
-  EXPECT_TRUE(!test.isNegative());
+  EXPECT_FALSE(test.isNegative());
   EXPECT_TRUE(test.isNormal());
+  EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
 
   test = APFloat::getSmallest(APFloat::IEEEsingle, true);
   expected = APFloat(APFloat::IEEEsingle, "-0x0.000002p-126");
   EXPECT_TRUE(test.isNegative());
   EXPECT_TRUE(test.isNormal());
+  EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
 
   test = APFloat::getSmallest(APFloat::IEEEquad, false);
   expected = APFloat(APFloat::IEEEquad, "0x0.0000000000000000000000000001p-16382");
-  EXPECT_TRUE(!test.isNegative());
+  EXPECT_FALSE(test.isNegative());
   EXPECT_TRUE(test.isNormal());
+  EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));
 
   test = APFloat::getSmallest(APFloat::IEEEquad, true);
   expected = APFloat(APFloat::IEEEquad, "-0x0.0000000000000000000000000001p-16382");
   EXPECT_TRUE(test.isNegative());
   EXPECT_TRUE(test.isNormal());
+  EXPECT_TRUE(test.isDenormal());
   EXPECT_TRUE(test.bitwiseIsEqual(expected));  
 }
 





More information about the llvm-commits mailing list