[mlpack] 129/207: Added Test for col and row load

Barak A. Pearlmutter barak+git at pearlmutter.net
Thu Mar 23 17:53:47 UTC 2017


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

bap pushed a commit to branch master
in repository mlpack.

commit 48a460f59f84d73b21f8fd84ee2d19649fdaa8b2
Author: Lakshya Agrawal <zeeshan.lakshya at gmail.com>
Date:   Thu Mar 2 15:21:24 2017 +0530

    Added Test for col and row load
---
 src/mlpack/tests/load_save_test.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/mlpack/tests/load_save_test.cpp b/src/mlpack/tests/load_save_test.cpp
index 7ff0ce2..9655176 100644
--- a/src/mlpack/tests/load_save_test.cpp
+++ b/src/mlpack/tests/load_save_test.cpp
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(LoadColVecCSVTest)
 
   f.close();
 
-  arma::vec test;
+  arma::colvec test;
   BOOST_REQUIRE(data::Load("test_file.csv", test, false) == true);
 
   BOOST_REQUIRE_EQUAL(test.n_cols, 1);
@@ -214,18 +214,20 @@ BOOST_AUTO_TEST_CASE(LoadMatinColVec)
   fstream f;
   f.open("test_file.csv", fstream::out);
 
-  f << "1,2" << endl;
-  f << "3,4" << endl;
+  f << "1, 2" << endl;
+  f << "3, 4" << endl;
 
   f.close();
 
   arma::colvec coltest;
-  BOOST_WARN_THROW(data::Load("test_file.csv", coltest, false),
-      std::exception);
+  BOOST_REQUIRE_THROW(data::Load("test_file.csv", coltest, false),
+      std::logic_error);
+  Timer::Stop("loading_data");
 
   arma::rowvec rowtest;
-  BOOST_WARN_THROW(data::Load("test_file.csv", rowtest, false),
-      std::exception);
+  BOOST_REQUIRE_THROW(data::Load("test_file.csv", rowtest, false),
+      std::logic_error);
+  Timer::Stop("loading_data");
 
   remove("test_file.csv");
 }
@@ -238,7 +240,7 @@ BOOST_AUTO_TEST_CASE(LoadRowVecCSVTest)
   fstream f;
   f.open("test_file.csv", fstream::out);
 
-  for( int i = 0 ; i < 7;++i)
+  for(int i = 0 ; i < 7; ++i)
     f << i << ",";
   f << "7";
   f << endl;
@@ -251,7 +253,7 @@ BOOST_AUTO_TEST_CASE(LoadRowVecCSVTest)
   BOOST_REQUIRE_EQUAL(test.n_cols, 8);
   BOOST_REQUIRE_EQUAL(test.n_rows, 1);
 
-  for( size_t i = 0; i < 8 ; ++i)
+  for(size_t i = 0; i < 8 ; ++i)
     BOOST_REQUIRE_CLOSE(test[i], (double) (i) , 1e-5);
 
   remove("test_file.csv");

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