ProteoWizard
Main Page
Namespaces
Classes
Files
File List
File Members
pwiz
analysis
proteome_processing
ProteinListFactoryTest.cpp
Go to the documentation of this file.
1
//
2
// $Id: ProteinListFactoryTest.cpp 4129 2012-11-20 00:05:37Z chambm $
3
//
4
//
5
// Original author: Matt Chambers <matt.chambers <a.t> vanderbilt.edu>
6
//
7
// Copyright 2012 Vanderbilt University - Nashville, TN 37232
8
//
9
// Licensed under the Apache License, Version 2.0 (the "License");
10
// you may not use this file except in compliance with the License.
11
// You may obtain a copy of the License at
12
//
13
// http://www.apache.org/licenses/LICENSE-2.0
14
//
15
// Unless required by applicable law or agreed to in writing, software
16
// distributed under the License is distributed on an "AS IS" BASIS,
17
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
// See the License for the specific language governing permissions and
19
// limitations under the License.
20
//
21
22
23
#include "
ProteinListFactory.hpp
"
24
#include "
pwiz/utility/misc/unit.hpp
"
25
#include "
pwiz/utility/misc/Std.hpp
"
26
#include "
pwiz/data/proteome/examples.hpp
"
27
#include <cstring>
28
29
30
using namespace
pwiz::analysis;
31
using namespace
pwiz::util;
32
using namespace
pwiz::proteome;
33
34
35
ostream*
os_
= 0;
36
37
38
void
testUsage
()
39
{
40
if
(
os_
) *
os_
<<
"ProteinListFactory::usage():\n"
<<
ProteinListFactory::usage
() << endl;
41
}
42
43
44
void
testWrap
()
45
{
46
ProteomeData
pd;
47
examples::initializeTiny
(pd);
48
49
ProteinListPtr
& pl = pd.
proteinListPtr
;
50
51
unit_assert
(pl.get());
52
unit_assert_operator_equal
(3, pl->size());
53
54
ProteinListFactory::wrap
(pd,
"id DEFCON42;ZEBRA"
);
55
unit_assert_operator_equal
(2, pl->size());
56
unit_assert_operator_equal
(
"ZEBRA"
, pl->protein(0)->id);
57
unit_assert_operator_equal
(
"DEFCON42"
, pl->protein(1)->id);
58
59
ProteinListFactory::wrap(pd,
"index 1"
);
60
unit_assert_operator_equal
(1, pl->size());
61
unit_assert_operator_equal
(
"DEFCON42"
, pl->protein(0)->id);
62
}
63
64
65
void
test
()
66
{
67
testUsage
();
68
testWrap
();
69
}
70
71
72
int
main
(
int
argc,
char
* argv[])
73
{
74
TEST_PROLOG
(argc, argv)
75
76
try
77
{
78
if
(argc>1 && !strcmp(argv[1],
"-v"
))
os_
= &cout;
79
test
();
80
}
81
catch
(exception&
e
)
82
{
83
TEST_FAILED
(e.what())
84
}
85
catch
(...)
86
{
87
TEST_FAILED
(
"Caught unknown exception."
)
88
}
89
90
TEST_EPILOG
91
}
92
Generated on Mon Nov 26 2012 18:05:47 for ProteoWizard by
1.8.1.1