ProteoWizard
Main Page
Namespaces
Classes
Files
File List
File Members
pwiz
analysis
peptideid
PeptideIDMapTest.cpp
Go to the documentation of this file.
1
//
2
// $Id: PeptideIDMapTest.cpp 4129 2012-11-20 00:05:37Z chambm $
3
//
4
//
5
// Original author: Darren Kessner <darren@proteowizard.org>
6
//
7
// Copyright 2008 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 "
PeptideIDMap.hpp
"
25
#include "
pwiz/utility/misc/unit.hpp
"
26
#include "
pwiz/utility/misc/Std.hpp
"
27
28
29
using namespace
pwiz::util;
30
using namespace
pwiz::peptideid;
31
32
33
void
test
()
34
{
35
PeptideIDMap
peptideIDMap;
36
37
PeptideID::Record
*
record
= &peptideIDMap[
"1"
];
38
record->
nativeID
=
"1"
;
39
record->
sequence
=
"DARREN"
;
40
record->
normalizedScore
= .5;
41
42
record = &peptideIDMap[
"2"
];
43
record->
nativeID
=
"2"
;
44
record->
sequence
=
"KESSNER"
;
45
record->
normalizedScore
= .6;
46
47
PeptideID::Record
result = peptideIDMap.
record
(
PeptideID::Location
(
"goober"
, 0, 0));
48
unit_assert
(result.
nativeID
.empty());
49
unit_assert
(result.
sequence
.empty());
50
unit_assert_equal
(result.
normalizedScore
, 0, 1
e
-15);
51
52
result = peptideIDMap.
record
(
PeptideID::Location
(
"1"
, 0, 0));
53
unit_assert
(result.
nativeID
==
"1"
);
54
unit_assert
(result.
sequence
==
"DARREN"
);
55
unit_assert_equal
(result.
normalizedScore
, .5, 1
e
-15);
56
57
result = peptideIDMap.
record
(
PeptideID::Location
(
"2"
, 0, 0));
58
unit_assert
(result.
nativeID
==
"2"
);
59
unit_assert
(result.
sequence
==
"KESSNER"
);
60
unit_assert_equal
(result.
normalizedScore
, .6, 1
e
-15);
61
}
62
63
64
int
main
(
int
argc,
const
char
* argv[])
65
{
66
TEST_PROLOG
(argc, argv)
67
68
try
69
{
70
test
();
71
}
72
catch
(exception&
e
)
73
{
74
TEST_FAILED
(e.what())
75
}
76
catch
(...)
77
{
78
TEST_FAILED
(
"Caught unknown exception."
)
79
}
80
81
TEST_EPILOG
82
}
83
Generated on Mon Nov 26 2012 18:05:47 for ProteoWizard by
1.8.1.1