Browse Source

Adapted Death-Tests in BitVectorTest.cpp to return codes upon assertion failure on Windows and deactivate them everywhere if the macro NDEBUG is defined (as that disables assertions)

Former-commit-id: be04a49e57
tempestpy_adaptions
David_Korzeniewski 10 years ago
parent
commit
4b44e625d0
  1. 26
      test/functional/storage/BitVectorTest.cpp

26
test/functional/storage/BitVectorTest.cpp

@ -120,8 +120,18 @@ TEST(BitVectorTest, GetSetInt) {
TEST(BitVectorDeathTest, GetSetAssertion) { TEST(BitVectorDeathTest, GetSetAssertion) {
storm::storage::BitVector vector(32); storm::storage::BitVector vector(32);
EXPECT_DEATH_IF_SUPPORTED(vector.get(32), "");
EXPECT_DEATH_IF_SUPPORTED(vector.set(32), "");
#ifndef NDEBUG
#ifdef WINDOWS
EXPECT_EXIT(vector.get(32), ::testing::ExitedWithCode(0), ".*");
EXPECT_EXIT(vector.set(32), ::testing::ExitedWithCode(0), ".*");
#else
EXPECT_DEATH_IF_SUPPORTED(vector.get(32), "");
EXPECT_DEATH_IF_SUPPORTED(vector.set(32), "");
#endif
#else
std::cerr << "WARNING: Not testing GetSetAssertions, as they are disabled in release mode." << std::endl;
SUCCESS();
#endif
} }
TEST(BitVectorTest, Resize) { TEST(BitVectorTest, Resize) {
@ -303,7 +313,17 @@ TEST(BitVectorTest, OperatorModulo) {
vector3.set(i, i % 2 == 0); vector3.set(i, i % 2 == 0);
} }
EXPECT_DEATH_IF_SUPPORTED(vector1 % vector3, "");
#ifndef NDEBUG
#ifdef WINDOWS
EXPECT_EXIT(vector1 % vector3, ::testing::ExitedWithCode(0), ".*");
#else
EXPECT_DEATH_IF_SUPPORTED(vector1 % vector3, "");
#endif
#else
std::cerr << "WARNING: Not testing OperatorModulo size check, as assertions are disabled in release mode." << std::endl;
SUCCESS();
#endif
} }
TEST(BitVectorTest, OperatorNot) { TEST(BitVectorTest, OperatorNot) {

Loading…
Cancel
Save