ProteoWizard
PeptideIDMapTest.cpp
Go to the documentation of this file.
1//
2// $Id$
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"
27
28
29using namespace pwiz::util;
30using namespace pwiz::peptideid;
31
32
33void 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, 1e-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, 1e-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, 1e-15);
61}
62
63
64int main(int argc, 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
82}
83
int main(int argc, char *argv[])
void test()
virtual Record record(const pwiz::peptideid::PeptideID::Location &location) const
#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