[mlpack-svn] r15230 - mlpack/trunk/src/mlpack/tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Jun 12 13:19:40 EDT 2013


Author: rcurtin
Date: 2013-06-12 13:19:40 -0400 (Wed, 12 Jun 2013)
New Revision: 15230

Modified:
   mlpack/trunk/src/mlpack/tests/allkrann_search_test.cpp
   mlpack/trunk/src/mlpack/tests/det_test.cpp
   mlpack/trunk/src/mlpack/tests/lsh_test.cpp
Log:
Windows does not like the #define private public hack, so do not use it there.
Also remove it from a few tests where it wasn't actually needed.


Modified: mlpack/trunk/src/mlpack/tests/allkrann_search_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/allkrann_search_test.cpp	2013-06-12 17:06:58 UTC (rev 15229)
+++ mlpack/trunk/src/mlpack/tests/allkrann_search_test.cpp	2013-06-12 17:19:40 UTC (rev 15230)
@@ -8,19 +8,15 @@
 #include <mlpack/core.hpp>
 #include <mlpack/core/metrics/lmetric.hpp>
 
-// So that we can test private members.  This is hackish (for now).
-#define private public
-#include <mlpack/methods/rann/ra_search.hpp>
-#undef private
-
 #include <boost/test/unit_test.hpp>
 #include "old_boost_test_definitions.hpp"
 
+#include <mlpack/methods/rann/ra_search.hpp>
+
 using namespace std;
 using namespace mlpack;
 using namespace mlpack::neighbor;
 
-
 BOOST_AUTO_TEST_SUITE(AllkRANNTest);
 
 // Test AllkRANN in naive mode for exact results when the random seeds are set

Modified: mlpack/trunk/src/mlpack/tests/det_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/det_test.cpp	2013-06-12 17:06:58 UTC (rev 15229)
+++ mlpack/trunk/src/mlpack/tests/det_test.cpp	2013-06-12 17:19:40 UTC (rev 15230)
@@ -9,21 +9,31 @@
 #include <boost/test/unit_test.hpp>
 #include "old_boost_test_definitions.hpp"
 
-#define protected public
-#define private public
+// This trick does not work on Windows.  We will have to comment out the tests
+// that depend on it.
+#ifndef _WIN32
+  #define protected public
+  #define private public
+#endif
+
 #include <mlpack/methods/det/dtree.hpp>
 #include <mlpack/methods/det/dt_utils.hpp>
-#undef protected
-#undef private
 
+#ifndef _WIN32
+  #undef protected
+  #undef private
+#endif
+
 using namespace mlpack;
 using namespace mlpack::det;
 using namespace std;
 
 BOOST_AUTO_TEST_SUITE(DETTest);
 
-// Tests for the private functions.
-
+// Tests for the private functions.  We cannot perform these if we are on
+// Windows because we cannot make private functions accessible using the macro
+// trick above.
+#ifndef _WIN32
 BOOST_AUTO_TEST_CASE(TestGetMaxMinVals)
 {
   arma::mat testData(3, 5);
@@ -134,6 +144,7 @@
   BOOST_REQUIRE_EQUAL(oTest[3], 2);
   BOOST_REQUIRE_EQUAL(oTest[4], 5);
 }
+#endif
 
 // Tests for the public functions.
 

Modified: mlpack/trunk/src/mlpack/tests/lsh_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/lsh_test.cpp	2013-06-12 17:06:58 UTC (rev 15229)
+++ mlpack/trunk/src/mlpack/tests/lsh_test.cpp	2013-06-12 17:19:40 UTC (rev 15230)
@@ -5,15 +5,11 @@
  */
 #include <mlpack/core.hpp>
 #include <mlpack/core/metrics/lmetric.hpp>
-
-// So that we can test private members.  This is hackish (for now).
-#define private public
-#include <mlpack/methods/lsh/lsh_search.hpp>
-#undef private
-
 #include <boost/test/unit_test.hpp>
 #include "old_boost_test_definitions.hpp"
 
+#include <mlpack/methods/lsh/lsh_search.hpp>
+
 using namespace std;
 using namespace mlpack;
 using namespace mlpack::neighbor;




More information about the mlpack-svn mailing list