From 4e80f71a546daa41bb7210cee3bf2f5561d61123 Mon Sep 17 00:00:00 2001 From: shikhar Date: Thu, 15 Dec 2016 23:56:06 +0530 Subject: [PATCH 1/4] Fix Log compatibility with std::fixed and std::setprecision Changes /src/mlpack/core/util/prefixedoutstream_impl.hpp --- src/mlpack/core/util/prefixedoutstream_impl.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mlpack/core/util/prefixedoutstream_impl.hpp b/src/mlpack/core/util/prefixedoutstream_impl.hpp index 55bd5a7133e..a6e614ebbd0 100644 --- a/src/mlpack/core/util/prefixedoutstream_impl.hpp +++ b/src/mlpack/core/util/prefixedoutstream_impl.hpp @@ -45,6 +45,9 @@ void PrefixedOutStream::BaseLogic(const T& val) PrefixIfNeeded(); std::ostringstream convert; + // Sync flags and precision with destination stream + convert.setf(destination.flags()); + convert.precision(destination.precision()); convert << val; if (convert.fail()) From 9cd0e48015b075f968e8746dc6ac8191a7cc9458 Mon Sep 17 00:00:00 2001 From: shikhar Date: Fri, 16 Dec 2016 02:20:32 +0530 Subject: [PATCH 2/4] 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 086a74c0108..326ee86d3b7 100644 --- a/src/mlpack/tests/cli_test.cpp +++ b/src/mlpack/tests/cli_test.cpp @@ -749,5 +749,18 @@ BOOST_AUTO_TEST_CASE(UnmappedParamTest) BOOST_REQUIRE_EQUAL(CLI::GetUnmappedParam("matrix2"), "file1.csv"); } +/** + * 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(); From 7fa0b7944523dd113686fa05f0824d328a70a224 Mon Sep 17 00:00:00 2001 From: shikhar Date: Fri, 16 Dec 2016 16:06:26 +0530 Subject: [PATCH 3/4] Change formatted output test --- src/mlpack/tests/cli_test.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mlpack/tests/cli_test.cpp b/src/mlpack/tests/cli_test.cpp index 326ee86d3b7..3a5fe33dc98 100644 --- a/src/mlpack/tests/cli_test.cpp +++ b/src/mlpack/tests/cli_test.cpp @@ -354,6 +354,20 @@ BOOST_AUTO_TEST_CASE(TestPrefixedOutStreamModifiers) "I have a precise number which is 000156"); } +/** + * 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"); +} /** * We should be able to start and then stop a timer multiple times and it should * save the value. @@ -749,18 +763,5 @@ BOOST_AUTO_TEST_CASE(UnmappedParamTest) BOOST_REQUIRE_EQUAL(CLI::GetUnmappedParam("matrix2"), "file1.csv"); } -/** - * 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(); From 9eef2aea7e7076b73a33a62c80c02d88feb616ec Mon Sep 17 00:00:00 2001 From: shikhar Date: Fri, 16 Dec 2016 20:31:23 +0530 Subject: [PATCH 4/4] Split tests for PrefixedOutStream and Timer --- COPYRIGHT.txt | 1 + src/mlpack/core.hpp | 1 + src/mlpack/tests/CMakeLists.txt | 2 + src/mlpack/tests/cli_test.cpp | 224 -------------------- src/mlpack/tests/prefixedoutstream_test.cpp | 165 ++++++++++++++ src/mlpack/tests/timer_test.cpp | 101 +++++++++ 6 files changed, 270 insertions(+), 224 deletions(-) create mode 100644 src/mlpack/tests/prefixedoutstream_test.cpp create mode 100644 src/mlpack/tests/timer_test.cpp diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index ed1925f9bcc..d02ba901219 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -62,6 +62,7 @@ Copyright: Copyright 2016, Peter Lehner Copyright 2016, Anuraj Kanodia Copyright 2016, Ivan Georgiev + Copyright 2016, Shikhar Bhardwaj License: BSD-3-clause All rights reserved. . diff --git a/src/mlpack/core.hpp b/src/mlpack/core.hpp index 44b062c2046..aa9242d1651 100644 --- a/src/mlpack/core.hpp +++ b/src/mlpack/core.hpp @@ -202,6 +202,7 @@ * - Peter Lehner * - Anuraj Kanodia * - Ivan Georgiev + * - Shikhar Bhardwaj */ // First, include all of the prerequisites. diff --git a/src/mlpack/tests/CMakeLists.txt b/src/mlpack/tests/CMakeLists.txt index 3b3ab0d30b1..c500d99c3b0 100644 --- a/src/mlpack/tests/CMakeLists.txt +++ b/src/mlpack/tests/CMakeLists.txt @@ -95,6 +95,8 @@ add_executable(mlpack_test armadillo_svd_test.cpp ub_tree_test.cpp vantage_point_tree_test.cpp + prefixedoutstream_test.cpp + timer_test.cpp ) # Link dependencies of test executable. target_link_libraries(mlpack_test diff --git a/src/mlpack/tests/cli_test.cpp b/src/mlpack/tests/cli_test.cpp index 3a5fe33dc98..b7b36e8723b 100644 --- a/src/mlpack/tests/cli_test.cpp +++ b/src/mlpack/tests/cli_test.cpp @@ -10,29 +10,11 @@ * http://www.opensource.org/licenses/BSD-3-Clause for more information. */ -#include -#include - -#ifndef _WIN32 - #include -#endif - -// For Sleep(). -#ifdef _WIN32 - #include -#endif - #include #include #include "test_tools.hpp" -#define BASH_RED "\033[0;31m" -#define BASH_GREEN "\033[0;32m" -#define BASH_YELLOW "\033[0;33m" -#define BASH_CYAN "\033[0;36m" -#define BASH_CLEAR "\033[0m" - using namespace mlpack; using namespace mlpack::util; @@ -83,35 +65,6 @@ BOOST_AUTO_TEST_CASE(TestCLIAdd) CLI::Destroy(); } -/** - * Test the output of CLI. We will pass bogus input to a stringstream so that - * none of it gets to the screen. - */ -BOOST_AUTO_TEST_CASE(TestPrefixedOutStreamBasic) -{ - std::stringstream ss; - PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); - - pss << "This shouldn't break anything" << std::endl; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR "This shouldn't break anything\n"); - - ss.str(""); - pss << "Test the new lines..."; - pss << "shouldn't get 'Info' here." << std::endl; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR - "Test the new lines...shouldn't get 'Info' here.\n"); - - pss << "But now I should." << std::endl << std::endl; - pss << ""; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR - "Test the new lines...shouldn't get 'Info' here.\n" - BASH_GREEN "[INFO ] " BASH_CLEAR "But now I should.\n" - BASH_GREEN "[INFO ] " BASH_CLEAR "\n" - BASH_GREEN "[INFO ] " BASH_CLEAR ""); -} /** * Tests that the various PARAM_* macros work properly. @@ -266,183 +219,6 @@ BOOST_AUTO_TEST_CASE(TestVectorOption2) } -/** - * Test that we can correctly output Armadillo objects to PrefixedOutStream - * objects. - */ -BOOST_AUTO_TEST_CASE(TestArmadilloPrefixedOutStream) -{ - // We will test this with both a vector and a matrix. - arma::vec test("1.0 1.5 2.0 2.5 3.0 3.5 4.0"); - - std::stringstream ss; - PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); - - pss << test; - // This should result in nothing being on the current line (since it clears - // it). - BOOST_REQUIRE_EQUAL(ss.str(), BASH_GREEN "[INFO ] " BASH_CLEAR " 1.0000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 1.5000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 2.0000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 3.0000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 3.5000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000\n"); - - ss.str(""); - pss << trans(test); - // This should result in there being stuff on the line. - BOOST_REQUIRE_EQUAL(ss.str(), BASH_GREEN "[INFO ] " BASH_CLEAR - " 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000\n"); - - arma::mat test2("1.0 1.5 2.0; 2.5 3.0 3.5; 4.0 4.5 4.99999"); - ss.str(""); - pss << test2; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR " 1.0000 1.5000 2.0000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000 3.0000 3.5000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000 4.5000 5.0000\n"); - - // Try and throw a curveball by not clearing the line before outputting - // something else. The PrefixedOutStream should not force Armadillo objects - // onto their own lines. - ss.str(""); - pss << "hello" << test2; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR "hello 1.0000 1.5000 2.0000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000 3.0000 3.5000\n" - BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000 4.5000 5.0000\n"); -} - -/** - * Test that we can correctly output things in general. - */ -BOOST_AUTO_TEST_CASE(TestPrefixedOutStream) -{ - std::stringstream ss; - PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); - - pss << "hello world I am "; - pss << 7; - - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR "hello world I am 7"); - - pss << std::endl; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR "hello world I am 7\n"); - - ss.str(""); - pss << std::endl; - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR "\n"); -} - -/** - * Test format modifiers. - */ -BOOST_AUTO_TEST_CASE(TestPrefixedOutStreamModifiers) -{ - std::stringstream ss; - PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); - - pss << "I have a precise number which is "; - pss << std::setw(6) << std::setfill('0') << (int)156; - - BOOST_REQUIRE_EQUAL(ss.str(), - BASH_GREEN "[INFO ] " BASH_CLEAR - "I have a precise number which is 000156"); -} - -/** - * 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"); -} -/** - * We should be able to start and then stop a timer multiple times and it should - * save the value. - */ -BOOST_AUTO_TEST_CASE(MultiRunTimerTest) -{ - AddRequiredCLIOptions(); - - Timer::Start("test_timer"); - - // On Windows (or, at least, in Windows not using VS2010) we cannot use - // usleep() because it is not provided. Instead we will use Sleep() for a - // number of milliseconds. - #ifdef _WIN32 - Sleep(10); - #else - usleep(10000); - #endif - - Timer::Stop("test_timer"); - - BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 10000); - - // Restart it. - Timer::Start("test_timer"); - - #ifdef _WIN32 - Sleep(10); - #else - usleep(10000); - #endif - - Timer::Stop("test_timer"); - - BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 20000); - - // Just one more time, for good measure... - Timer::Start("test_timer"); - - #ifdef _WIN32 - Sleep(20); - #else - usleep(20000); - #endif - - Timer::Stop("test_timer"); - - BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 40000); - - CLI::Destroy(); -} - -BOOST_AUTO_TEST_CASE(TwiceStartTimerTest) -{ - AddRequiredCLIOptions(); - - Timer::Start("test_timer"); - - BOOST_REQUIRE_THROW(Timer::Start("test_timer"), std::runtime_error); - - CLI::Destroy(); -} - -BOOST_AUTO_TEST_CASE(TwiceStopTimerTest) -{ - AddRequiredCLIOptions(); - - Timer::Start("test_timer"); - Timer::Stop("test_timer"); - - BOOST_REQUIRE_THROW(Timer::Stop("test_timer"), std::runtime_error); - - CLI::Destroy(); -} - BOOST_AUTO_TEST_CASE(InputMatrixParamTest) { AddRequiredCLIOptions(); diff --git a/src/mlpack/tests/prefixedoutstream_test.cpp b/src/mlpack/tests/prefixedoutstream_test.cpp new file mode 100644 index 00000000000..8d4652a6e63 --- /dev/null +++ b/src/mlpack/tests/prefixedoutstream_test.cpp @@ -0,0 +1,165 @@ +/** + * @file prefixedoutstream_test.cpp + * @author Matthew Amidon, Ryan Curtin + * + * Tests for the PrefixedOutStream class + * + * mlpack is free software; you may redistribute it and/or modify it under the + * terms of the 3-clause BSD license. You should have received a copy of the + * 3-clause BSD license along with mlpack. If not, see + * http://www.opensource.org/licenses/BSD-3-Clause for more information. + **/ + +#include +#include + +#include + +#include +#include "test_tools.hpp" + +#define BASH_RED "\033[0;31m" +#define BASH_GREEN "\033[0;32m" +#define BASH_YELLOW "\033[0;33m" +#define BASH_CYAN "\033[0;36m" +#define BASH_CLEAR "\033[0m" + +using namespace mlpack; +using namespace mlpack::util; + +BOOST_AUTO_TEST_SUITE(PrefixedOutStreamTest); + +/** + * Test the output of CLI using PrefixedOutStream. We will pass bogus + * input to a stringstream so that none of it gets to the screen. + */ +BOOST_AUTO_TEST_CASE(TestPrefixedOutStreamBasic) +{ + std::stringstream ss; + PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); + + pss << "This shouldn't break anything" << std::endl; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR "This shouldn't break anything\n"); + + ss.str(""); + pss << "Test the new lines..."; + pss << "shouldn't get 'Info' here." << std::endl; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR + "Test the new lines...shouldn't get 'Info' here.\n"); + + pss << "But now I should." << std::endl << std::endl; + pss << ""; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR + "Test the new lines...shouldn't get 'Info' here.\n" + BASH_GREEN "[INFO ] " BASH_CLEAR "But now I should.\n" + BASH_GREEN "[INFO ] " BASH_CLEAR "\n" + BASH_GREEN "[INFO ] " BASH_CLEAR ""); +} + +/** + * Test that we can correctly output Armadillo objects to PrefixedOutStream + * objects. + */ +BOOST_AUTO_TEST_CASE(TestArmadilloPrefixedOutStream) +{ + // We will test this with both a vector and a matrix. + arma::vec test("1.0 1.5 2.0 2.5 3.0 3.5 4.0"); + + std::stringstream ss; + PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); + + pss << test; + // This should result in nothing being on the current line (since it clears + // it). + BOOST_REQUIRE_EQUAL(ss.str(), BASH_GREEN "[INFO ] " BASH_CLEAR " 1.0000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 1.5000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 2.0000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 3.0000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 3.5000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000\n"); + + ss.str(""); + pss << trans(test); + // This should result in there being stuff on the line. + BOOST_REQUIRE_EQUAL(ss.str(), BASH_GREEN "[INFO ] " BASH_CLEAR + " 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000\n"); + + arma::mat test2("1.0 1.5 2.0; 2.5 3.0 3.5; 4.0 4.5 4.99999"); + ss.str(""); + pss << test2; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR " 1.0000 1.5000 2.0000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000 3.0000 3.5000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000 4.5000 5.0000\n"); + + // Try and throw a curveball by not clearing the line before outputting + // something else. The PrefixedOutStream should not force Armadillo objects + // onto their own lines. + ss.str(""); + pss << "hello" << test2; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR "hello 1.0000 1.5000 2.0000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 2.5000 3.0000 3.5000\n" + BASH_GREEN "[INFO ] " BASH_CLEAR " 4.0000 4.5000 5.0000\n"); +} + +/** + * Test that we can correctly output things in general. + */ +BOOST_AUTO_TEST_CASE(TestPrefixedOutStream) +{ + std::stringstream ss; + PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); + + pss << "hello world I am "; + pss << 7; + + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR "hello world I am 7"); + + pss << std::endl; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR "hello world I am 7\n"); + + ss.str(""); + pss << std::endl; + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR "\n"); +} + +/** + * Test format modifiers. + */ +BOOST_AUTO_TEST_CASE(TestPrefixedOutStreamModifiers) +{ + std::stringstream ss; + PrefixedOutStream pss(ss, BASH_GREEN "[INFO ] " BASH_CLEAR); + + pss << "I have a precise number which is "; + pss << std::setw(6) << std::setfill('0') << (int)156; + + BOOST_REQUIRE_EQUAL(ss.str(), + BASH_GREEN "[INFO ] " BASH_CLEAR + "I have a precise number which is 000156"); +} + +/** + * Test formatted floating-point 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(); diff --git a/src/mlpack/tests/timer_test.cpp b/src/mlpack/tests/timer_test.cpp new file mode 100644 index 00000000000..c83275083a7 --- /dev/null +++ b/src/mlpack/tests/timer_test.cpp @@ -0,0 +1,101 @@ +/** + * @file timer_test.cpp + * @author Matthew Amidon, Ryan Curtin + * + * Test for the timer class + * + * mlpack is free software; you may redistribute it and/or modify it under the + * terms of the 3-clause BSD license. You should have received a copy of the + * 3-clause BSD license along with mlpack. If not, see + * http://www.opensource.org/licenses/BSD-3-Clause for more information. + **/ + +#ifndef _WIN32 + #include +#endif + +// For Sleep(). +#ifdef _WIN32 + #include +#endif + +#include + +#include +#include "test_tools.hpp" + +using namespace mlpack; + + +BOOST_AUTO_TEST_SUITE(TimerTest); + +/** + * We should be able to start and then stop a timer multiple times and it should + * save the value. + */ +BOOST_AUTO_TEST_CASE(MultiRunTimerTest) +{ + + Timer::Start("test_timer"); + + // On Windows (or, at least, in Windows not using VS2010) we cannot use + // usleep() because it is not provided. Instead we will use Sleep() for a + // number of milliseconds. + #ifdef _WIN32 + Sleep(10); + #else + usleep(10000); + #endif + + Timer::Stop("test_timer"); + + BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 10000); + + // Restart it. + Timer::Start("test_timer"); + + #ifdef _WIN32 + Sleep(10); + #else + usleep(10000); + #endif + + Timer::Stop("test_timer"); + + BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 20000); + + // Just one more time, for good measure... + Timer::Start("test_timer"); + + #ifdef _WIN32 + Sleep(20); + #else + usleep(20000); + #endif + + Timer::Stop("test_timer"); + + BOOST_REQUIRE_GE(Timer::Get("test_timer").count(), 40000); + +} + +BOOST_AUTO_TEST_CASE(TwiceStopTimerTest) +{ + + Timer::Start("test_timer"); + Timer::Stop("test_timer"); + + BOOST_REQUIRE_THROW(Timer::Stop("test_timer"), std::runtime_error); + +} + +BOOST_AUTO_TEST_CASE(TwiceStartTimerTest) +{ + + Timer::Start("test_timer"); + + BOOST_REQUIRE_THROW(Timer::Start("test_timer"), std::runtime_error); + +} + +BOOST_AUTO_TEST_SUITE_END();