ProteoWizard
Main Page
Namespaces
Classes
Files
File List
File Members
pwiz
analysis
calibration
CalibratorTrialTest.cpp
Go to the documentation of this file.
1
//
2
// $Id: CalibratorTrialTest.cpp 1191 2009-08-14 19:33:05Z chambm $
3
//
4
//
5
// Darren Kessner <darren@proteowizard.org>
6
//
7
// Copyright 2009 Spielberg Family Center for Applied Proteomics
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
24
#include "
CalibratorTrial.hpp
"
25
#include "
pwiz/utility/misc/unit.hpp
"
26
#include <iostream>
27
28
29
using namespace
std;
30
using namespace
pwiz::util;
31
using namespace
pwiz::calibration;
32
using namespace
pwiz::data;
33
34
35
void
testConfiguration
()
36
{
37
CalibratorTrial::Configuration
good;
38
39
good.
trueMasses
.push_back(1.23);
40
good.
trueMasses
.push_back(4.56);
41
good.
trueMasses
.push_back(5.67);
42
good.
measurements
.push_back(
Calibrator::Measurement
(12.3,1));
43
good.
measurements
.push_back(
Calibrator::Measurement
(45.6,2));
44
good.
measurements
.push_back(
Calibrator::Measurement
(78.9,3));
45
good.
parametersTrue
= CalibrationParameters::thermo_FT();
46
good.
parametersInitialEstimate
=
CalibrationParameters
(1,2);
47
good.
measurementError
= 2.34567891e-6;
48
good.
initialErrorEstimate
= 1.23456789e-6;
49
50
const
string
& filename =
"CalibratorTrialTest.temp.txt"
;
51
good.
writeTrialData
(filename);
52
CalibratorTrial::Configuration
test
;
53
test.
readTrialData
(filename);
54
55
unit_assert
(good.
trueMasses
== test.
trueMasses
);
56
unit_assert
(good.
measurements
== test.
measurements
);
57
unit_assert
(good.
parametersTrue
== test.
parametersTrue
);
58
unit_assert
(good.
parametersInitialEstimate
== test.
parametersInitialEstimate
);
59
unit_assert
(good.
initialErrorEstimate
== test.
initialErrorEstimate
);
60
unit_assert
(good.
measurementError
== test.
measurementError
);
61
62
system((
"rm "
+ filename).c_str());
63
}
64
65
66
int
main
()
67
{
68
try
69
{
70
testConfiguration
();
71
return
0;
72
}
73
catch
(exception&
e
)
74
{
75
cerr << e.what() << endl;
76
return
1;
77
}
78
}
79
Generated on Mon Nov 26 2012 18:05:46 for ProteoWizard by
1.8.1.1