Parcourir la source

build test cases using the death test only when it's supported. (it's not marked as "supported" for BSDs)
okayed in jabber.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3846 e5f2f494-b856-4b98-b285-d166d9295462

JINMEI Tatuya il y a 14 ans
Parent
commit
c2d30a881d
1 fichiers modifiés avec 9 ajouts et 7 suppressions
  1. 9 7
      src/lib/nsas/tests/random_number_generator_unittest.cc

+ 9 - 7
src/lib/nsas/tests/random_number_generator_unittest.cc

@@ -52,12 +52,14 @@ private:
     const static int max_ = 10;
 };
 
-/// Some validation tests will incur performance penalty, so the tests are
-/// made only in "debug" version with assert(). But if NDEBUG is defined
-/// the tests will be failed since assert() is non-op in non-debug version.
-/// The "#ifndef NDEBUG" is added to make the tests be performed only in
-/// non-debug environment.
-#ifndef NDEBUG
+// Some validation tests will incur performance penalty, so the tests are
+// made only in "debug" version with assert(). But if NDEBUG is defined
+// the tests will be failed since assert() is non-op in non-debug version.
+// The "#ifndef NDEBUG" is added to make the tests be performed only in
+// non-debug environment.
+// Note: the death test is not supported by all platforms.  We need to
+// compile tests using it selectively.
+#if !defined(NDEBUG) && defined(GTEST_HAS_DEATH_TEST)
 // Test of the constructor
 TEST_F(UniformRandomIntegerGeneratorTest, Constructor) {
     // The range must be min<=max
@@ -107,7 +109,7 @@ TEST_F(WeightedRandomIntegerGeneratorTest, Constructor) {
 /// the tests will be failed since assert() is non-op in non-debug version.
 /// The "#ifndef NDEBUG" is added to make the tests be performed only in
 /// non-debug environment.
-#ifndef NDEBUG
+#if !defined(NDEBUG) && defined(GTEST_HAS_DEATH_TEST)
     //The probability must be >= 0
     probabilities.push_back(-0.1);
     probabilities.push_back(1.1);