ProteoWizard
SpectrumListBaseTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: 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 "SpectrumListBase.hpp"
27
28using namespace pwiz::msdata;
29using namespace pwiz::util;
30
31
32class MyBase : public SpectrumListBase
33{
34 public:
35 virtual size_t size() const {return 0;}
36 virtual const SpectrumIdentity& spectrumIdentity(size_t index) const {throw runtime_error("heh");}
37 virtual SpectrumPtr spectrum(size_t index, bool getBinaryData = false) const {return SpectrumPtr();}
38
39 // make sure we still compile -- error if setDataProcessingPtr() renamed to dataProcessingPtr()
40 virtual const boost::shared_ptr<const DataProcessing> dataProcessingPtr() const {return dp_;}
41};
42
43
44void test()
45{
46 MyBase base;
48 base.setDataProcessingPtr(dp);
49 unit_assert(base.dataProcessingPtr().get() == dp.get());
50}
51
52
53int main(int argc, char* argv[])
54{
55 TEST_PROLOG(argc, argv)
56
57 try
58 {
59 test();
60 }
61 catch (exception& e)
62 {
63 TEST_FAILED(e.what())
64 }
65 catch (...)
66 {
67 TEST_FAILED("Caught unknown exception.")
68 }
69
71}
72
73
int main(int argc, char *argv[])
void test()
virtual size_t size() const
returns the number of chromatograms
virtual const SpectrumIdentity & spectrumIdentity(size_t index) const
access to a spectrum index
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const
retrieve a spectrum by index
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
implementation of ChromatogramList
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
common functionality for base SpectrumList implementations
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition MSData.hpp:288
boost::shared_ptr< Spectrum > SpectrumPtr
Definition MSData.hpp:573
Description of the way in which a particular software was used.
Definition MSData.hpp:274
Identifying information for a spectrum.
Definition MSData.hpp:471
#define unit_assert(x)
Definition unit.hpp:85
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175