[mlpack-svn] master: Always get the boolean value and store it in a temporary, because the Boost unit test macros do weird things and will cause bizarre problems. (b926c31)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Tue Jan 6 14:21:09 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/6b14d78fc09cb205ffa7a297f5e6310b2ad83e25...9147fd3ee8072669c18422de4ea6fbe8f964b423
>---------------------------------------------------------------
commit b926c318af9e5b4fc9fb8d1db152bb8e149df47a
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date: Tue Jan 6 11:34:16 2015 +0100
Always get the boolean value and store it in a temporary, because the Boost unit test macros do weird things and will cause bizarre problems.
>---------------------------------------------------------------
b926c318af9e5b4fc9fb8d1db152bb8e149df47a
src/mlpack/tests/activation_functions_test.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mlpack/tests/activation_functions_test.cpp b/src/mlpack/tests/activation_functions_test.cpp
index 60a4fe1..5d2ce2d 100644
--- a/src/mlpack/tests/activation_functions_test.cpp
+++ b/src/mlpack/tests/activation_functions_test.cpp
@@ -29,6 +29,10 @@ using namespace mlpack::ann;
BOOST_AUTO_TEST_SUITE(ActivationFunctionsTest);
+// Be careful! When writing new tests, always get the boolean value and store
+// it in a temporary, because the Boost unit test macros do weird things and
+// will cause bizarre problems.
+
// Generate dataset for activation function tests.
const arma::colvec activationData("-2 3.2 4.5 -100.2 1 -1 2 0");
@@ -323,7 +327,8 @@ void CheckGradientNumericallyCorrect(const arma::colvec input,
dW = (pLoss - mLoss) / (2 * perturbation);
e = std::abs(dW - gradient[l].at(i, j));
- BOOST_REQUIRE_EQUAL(e < threshold, 1);
+ bool b = e < threshold;
+ BOOST_REQUIRE_EQUAL(b, 1);
// Restore original weight.
layer[l].get().Weights().at(i, j) = weight;
More information about the mlpack-git
mailing list