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

« back to all changes in this revision

Viewing changes to source/TEST/GoodDiffFilter_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/GoodDiffFilter.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(GoodDiffFilter, "$Id: GoodDiffFilter_test.C 8215 2011-03-29 14:18:26Z aiche $")
 
43
 
 
44
/////////////////////////////////////////////////////////////
 
45
 
 
46
GoodDiffFilter* e_ptr = 0;
 
47
GoodDiffFilter* e_nullPointer = 0;
 
48
 
 
49
START_SECTION((GoodDiffFilter()))
 
50
        e_ptr = new GoodDiffFilter;
 
51
  TEST_NOT_EQUAL(e_ptr, e_nullPointer)
 
52
END_SECTION
 
53
 
 
54
START_SECTION((~GoodDiffFilter()))
 
55
        delete e_ptr;
 
56
END_SECTION
 
57
 
 
58
e_ptr = new GoodDiffFilter();
 
59
 
 
60
START_SECTION((GoodDiffFilter(const GoodDiffFilter& source)))
 
61
        GoodDiffFilter 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((GoodDiffFilter& operator=(const GoodDiffFilter& source)))
 
67
        GoodDiffFilter 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
        TOLERANCE_ABSOLUTE(0.01)
 
78
 
 
79
        double filter = e_ptr->apply(spec);
 
80
 
 
81
        TEST_REAL_SIMILAR(filter, 0.104879)
 
82
 
 
83
        Param p(e_ptr->getParameters());
 
84
        p.setValue("tolerance", 10.0);
 
85
        e_ptr->setParameters(p);
 
86
        filter = e_ptr->apply(spec);
 
87
        
 
88
        TEST_REAL_SIMILAR(filter, 0.811684)
 
89
END_SECTION
 
90
 
 
91
START_SECTION((static FilterFunctor* create()))
 
92
        FilterFunctor* ff = GoodDiffFilter::create();
 
93
        GoodDiffFilter good;
 
94
        TEST_EQUAL(ff->getParameters(), good.getParameters())
 
95
        TEST_EQUAL(ff->getName(), good.getName())
 
96
END_SECTION
 
97
 
 
98
START_SECTION((static const String getProductName()))
 
99
        TEST_EQUAL(e_ptr->getProductName(), "GoodDiffFilter")
 
100
END_SECTION
 
101
 
 
102
delete e_ptr;
 
103
 
 
104
/////////////////////////////////////////////////////////////
 
105
/////////////////////////////////////////////////////////////
 
106
END_TEST