ProteoWizard
pwiz
analysis
proteome_processing
ProteinListFactoryTest.cpp
Go to the documentation of this file.
1
//
2
// $Id$
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
main
int main(int argc, char *argv[])
Definition:
ProteinListFactoryTest.cpp:72
pwiz::proteome
Definition:
AminoAcid.hpp:35
pwiz::analysis
Definition:
ChromatogramList_Filter.hpp:37
os_
ostream * os_
Definition:
ProteinListFactoryTest.cpp:35
ProteinListFactory.hpp
test
void test()
Definition:
ProteinListFactoryTest.cpp:65
unit_assert_operator_equal
#define unit_assert_operator_equal(expected, actual)
Definition:
unit.hpp:92
pwiz::proteome::ProteomeData::proteinListPtr
ProteinListPtr proteinListPtr
Definition:
ProteomeData.hpp:92
testUsage
void testUsage()
Definition:
ProteinListFactoryTest.cpp:38
pwiz::util
Definition:
almost_equal.hpp:33
TEST_EPILOG
#define TEST_EPILOG
Definition:
unit.hpp:183
pwiz::analysis::ProteinListFactory::usage
static std::string usage()
user-friendly documentation
pwiz::proteome::ProteomeData
Definition:
ProteomeData.hpp:88
Std.hpp
pwiz::identdata::examples::initializeTiny
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
pwiz::proteome::ProteinListPtr
boost::shared_ptr< ProteinList > ProteinListPtr
Definition:
ProteomeData.hpp:73
TEST_FAILED
#define TEST_FAILED(x)
Definition:
unit.hpp:177
examples.hpp
TEST_PROLOG
#define TEST_PROLOG(argc, argv)
Definition:
unit.hpp:175
testWrap
void testWrap()
Definition:
ProteinListFactoryTest.cpp:44
pwiz::analysis::ProteinListFactory::wrap
static void wrap(proteome::ProteomeData &pd, const std::string &wrapper)
instantiate the ProteinListWrapper indicated by wrapper
unit.hpp
unit_assert
#define unit_assert(x)
Definition:
unit.hpp:85
Generated by
1.8.17