diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-03 22:57:02 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-03 22:57:02 +0000 |
commit | 83fecfa42ce0453a723d37fa46e23c391e4bd6a3 (patch) | |
tree | 25212128e6e89f7d541046ff1fd4e9faba34962c /unittests | |
parent | 3d45a853db014fdddcdb79424e663dfed5eccbc7 (diff) | |
download | external_llvm-83fecfa42ce0453a723d37fa46e23c391e4bd6a3.zip external_llvm-83fecfa42ce0453a723d37fa46e23c391e4bd6a3.tar.gz external_llvm-83fecfa42ce0453a723d37fa46e23c391e4bd6a3.tar.bz2 |
Add test for PR4873, which works for me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/APFloatTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp index 7928d7e..92f020b 100644 --- a/unittests/ADT/APFloatTest.cpp +++ b/unittests/ADT/APFloatTest.cpp @@ -15,6 +15,12 @@ using namespace llvm; +static double convertToDoubleFromString(const char *Str) { + llvm::APFloat F(0.0); + F.convertFromString(Str, llvm::APFloat::rmNearestTiesToEven); + return F.convertToDouble(); +} + namespace { TEST(APFloatTest, Zero) { @@ -303,6 +309,8 @@ TEST(APFloatTest, fromHexadecimalString) { EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble()); EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble()); + + EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828")); } #ifdef GTEST_HAS_DEATH_TEST |