Skip to content

Commit 43befcc

Browse files
committed
[TEST] add test case
1 parent a08f68b commit 43befcc

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,55 @@ START_SECTION((template <typename PeakType> void pick(const MSSpectrum& input, M
156156
TEST_REAL_SIMILAR(output.getFloatDataArrays()[0][0], 135.1852)
157157
}
158158

159+
// test data with a single flank only
160+
{
161+
PeakPickerHiRes pp_hires;
162+
Param param;
163+
param.setValue("signal_to_noise", 0.0);
164+
pp_hires.setParameters(param);
165+
166+
MSSpectrum input, output;
167+
input.emplace_back(100.0, 200);
168+
input.emplace_back(100.01, 250);
169+
input.emplace_back(100.02, 450);
170+
input.emplace_back(101.03, 250);
171+
input.emplace_back(101.04, 200);
172+
pp_hires.pick(input, output);
173+
TEST_EQUAL(output.size(), 1)
174+
TEST_REAL_SIMILAR(output[0].getIntensity(), 450.807) // this introduces a small error due to the "mirroring"
175+
TEST_REAL_SIMILAR(output[0].getMZ(), 100.02)
176+
177+
input.clear(true);
178+
input.emplace_back(99.0, 200);
179+
input.emplace_back(99.01, 250);
180+
input.emplace_back(100.02, 450);
181+
input.emplace_back(100.03, 250);
182+
input.emplace_back(100.04, 200);
183+
pp_hires.pick(input, output);
184+
TEST_EQUAL(output.size(), 1)
185+
TEST_REAL_SIMILAR(output[0].getIntensity(), 450.807) // this introduces a small error due to the "mirroring"
186+
TEST_REAL_SIMILAR(output[0].getMZ(), 100.02)
187+
}
188+
189+
// degenerate case, should not produce a peak
190+
{
191+
PeakPickerHiRes pp_hires;
192+
Param param;
193+
param.setValue("signal_to_noise", 0.0);
194+
pp_hires.setParameters(param);
195+
196+
MSSpectrum input, output;
197+
input.emplace_back(99.0, 200);
198+
input.emplace_back(99.01, 250);
199+
input.emplace_back(100.02, 450);
200+
input.emplace_back(101.03, 250);
201+
input.emplace_back(101.04, 200);
202+
pp_hires.pick(input, output);
203+
TEST_EQUAL(output.size(), 1)
204+
TEST_REAL_SIMILAR(output[0].getIntensity(), 450.807) // this introduces a small error due to the "mirroring"
205+
TEST_REAL_SIMILAR(output[0].getMZ(), 100.02)
206+
}
207+
159208
// Test on real data
160209
{
161210
MSSpectrum tmp_spec;

0 commit comments

Comments
 (0)