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

« back to all changes in this revision

Viewing changes to source/TEST/TraceFitter_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: Stephan Aiche$
 
25
// $Authors: Stephan Aiche$
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#include <OpenMS/CONCEPT/ClassTest.h>
 
29
 
 
30
///////////////////////////
 
31
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/TraceFitter.h>
 
32
#include <OpenMS/KERNEL/Peak1D.h>
 
33
///////////////////////////
 
34
 
 
35
using namespace OpenMS;
 
36
using namespace std;
 
37
 
 
38
// dummy implementation for the test
 
39
template <class PeakType>
 
40
class DerivedTraceFitter
 
41
    : public TraceFitter<PeakType>
 
42
{
 
43
 
 
44
public:
 
45
 
 
46
    void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces<PeakType>&)
 
47
    {
 
48
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
49
    }
 
50
 
 
51
    DoubleReal getLowerRTBound() const
 
52
    {
 
53
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
54
    }
 
55
 
 
56
    DoubleReal getUpperRTBound() const
 
57
    {
 
58
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
59
    }
 
60
 
 
61
    DoubleReal getHeight() const
 
62
    {
 
63
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
64
    }
 
65
 
 
66
    DoubleReal getCenter() const
 
67
    {
 
68
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
69
    }
 
70
 
 
71
    DoubleReal getFWHM() const
 
72
    {
 
73
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
74
    }
 
75
 
 
76
    DoubleReal computeTheoretical(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace<PeakType>&, Size)
 
77
    {
 
78
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
79
    }
 
80
 
 
81
    bool checkMinimalRTSpan(const std::pair<double, double>&, const DoubleReal)
 
82
    {
 
83
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
84
    }
 
85
 
 
86
    bool checkMaximalRTSpan(const DoubleReal)
 
87
    {
 
88
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
89
    }
 
90
 
 
91
    DoubleReal getFeatureIntensityContribution()
 
92
    {
 
93
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
94
    }
 
95
 
 
96
    String getGnuplotFormula(FeatureFinderAlgorithmPickedHelperStructs::MassTrace<PeakType> const &, const char, const DoubleReal, const DoubleReal)
 
97
    {
 
98
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
99
    }
 
100
 
 
101
    void printState_(SignedSize, gsl_multifit_fdfsolver*)
 
102
    {
 
103
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
104
    }
 
105
 
 
106
    void getOptimizedParameters_(gsl_multifit_fdfsolver*)
 
107
    {
 
108
        throw Exception::NotImplemented(__FILE__,__LINE__,__PRETTY_FUNCTION__);
 
109
    }
 
110
 
 
111
};
 
112
 
 
113
START_TEST(TraceFitter, "$Id: TraceFitter_test.C 9385 2011-12-22 13:00:16Z aiche $")
 
114
 
 
115
/////////////////////////////////////////////////////////////
 
116
/////////////////////////////////////////////////////////////
 
117
 
 
118
TraceFitter<Peak1D>* ptr = 0;
 
119
TraceFitter<Peak1D>* nullPointer = 0;
 
120
START_SECTION(TraceFitter())
 
121
{
 
122
    ptr = new DerivedTraceFitter<Peak1D>();
 
123
        TEST_NOT_EQUAL(ptr, nullPointer)
 
124
}
 
125
END_SECTION
 
126
 
 
127
START_SECTION(~TraceFitter())
 
128
{
 
129
        delete ptr;
 
130
}
 
131
END_SECTION
 
132
 
 
133
START_SECTION((TraceFitter(const TraceFitter &source)))
 
134
{
 
135
  NOT_TESTABLE
 
136
  // has no public members to check if copy has same proberties
 
137
}
 
138
END_SECTION
 
139
 
 
140
START_SECTION((virtual TraceFitter& operator=(const TraceFitter &source)))
 
141
{
 
142
  NOT_TESTABLE
 
143
  // has no public members to check if copy has same proberties
 
144
}
 
145
END_SECTION
 
146
 
 
147
DerivedTraceFitter<Peak1D> trace_fitter;
 
148
START_SECTION((virtual void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces< PeakType > &traces)=0))
 
149
{
 
150
  FeatureFinderAlgorithmPickedHelperStructs::MassTraces<Peak1D> m;
 
151
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.fit(m))
 
152
}
 
153
END_SECTION
 
154
 
 
155
START_SECTION((virtual DoubleReal getLowerRTBound() const ))
 
156
{
 
157
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getLowerRTBound())
 
158
}
 
159
END_SECTION
 
160
 
 
161
START_SECTION((virtual DoubleReal getUpperRTBound() const ))
 
162
{
 
163
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getUpperRTBound())
 
164
}
 
165
END_SECTION
 
166
 
 
167
START_SECTION((virtual DoubleReal getHeight() const ))
 
168
{
 
169
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getHeight())
 
170
}
 
171
END_SECTION
 
172
 
 
173
START_SECTION((virtual DoubleReal getCenter() const ))
 
174
{
 
175
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getCenter())
 
176
}
 
177
END_SECTION
 
178
 
 
179
START_SECTION((virtual DoubleReal computeTheoretical(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace< PeakType > &trace, Size k)=0))
 
180
{
 
181
  FeatureFinderAlgorithmPickedHelperStructs::MassTrace<Peak1D> mt;
 
182
  Size i = 0;
 
183
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.computeTheoretical(mt,i))
 
184
}
 
185
END_SECTION
 
186
 
 
187
START_SECTION((virtual bool checkMinimalRTSpan(const std::pair< DoubleReal, DoubleReal > &rt_bounds, const DoubleReal min_rt_span)=0))
 
188
{
 
189
  std::pair<DoubleReal, DoubleReal> p;
 
190
  DoubleReal x = 0.0;
 
191
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.checkMinimalRTSpan(p,x))
 
192
}
 
193
END_SECTION
 
194
 
 
195
START_SECTION((virtual bool checkMaximalRTSpan(const DoubleReal max_rt_span)=0))
 
196
{
 
197
  DoubleReal x = 0.0;
 
198
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.checkMaximalRTSpan(x))
 
199
}
 
200
END_SECTION
 
201
 
 
202
START_SECTION((virtual DoubleReal getFeatureIntensityContribution()))
 
203
{
 
204
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getFeatureIntensityContribution())
 
205
}
 
206
END_SECTION
 
207
 
 
208
START_SECTION((virtual String getGnuplotFormula(FeatureFinderAlgorithmPickedHelperStructs::MassTrace< PeakType > const &trace, const char function_name, const DoubleReal baseline, const DoubleReal rt_shift)=0))
 
209
{
 
210
  FeatureFinderAlgorithmPickedHelperStructs::MassTrace<Peak1D> mt;
 
211
  DoubleReal shift = 0.0;
 
212
  DoubleReal baseline = 0.0;
 
213
  char f = 'f';
 
214
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getGnuplotFormula(mt, f, baseline, shift))
 
215
}
 
216
END_SECTION
 
217
 
 
218
START_SECTION((virtual DoubleReal getFWHM() const))
 
219
{
 
220
  TEST_EXCEPTION(Exception::NotImplemented, trace_fitter.getFWHM())
 
221
}
 
222
END_SECTION
 
223
 
 
224
/////////////////////////////////////////////////////////////
 
225
/////////////////////////////////////////////////////////////
 
226
END_TEST
 
227
 
 
228
 
 
229