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

« back to all changes in this revision

Viewing changes to source/TEST/IsotopeDiffFilter_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: Andreas Bertsch $
 
26
// --------------------------------------------------------------------------
 
27
//
 
28
 
 
29
#include <OpenMS/CONCEPT/ClassTest.h>
 
30
 
 
31
///////////////////////////
 
32
 
 
33
#include <OpenMS/FILTERING/TRANSFORMERS/IsotopeDiffFilter.h>
 
34
#include <OpenMS/KERNEL/StandardTypes.h>
 
35
#include <OpenMS/FORMAT/DTAFile.h>
 
36
 
 
37
using namespace OpenMS;
 
38
using namespace std;
 
39
 
 
40
///////////////////////////
 
41
 
 
42
START_TEST(IsotopeDiffFilter, "$Id: IsotopeDiffFilter_test.C 8215 2011-03-29 14:18:26Z aiche $")
 
43
 
 
44
/////////////////////////////////////////////////////////////
 
45
 
 
46
IsotopeDiffFilter* e_ptr = 0;
 
47
IsotopeDiffFilter* e_nullPointer = 0;
 
48
 
 
49
START_SECTION((IsotopeDiffFilter()))
 
50
        e_ptr = new IsotopeDiffFilter;
 
51
  TEST_NOT_EQUAL(e_ptr, e_nullPointer)
 
52
END_SECTION
 
53
 
 
54
START_SECTION((~IsotopeDiffFilter()))
 
55
        delete e_ptr;
 
56
END_SECTION
 
57
 
 
58
e_ptr = new IsotopeDiffFilter();
 
59
 
 
60
START_SECTION((IsotopeDiffFilter(const IsotopeDiffFilter& source)))
 
61
        IsotopeDiffFilter copy(*e_ptr);
 
62
        TEST_EQUAL(copy.getParameters(), e_ptr->getParameters())
 
63
        TEST_EQUAL(copy.getName(), e_ptr->getName())
 
64
END_SECTION
 
65
 
 
66
START_SECTION((IsotopeDiffFilter& operator = (const IsotopeDiffFilter& source)))
 
67
        IsotopeDiffFilter copy;
 
68
        copy = *e_ptr;
 
69
        TEST_EQUAL(copy.getParameters(), e_ptr->getParameters())
 
70
        TEST_EQUAL(copy.getName(), e_ptr->getName())
 
71
END_SECTION
 
72
 
 
73
START_SECTION((template<typename SpectrumType> double apply(SpectrumType& spectrum)))
 
74
        DTAFile dta_file;
 
75
        PeakSpectrum spec;
 
76
        dta_file.load(OPENMS_GET_TEST_DATA_PATH("Transformers_tests.dta"), spec);
 
77
 
 
78
        double filter = e_ptr->apply(spec);
 
79
        TEST_REAL_SIMILAR(filter, 0.0)
 
80
 
 
81
        Param p(e_ptr->getParameters());
 
82
        p.setValue("tolerance", 10.0);
 
83
        e_ptr->setParameters(p);
 
84
        filter = e_ptr->apply(spec);
 
85
        TEST_REAL_SIMILAR(filter, 2162)
 
86
END_SECTION
 
87
 
 
88
START_SECTION((static FilterFunctor* create()))
 
89
        FilterFunctor* ff = IsotopeDiffFilter::create();
 
90
        IsotopeDiffFilter filter;
 
91
        TEST_EQUAL(ff->getParameters(), filter.getParameters())
 
92
        TEST_EQUAL(ff->getName(), filter.getName())
 
93
END_SECTION
 
94
 
 
95
START_SECTION((static const String getProductName()))
 
96
        TEST_EQUAL(e_ptr->getProductName(), "IsotopeDiffFilter")
 
97
END_SECTION
 
98
 
 
99
delete e_ptr;
 
100
 
 
101
/////////////////////////////////////////////////////////////
 
102
/////////////////////////////////////////////////////////////
 
103
END_TEST