[mlpack] 226/324: Patch from Sumedh: tests for row_col_iterator

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:13 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 07320f04e33d8c3bf12cf46f05dfe66b12be8d2c
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Fri Jul 25 21:24:32 2014 +0000

    Patch from Sumedh: tests for row_col_iterator
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16868 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/tests/arma_extend_test.cpp | 43 +++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/src/mlpack/tests/arma_extend_test.cpp b/src/mlpack/tests/arma_extend_test.cpp
index 1427c22..dd0b0b3 100644
--- a/src/mlpack/tests/arma_extend_test.cpp
+++ b/src/mlpack/tests/arma_extend_test.cpp
@@ -10,6 +10,7 @@
 #include "old_boost_test_definitions.hpp"
 
 using namespace mlpack;
+using namespace arma;
 
 BOOST_AUTO_TEST_SUITE(ArmaExtendTest);
 
@@ -47,4 +48,46 @@ BOOST_AUTO_TEST_CASE(InplaceReshapeMatrixTest)
     BOOST_REQUIRE_CLOSE(X[i], oldX[i], 1e-5); // Order should be preserved.
 }
 
+/**
+ * Test const_row_col_iterator for basic functionality.
+ */
+BOOST_AUTO_TEST_CASE(ConstRowColIteratorTest)
+{
+  mat X;
+  X.ones(2, 2);
+  // make sure default costructor works okay
+  mat::const_row_col_iterator it;
+  // make sure ++ operator, operator* and comparison operators work fine
+  size_t count = 0;
+  for(it = X.begin_row_col();it != X.end_row_col();it++)
+  {
+    count++;
+    BOOST_REQUIRE_EQUAL(*it, 1);
+  }
+  BOOST_REQUIRE_EQUAL(count, 4);
+  // make sure it can be constructed from row_iterator
+  it = X.begin_row(0);
+}
+
+/**
+ * Test row_col_iterator for basic functionality.
+ */
+BOOST_AUTO_TEST_CASE(RowColIteratorTest)
+{
+  mat X;
+  X.ones(2, 2);
+  // make sure default costructor works okay
+  mat::row_col_iterator it;
+  // make sure ++ operator, operator* and comparison operators work fine
+  size_t count = 0;
+  for(it = X.begin_row_col();it != X.end_row_col();it++)
+  {
+    count++;
+    BOOST_REQUIRE_EQUAL(*it, 1);
+  }
+  BOOST_REQUIRE_EQUAL(count, 4);
+  // make sure it can be constructed from row_iterator
+  it = X.begin_row(0);
+}
+
 BOOST_AUTO_TEST_SUITE_END();

-- 
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