Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
d2f2b183
Commit
d2f2b183
authored
14 years ago
by
Janik Zikovsky
Browse files
Options
Downloads
Patches
Plain Diff
Refs #2666: A couple of extra tests.
parent
5ec02648
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Framework/API/src/Progress.cpp
+1
-0
1 addition, 0 deletions
Code/Mantid/Framework/API/src/Progress.cpp
Code/Mantid/Framework/API/test/ProgressTextTest.h
+11
-0
11 additions, 0 deletions
Code/Mantid/Framework/API/test/ProgressTextTest.h
with
12 additions
and
0 deletions
Code/Mantid/Framework/API/src/Progress.cpp
+
1
−
0
View file @
d2f2b183
...
@@ -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
)));
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/API/test/ProgressTextTest.h
+
11
−
0
View file @
d2f2b183
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment