Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
308603cd
Commit
308603cd
authored
Jan 08, 2018
by
Samuel Jackson
Browse files
Refs #20441 Add test cases
parent
e73221b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/src/Peak.cpp
View file @
308603cd
...
...
@@ -796,6 +796,8 @@ double Peak::getSigmaIntensity() const { return m_sigmaIntensity; }
/** Return the peak intensity divided by the error in the intensity */
double
Peak
::
getIntensityOverSigma
()
const
{
if
(
m_sigmaIntensity
==
0
)
return
0
;
return
m_intensity
/
m_sigmaIntensity
;
}
...
...
Framework/DataObjects/test/PeakTest.h
View file @
308603cd
...
...
@@ -556,6 +556,45 @@ public:
TS_ASSERT
(
Mock
::
VerifyAndClearExpectations
(
replacementShape
));
}
void
test_get_intensity_over_sigma
()
{
const
int
detectorId
=
19999
;
const
double
wavelength
=
2
;
const
double
intensity
{
100
};
const
double
sigma
{
10
};
Peak
p
(
inst
,
detectorId
,
wavelength
);
p
.
setIntensity
(
intensity
);
p
.
setSigmaIntensity
(
sigma
);
TS_ASSERT_EQUALS
(
p
.
getIntensityOverSigma
(),
intensity
/
sigma
);
}
void
test_get_intensity_over_sigma_empty_sigma
()
{
const
int
detectorId
=
19999
;
const
double
wavelength
=
2
;
const
double
intensity
{
0
};
const
double
sigma
{
0
};
Peak
p
(
inst
,
detectorId
,
wavelength
);
p
.
setIntensity
(
intensity
);
p
.
setSigmaIntensity
(
sigma
);
TS_ASSERT_DELTA
(
p
.
getIntensityOverSigma
(),
0
,
1e-10
);
}
void
test_get_energy
()
{
const
int
detectorId
=
19999
;
const
double
wavelength
=
2
;
const
double
initialEnergy
{
100
};
const
double
finalEnergy
{
110
};
Peak
p
(
inst
,
detectorId
,
wavelength
);
p
.
setInitialEnergy
(
initialEnergy
);
p
.
setFinalEnergy
(
finalEnergy
);
TS_ASSERT_EQUALS
(
p
.
getEnergy
(),
initialEnergy
-
finalEnergy
);
}
private:
void
check_Contributing_Detectors
(
const
Peak
&
peak
,
const
std
::
vector
<
int
>
&
expected
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment