aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2009-08-17 00:55:33 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2009-08-17 00:55:33 +0000
commit2ad40a3663cb06c5f6d89a22933e22dc8b985574 (patch)
tree995ff3aabd8e4221ca831fea4b0cfdd85bdb10b7 /unittests
parent33d7dd6dc86704c749c0b95ac512962f54e9af5a (diff)
downloadexternal_llvm-2ad40a3663cb06c5f6d89a22933e22dc8b985574.zip
external_llvm-2ad40a3663cb06c5f6d89a22933e22dc8b985574.tar.gz
external_llvm-2ad40a3663cb06c5f6d89a22933e22dc8b985574.tar.bz2
Wrap unit test death tests in GTEST_HAS_DEATH_TEST
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/APFloatTest.cpp12
-rw-r--r--unittests/ADT/APIntTest.cpp2
2 files changed, 9 insertions, 5 deletions
diff --git a/unittests/ADT/APFloatTest.cpp b/unittests/ADT/APFloatTest.cpp
index 9778e27..b97810b 100644
--- a/unittests/ADT/APFloatTest.cpp
+++ b/unittests/ADT/APFloatTest.cpp
@@ -25,11 +25,6 @@ TEST(APFloatTest, Zero) {
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, -0.0).convertToDouble());
}
-TEST(APFloatTest, SemanticsDeath) {
- 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) {
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0").convertToDouble());
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble());
@@ -69,6 +64,12 @@ TEST(APFloatTest, fromString) {
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1\02", 3)).convertToDouble());
}
+#ifdef GTEST_HAS_DEATH_TEST
+TEST(APFloatTest, SemanticsDeath) {
+ 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, StringDeath) {
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ""), "Invalid string length");
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-"), "String is only a minus!");
@@ -102,5 +103,6 @@ TEST(APFloatTest, StringDeath) {
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p0f"), "Invalid character in exponent");
}
+#endif
}
diff --git a/unittests/ADT/APIntTest.cpp b/unittests/ADT/APIntTest.cpp
index 207c633..dc8ba33 100644
--- a/unittests/ADT/APIntTest.cpp
+++ b/unittests/ADT/APIntTest.cpp
@@ -172,6 +172,7 @@ TEST(APIntTest, fromString) {
EXPECT_EQ(APInt(1, 1), APInt(1, "1", 16));
}
+#ifdef GTEST_HAS_DEATH_TEST
TEST(APIntTest, StringDeath) {
EXPECT_DEATH(APInt(0, "", 0), "bitwidth too small");
EXPECT_DEATH(APInt(32, "", 0), "Radix should be 2, 8, 10, or 16!");
@@ -182,5 +183,6 @@ TEST(APIntTest, StringDeath) {
EXPECT_DEATH(APInt(32, StringRef("1\02", 3), 10), "Invalid character in digit string");
EXPECT_DEATH(APInt(32, "1L", 10), "Invalid character in digit string");
}
+#endif
}