Skip to content
Snippets Groups Projects
Commit d2f2b183 authored by Janik Zikovsky's avatar Janik Zikovsky
Browse files

Refs #2666: A couple of extra tests.

parent 5ec02648
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,7 @@ void Progress::reportIncrement(int inc, const std::string& msg) ...@@ -83,6 +83,7 @@ void Progress::reportIncrement(int inc, const std::string& msg)
void Progress::setNumSteps(int nsteps) void Progress::setNumSteps(int nsteps)
{ {
m_numSteps = nsteps; m_numSteps = nsteps;
if (m_numSteps <= 0) m_numSteps = 1; // Minimum of 1
m_step = (m_end-m_start) / (m_numSteps); m_step = (m_end-m_start) / (m_numSteps);
int notifyStep = 1; int notifyStep = 1;
m_notifyStep = (static_cast<int>(double(m_numSteps)*notifyStep/100/(m_end-m_start))); m_notifyStep = (static_cast<int>(double(m_numSteps)*notifyStep/100/(m_end-m_start)));
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <iomanip> #include <iomanip>
#include <cstdlib> #include <cstdlib>
#include "MantidAPI/Progress.h"
#include "MantidAPI/ProgressText.h" #include "MantidAPI/ProgressText.h"
using namespace Mantid::API; using namespace Mantid::API;
...@@ -22,6 +23,16 @@ public: ...@@ -22,6 +23,16 @@ public:
TS_ASSERT_THROWS_NOTHING(p.setNumSteps(100)); TS_ASSERT_THROWS_NOTHING(p.setNumSteps(100));
} }
void test_constructors()
{
// No steps?
TS_ASSERT_THROWS_NOTHING(Progress p(NULL, 0.0, 1.0, 0); p.report(); );
TS_ASSERT_THROWS_NOTHING(ProgressText p(0.0, 1.0, 0); );
// Max is < min
TS_ASSERT_THROWS_NOTHING(Progress p(NULL, 1.0, 0.5, 10); p.report(); );
TS_ASSERT_THROWS_NOTHING(ProgressText p(NULL, 1.0, 0.5, 10); );
}
/// Disabled because it has text output /// Disabled because it has text output
void xtest_with_stdout() void xtest_with_stdout()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment