ProteoWizard
CalibrationParametersTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2006 Louis Warschaw Prostate Cancer Center
8// Cedars Sinai Medical Center, Los Angeles, California 90048
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21//
22
23
27#include <cstring>
28
29
30using namespace pwiz::util;
31using namespace pwiz::data;
32
33
34ostream* os_ = 0;
35
36
37void test()
38{
41
42 unit_assert(p!=q);
43 q.A = thermoA_FT_;
44 q.B = thermoB_FT_;
45 unit_assert(p==q);
46
47 double dummy = 420;
48 double epsilon = 1e-13;
49 unit_assert_equal(dummy, p.mz(p.frequency(dummy)), epsilon);
50 unit_assert_equal(dummy, p.frequency(p.mz(dummy)), epsilon);
51
53 unit_assert_equal(dummy, p2.mz(p2.frequency(dummy)), epsilon);
54 unit_assert_equal(dummy, p2.frequency(p2.mz(dummy)), epsilon);
55}
56
57
58int main(int argc, char* argv[])
59{
60 TEST_PROLOG(argc, argv)
61
62 try
63 {
64 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
65 if (os_) *os_ << "CalibrationParametersTest\n";
66 test();
67 }
68 catch (exception& e)
69 {
70 TEST_FAILED(e.what())
71 }
72 catch (...)
73 {
74 TEST_FAILED("Caught unknown exception.")
75 }
76
78}
79
int main(int argc, char *argv[])
ostream * os_
const double epsilon
Definition DiffTest.cpp:41
const double thermoB_FT_
const double thermoA_FT_
static CalibrationParameters thermo_FT()
double mz(double frequency) const
static CalibrationParameters thermo_Orbitrap()
#define unit_assert(x)
Definition unit.hpp:85
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175