~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to source/TEST/IonDetector_test.C

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
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.
 
13
//
 
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.
 
18
//
 
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
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: Andreas Bertsch $
 
25
// $Authors: Marc Sturm $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#include <OpenMS/CONCEPT/ClassTest.h>
 
29
 
 
30
///////////////////////////
 
31
#include <OpenMS/METADATA/IonDetector.h>
 
32
///////////////////////////
 
33
 
 
34
using namespace OpenMS;
 
35
using namespace std;
 
36
 
 
37
START_TEST(IonDetector, "$Id: IonDetector_test.C 8210 2011-03-28 13:19:52Z aiche $")
 
38
 
 
39
/////////////////////////////////////////////////////////////
 
40
/////////////////////////////////////////////////////////////
 
41
 
 
42
IonDetector* ptr = 0;
 
43
IonDetector* nullPointer = 0;
 
44
START_SECTION((IonDetector()))
 
45
        ptr = new IonDetector();
 
46
        TEST_NOT_EQUAL(ptr, nullPointer)
 
47
END_SECTION
 
48
 
 
49
START_SECTION((~IonDetector()))
 
50
        delete ptr;
 
51
END_SECTION
 
52
 
 
53
START_SECTION((Int getOrder() const))
 
54
        IonDetector tmp;
 
55
        TEST_EQUAL(tmp.getOrder(),0)
 
56
END_SECTION
 
57
 
 
58
START_SECTION((void setOrder(Int order)))
 
59
        IonDetector tmp;
 
60
        tmp.setOrder(4711);
 
61
        TEST_EQUAL(tmp.getOrder(),4711)
 
62
END_SECTION
 
63
 
 
64
START_SECTION((Type getType() const))
 
65
  IonDetector tmp;
 
66
  TEST_EQUAL(tmp.getType(),IonDetector::TYPENULL);
 
67
END_SECTION
 
68
 
 
69
START_SECTION((void setType(Type type)))
 
70
  IonDetector tmp;
 
71
  tmp.setType(IonDetector::ELECTRONMULTIPLIER);
 
72
  TEST_EQUAL(tmp.getType(),IonDetector::ELECTRONMULTIPLIER);
 
73
END_SECTION
 
74
 
 
75
START_SECTION((DoubleReal getADCSamplingFrequency() const ))
 
76
  IonDetector tmp;
 
77
  TEST_EQUAL(tmp.getADCSamplingFrequency(),0);
 
78
END_SECTION
 
79
 
 
80
START_SECTION((void setADCSamplingFrequency(DoubleReal ADC_sampling_frequency)))
 
81
  IonDetector tmp;
 
82
  tmp.setADCSamplingFrequency(47.11);
 
83
  TEST_REAL_SIMILAR(tmp.getADCSamplingFrequency(),47.11);
 
84
END_SECTION
 
85
 
 
86
START_SECTION((DoubleReal getResolution() const ))
 
87
  IonDetector tmp;
 
88
  TEST_EQUAL(tmp.getResolution(),0);
 
89
END_SECTION
 
90
 
 
91
START_SECTION((void setResolution(DoubleReal resolution)))
 
92
  IonDetector tmp;
 
93
  tmp.setResolution(47.11);
 
94
  TEST_REAL_SIMILAR(tmp.getResolution(),47.11);
 
95
END_SECTION
 
96
 
 
97
START_SECTION((AcquisitionMode getAcquisitionMode() const))
 
98
  IonDetector tmp;
 
99
  TEST_EQUAL(tmp.getAcquisitionMode(),IonDetector::ACQMODENULL);
 
100
END_SECTION
 
101
 
 
102
START_SECTION((void setAcquisitionMode(AcquisitionMode acquisition_mode)))
 
103
  IonDetector tmp;
 
104
  tmp.setAcquisitionMode(IonDetector::PULSECOUNTING);
 
105
  TEST_EQUAL(tmp.getAcquisitionMode(),IonDetector::PULSECOUNTING);
 
106
END_SECTION
 
107
 
 
108
START_SECTION((IonDetector(const IonDetector& source)))
 
109
        IonDetector tmp;
 
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"));
 
115
  tmp.setOrder(45);
 
116
  
 
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)
 
124
END_SECTION
 
125
 
 
126
START_SECTION((IonDetector& operator= (const IonDetector& source)))
 
127
        IonDetector tmp;
 
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"));
 
133
  tmp.setOrder(45);
 
134
  
 
135
  IonDetector tmp2;
 
136
  tmp2 = tmp;   
 
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)
 
143
 
 
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)
 
151
END_SECTION
 
152
 
 
153
START_SECTION((bool operator== (const IonDetector& rhs) const))
 
154
        IonDetector edit,empty;
 
155
        
 
156
        TEST_EQUAL(edit==empty,true);
 
157
        
 
158
  edit.setResolution(47.11);
 
159
  TEST_EQUAL(edit==empty,false);
 
160
  
 
161
  edit = empty;
 
162
  edit.setADCSamplingFrequency(47.21);
 
163
  TEST_EQUAL(edit==empty,false);
 
164
  
 
165
  edit = empty;
 
166
  edit.setAcquisitionMode(IonDetector::PULSECOUNTING);
 
167
  TEST_EQUAL(edit==empty,false);
 
168
  
 
169
  edit = empty;
 
170
  edit.setType(IonDetector::ELECTRONMULTIPLIER);
 
171
  TEST_EQUAL(edit==empty,false);
 
172
  
 
173
  edit = empty;
 
174
  edit.setMetaValue("label",String("label"));
 
175
        TEST_EQUAL(edit==empty,false);
 
176
 
 
177
  edit = empty;
 
178
  edit.setOrder(45);
 
179
        TEST_EQUAL(edit==empty,false);
 
180
END_SECTION
 
181
 
 
182
START_SECTION((bool operator!= (const IonDetector& rhs) const))
 
183
        IonDetector edit,empty;
 
184
        
 
185
        TEST_EQUAL(edit!=empty,false);
 
186
        
 
187
  edit.setResolution(47.11);
 
188
  TEST_EQUAL(edit!=empty,true);
 
189
  
 
190
  edit = empty;
 
191
  edit.setADCSamplingFrequency(47.21);
 
192
  TEST_EQUAL(edit!=empty,true);
 
193
  
 
194
  edit = empty;
 
195
  edit.setAcquisitionMode(IonDetector::PULSECOUNTING);
 
196
  TEST_EQUAL(edit!=empty,true);
 
197
  
 
198
  edit = empty;
 
199
  edit.setType(IonDetector::ELECTRONMULTIPLIER);
 
200
  TEST_EQUAL(edit!=empty,true);
 
201
  
 
202
  edit = empty;
 
203
  edit.setMetaValue("label",String("label"));
 
204
        TEST_EQUAL(edit!=empty,true);
 
205
        
 
206
  edit = empty;
 
207
  edit.setOrder(45);
 
208
        TEST_EQUAL(edit!=empty,true);
 
209
END_SECTION
 
210
 
 
211
 
 
212
 
 
213
 
 
214
/////////////////////////////////////////////////////////////
 
215
/////////////////////////////////////////////////////////////
 
216
END_TEST
 
217
 
 
218
 
 
219