[mlpack] 16/30: Added testcase for formatted output

Barak A. Pearlmutter barak+git at pearlmutter.net
Mon Dec 26 10:15:26 UTC 2016


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

bap pushed a commit to branch master
in repository mlpack.

commit 1ebd6d28686e2052b0d23c45eb1c64060eb841c3
Author: shikhar <shikharbhardwaj68 at gmail.com>
Date:   Fri Dec 16 02:20:32 2016 +0530

    Added testcase for formatted output
---
 src/mlpack/tests/cli_test.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/mlpack/tests/cli_test.cpp b/src/mlpack/tests/cli_test.cpp
index 3adebbe..0f5650f 100644
--- a/src/mlpack/tests/cli_test.cpp
+++ b/src/mlpack/tests/cli_test.cpp
@@ -349,5 +349,18 @@ BOOST_AUTO_TEST_CASE(TwiceStopTimerTest)
 
   BOOST_REQUIRE_THROW(Timer::Stop("test_timer"), std::runtime_error);
 }
+/**
+ * Test formatted output.
+ */
+BOOST_AUTO_TEST_CASE(TestFormattedOutput)
+{
+  std::stringstream ss;
+  PrefixedOutStream pss(ss, BASH_GREEN "[INFO ]" BASH_CLEAR);
 
+  const double pi = std::acos(-1.0);
+  pss << std::setprecision(10) << pi;
+
+  BOOST_REQUIRE_EQUAL(ss.str(),
+      BASH_GREEN "[INFO ]" BASH_CLEAR "3.141592654");
+}
 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