diff options
author | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-17 00:14:11 +0000 |
---|---|---|
committer | Erick Tryzelaar <idadesub@users.sourceforge.net> | 2009-08-17 00:14:11 +0000 |
commit | 33d7dd6dc86704c749c0b95ac512962f54e9af5a (patch) | |
tree | 701e4cd7df71f1d21b85d92e4292baefa12bfdc2 /unittests | |
parent | 45d6ac2cc13f7881687c2d7f03f9b9892fd85e6e (diff) | |
download | external_llvm-33d7dd6dc86704c749c0b95ac512962f54e9af5a.zip external_llvm-33d7dd6dc86704c749c0b95ac512962f54e9af5a.tar.gz external_llvm-33d7dd6dc86704c749c0b95ac512962f54e9af5a.tar.bz2 |
Change APFloatTest from using ASSERTs to EXPECTs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/APFloatTest.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp index 952e7a4..9778e27 100644 --- a/unittests/ADT/APFloatTest.cpp +++ b/unittests/ADT/APFloatTest.cpp @@ -18,89 +18,89 @@ using namespace llvm; namespace { TEST(APFloatTest, Zero) { - ASSERT_EQ(0.0f, APFloat(APFloat::IEEEsingle, 0.0f).convertToFloat()); - ASSERT_EQ(-0.0f, APFloat(APFloat::IEEEsingle, -0.0f).convertToFloat()); + EXPECT_EQ(0.0f, APFloat(APFloat::IEEEsingle, 0.0f).convertToFloat()); + EXPECT_EQ(-0.0f, APFloat(APFloat::IEEEsingle, -0.0f).convertToFloat()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, 0.0).convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, -0.0).convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, 0.0).convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, -0.0).convertToDouble()); } TEST(APFloatTest, SemanticsDeath) { - ASSERT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, 0.0 ).convertToFloat(), "Float semantics are not IEEEsingle"); + EXPECT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, 0.0 ).convertToFloat(), "Float semantics are not IEEEsingle"); } TEST(APFloatTest, fromString) { - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".0").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.0").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "00000.").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0000.00000").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".00000").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e+1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e-1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e0").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-0").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.0").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "00000.").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0000.00000").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".00000").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e+1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.e-1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-0").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0p1").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0p1234").convertToDouble()); - ASSERT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0p1").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0p1234").convertToDouble()); + EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble()); - ASSERT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1\02", 3)).convertToDouble()); + EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1\02", 3)).convertToDouble()); } TEST(APFloatTest, StringDeath) { - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, ""), "Invalid string length"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "-"), "String is only a minus!"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0x"), "Invalid string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "."), "String cannot be just a dot"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "-."), "String cannot be just a dot"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0x."), "String cannot be just a dot"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "-0x."),"String cannot be just a dot"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0x0"), "Hex strings require an exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0e"), "Exponent has no digits"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0e+"), "Exponent has no digits"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0e-"), "Exponent has no digits"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ""), "Invalid string length"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-"), "String is only a minus!"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x"), "Invalid string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "."), "String cannot be just a dot"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-."), "String cannot be just a dot"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x."), "String cannot be just a dot"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x."),"String cannot be just a dot"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0"), "Hex strings require an exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0e"), "Exponent has no digits"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0e+"), "Exponent has no digits"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0e-"), "Exponent has no digits"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("\0", 1)), "Invalid character in digit string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\0", 2)), "Invalid character in digit string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02", 3)), "Invalid character in digit string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02e1", 5)), "Invalid character in digit string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e\0", 3)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\0", 4)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\02", 5)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("\0", 1)), "Invalid character in digit string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\0", 2)), "Invalid character in digit string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02", 3)), "Invalid character in digit string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02e1", 5)), "Invalid character in digit string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e\0", 3)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\0", 4)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\02", 5)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "1.0f"), "Invalid character in digit string"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0f"), "Invalid character in digit string"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x\0", 3)), "Hex strings require an exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\0", 4)), "Hex strings require an exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02", 5)), "Hex strings require an exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02p1", 7)), "Hex strings require an exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p\0", 5)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\0", 6)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\02", 7)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x\0", 3)), "Hex strings require an exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\0", 4)), "Hex strings require an exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02", 5)), "Hex strings require an exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02p1", 7)), "Hex strings require an exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p\0", 5)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\0", 6)), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\02", 7)), "Invalid character in exponent"); - ASSERT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p0f"), "Invalid character in exponent"); + EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p0f"), "Invalid character in exponent"); } } |