[mlpack] 171/324: Test MinWidth().

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:07 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 5dc686b94a2518aca2592c3e46fadafcd3ecd89e
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Thu Jul 10 14:31:13 2014 +0000

    Test MinWidth().
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16810 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/tests/tree_test.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mlpack/tests/tree_test.cpp b/src/mlpack/tests/tree_test.cpp
index a5bc474..1971185 100644
--- a/src/mlpack/tests/tree_test.cpp
+++ b/src/mlpack/tests/tree_test.cpp
@@ -32,6 +32,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundEmptyConstructor)
   HRectBound<2> b;
 
   BOOST_REQUIRE_EQUAL((int) b.Dim(), 0);
+  BOOST_REQUIRE_EQUAL(b.MinWidth(), 0.0);
 }
 
 /**
@@ -54,6 +55,8 @@ BOOST_AUTO_TEST_CASE(HRectBoundDimConstructor)
   BOOST_REQUIRE_SMALL(b[2].Width(), 1e-5);
   BOOST_REQUIRE_SMALL(b[3].Width(), 1e-5);
   BOOST_REQUIRE_SMALL(b[4].Width(), 1e-5);
+
+  BOOST_REQUIRE_EQUAL(b.MinWidth(), 0.0);
 }
 
 /**
@@ -64,6 +67,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundCopyConstructor)
   HRectBound<2> b(2);
   b[0] = Range(0.0, 2.0);
   b[1] = Range(2.0, 3.0);
+  b.MinWidth() = 0.5;
 
   HRectBound<2> c(b);
 
@@ -72,6 +76,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundCopyConstructor)
   BOOST_REQUIRE_CLOSE(c[0].Hi(), 2.0, 1e-5);
   BOOST_REQUIRE_CLOSE(c[1].Lo(), 2.0, 1e-5);
   BOOST_REQUIRE_CLOSE(c[1].Hi(), 3.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MinWidth(), 0.5, 1e-5);
 }
 
 /**
@@ -82,6 +87,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundAssignmentOperator)
   HRectBound<2> b(2);
   b[0] = Range(0.0, 2.0);
   b[1] = Range(2.0, 3.0);
+  b.MinWidth() = 0.5;
 
   HRectBound<2> c(4);
 
@@ -92,6 +98,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundAssignmentOperator)
   BOOST_REQUIRE_CLOSE(c[0].Hi(), 2.0, 1e-5);
   BOOST_REQUIRE_CLOSE(c[1].Lo(), 2.0, 1e-5);
   BOOST_REQUIRE_CLOSE(c[1].Hi(), 3.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MinWidth(), 0.5, 1e-5);
 }
 
 /**
@@ -103,12 +110,14 @@ BOOST_AUTO_TEST_CASE(HRectBoundClear)
 
   b[0] = Range(0.0, 2.0);
   b[1] = Range(2.0, 4.0);
+  b.MinWidth() = 1.0;
 
   // Now we just need to make sure that we clear the range.
   b.Clear();
 
   BOOST_REQUIRE_SMALL(b[0].Width(), 1e-5);
   BOOST_REQUIRE_SMALL(b[1].Width(), 1e-5);
+  BOOST_REQUIRE_SMALL(b.MinWidth(), 1e-5);
 }
 
 /**
@@ -454,6 +463,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundOrOperatorPoint)
   b[2] = Range(-2.0, -1.0);
   b[3] = Range(0.0, 0.0);
   b[4] = Range(); // Empty range.
+  b.MinWidth() = 0.0;
 
   arma::vec point = "2.0 4.0 2.0 -1.0 6.0";
 
@@ -469,6 +479,7 @@ BOOST_AUTO_TEST_CASE(HRectBoundOrOperatorPoint)
   BOOST_REQUIRE_SMALL(b[3].Hi(), 1e-5);
   BOOST_REQUIRE_CLOSE(b[4].Lo(), 6.0, 1e-5);
   BOOST_REQUIRE_CLOSE(b[4].Hi(), 6.0, 1e-5);
+  BOOST_REQUIRE_SMALL(b.MinWidth(), 1e-5);
 }
 
 /**
@@ -544,6 +555,9 @@ BOOST_AUTO_TEST_CASE(HRectBoundOrOperatorBound)
   BOOST_REQUIRE_CLOSE(b[7].Hi(), 3.0, 1e-5);
   BOOST_REQUIRE_CLOSE(d[7].Lo(), 1.0, 1e-5);
   BOOST_REQUIRE_CLOSE(d[7].Hi(), 3.0, 1e-5);
+
+  BOOST_REQUIRE_CLOSE(b.MinWidth(), 1.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(d.MinWidth(), 1.0, 1e-5);
 }
 
 /**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list