1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Andreas Bertsch $
25
// $Authors: Marc Sturm $
26
// --------------------------------------------------------------------------
28
#include <OpenMS/CONCEPT/ClassTest.h>
30
///////////////////////////
31
#include <OpenMS/METADATA/IonDetector.h>
32
///////////////////////////
34
using namespace OpenMS;
37
START_TEST(IonDetector, "$Id: IonDetector_test.C 8210 2011-03-28 13:19:52Z aiche $")
39
/////////////////////////////////////////////////////////////
40
/////////////////////////////////////////////////////////////
43
IonDetector* nullPointer = 0;
44
START_SECTION((IonDetector()))
45
ptr = new IonDetector();
46
TEST_NOT_EQUAL(ptr, nullPointer)
49
START_SECTION((~IonDetector()))
53
START_SECTION((Int getOrder() const))
55
TEST_EQUAL(tmp.getOrder(),0)
58
START_SECTION((void setOrder(Int order)))
61
TEST_EQUAL(tmp.getOrder(),4711)
64
START_SECTION((Type getType() const))
66
TEST_EQUAL(tmp.getType(),IonDetector::TYPENULL);
69
START_SECTION((void setType(Type type)))
71
tmp.setType(IonDetector::ELECTRONMULTIPLIER);
72
TEST_EQUAL(tmp.getType(),IonDetector::ELECTRONMULTIPLIER);
75
START_SECTION((DoubleReal getADCSamplingFrequency() const ))
77
TEST_EQUAL(tmp.getADCSamplingFrequency(),0);
80
START_SECTION((void setADCSamplingFrequency(DoubleReal ADC_sampling_frequency)))
82
tmp.setADCSamplingFrequency(47.11);
83
TEST_REAL_SIMILAR(tmp.getADCSamplingFrequency(),47.11);
86
START_SECTION((DoubleReal getResolution() const ))
88
TEST_EQUAL(tmp.getResolution(),0);
91
START_SECTION((void setResolution(DoubleReal resolution)))
93
tmp.setResolution(47.11);
94
TEST_REAL_SIMILAR(tmp.getResolution(),47.11);
97
START_SECTION((AcquisitionMode getAcquisitionMode() const))
99
TEST_EQUAL(tmp.getAcquisitionMode(),IonDetector::ACQMODENULL);
102
START_SECTION((void setAcquisitionMode(AcquisitionMode acquisition_mode)))
104
tmp.setAcquisitionMode(IonDetector::PULSECOUNTING);
105
TEST_EQUAL(tmp.getAcquisitionMode(),IonDetector::PULSECOUNTING);
108
START_SECTION((IonDetector(const IonDetector& source)))
110
tmp.setResolution(47.11);
111
tmp.setADCSamplingFrequency(47.21);
112
tmp.setAcquisitionMode(IonDetector::PULSECOUNTING);
113
tmp.setType(IonDetector::ELECTRONMULTIPLIER);
114
tmp.setMetaValue("label",String("label"));
117
IonDetector tmp2(tmp);
118
TEST_EQUAL((String)(tmp2.getMetaValue("label")), "label");
119
TEST_REAL_SIMILAR(tmp2.getResolution(),47.11);
120
TEST_REAL_SIMILAR(tmp2.getADCSamplingFrequency(),47.21);
121
TEST_EQUAL(tmp2.getAcquisitionMode(),IonDetector::PULSECOUNTING);
122
TEST_EQUAL(tmp2.getType(),IonDetector::ELECTRONMULTIPLIER);
123
TEST_EQUAL(tmp2.getOrder(),45)
126
START_SECTION((IonDetector& operator= (const IonDetector& source)))
128
tmp.setResolution(47.11);
129
tmp.setADCSamplingFrequency(47.21);
130
tmp.setAcquisitionMode(IonDetector::PULSECOUNTING);
131
tmp.setType(IonDetector::ELECTRONMULTIPLIER);
132
tmp.setMetaValue("label",String("label"));
137
TEST_EQUAL((String)(tmp2.getMetaValue("label")), "label");
138
TEST_REAL_SIMILAR(tmp2.getResolution(),47.11);
139
TEST_REAL_SIMILAR(tmp2.getADCSamplingFrequency(),47.21);
140
TEST_EQUAL(tmp2.getAcquisitionMode(),IonDetector::PULSECOUNTING);
141
TEST_EQUAL(tmp2.getType(),IonDetector::ELECTRONMULTIPLIER);
142
TEST_EQUAL(tmp2.getOrder(),45)
144
tmp2 = IonDetector();
145
TEST_EQUAL(tmp2.getMetaValue("label").isEmpty(), true);
146
TEST_REAL_SIMILAR(tmp2.getResolution(),0.0);
147
TEST_REAL_SIMILAR(tmp2.getADCSamplingFrequency(),0.0);
148
TEST_EQUAL(tmp2.getAcquisitionMode(),IonDetector::ACQMODENULL);
149
TEST_EQUAL(tmp2.getType(),IonDetector::TYPENULL);
150
TEST_EQUAL(tmp2.getOrder(),0)
153
START_SECTION((bool operator== (const IonDetector& rhs) const))
154
IonDetector edit,empty;
156
TEST_EQUAL(edit==empty,true);
158
edit.setResolution(47.11);
159
TEST_EQUAL(edit==empty,false);
162
edit.setADCSamplingFrequency(47.21);
163
TEST_EQUAL(edit==empty,false);
166
edit.setAcquisitionMode(IonDetector::PULSECOUNTING);
167
TEST_EQUAL(edit==empty,false);
170
edit.setType(IonDetector::ELECTRONMULTIPLIER);
171
TEST_EQUAL(edit==empty,false);
174
edit.setMetaValue("label",String("label"));
175
TEST_EQUAL(edit==empty,false);
179
TEST_EQUAL(edit==empty,false);
182
START_SECTION((bool operator!= (const IonDetector& rhs) const))
183
IonDetector edit,empty;
185
TEST_EQUAL(edit!=empty,false);
187
edit.setResolution(47.11);
188
TEST_EQUAL(edit!=empty,true);
191
edit.setADCSamplingFrequency(47.21);
192
TEST_EQUAL(edit!=empty,true);
195
edit.setAcquisitionMode(IonDetector::PULSECOUNTING);
196
TEST_EQUAL(edit!=empty,true);
199
edit.setType(IonDetector::ELECTRONMULTIPLIER);
200
TEST_EQUAL(edit!=empty,true);
203
edit.setMetaValue("label",String("label"));
204
TEST_EQUAL(edit!=empty,true);
208
TEST_EQUAL(edit!=empty,true);
214
/////////////////////////////////////////////////////////////
215
/////////////////////////////////////////////////////////////