BinnedSpectrum::BinnedSpectrum(const BinnedSpectrum& source) :
   bin_spread_(source.getBinSpread()), bin_size_(source.getBinSize()), bins_(source.getBins()), raw_spec_(source.raw_spec_)
 {
 }
Exemplo n.º 2
0
START_SECTION((BinnedSpectrum(const BinnedSpectrum &source)))
{
  BinnedSpectrum copy(*bs1);
  TEST_EQUAL(copy.getName(), bs1->getName());
  TEST_EQUAL(copy.getBinSize(), bs1->getBinSize());
  TEST_EQUAL((UInt)copy.getPrecursors()[0].getMZ(),(UInt)bs1->getPrecursors()[0].getMZ());
}
END_SECTION

START_SECTION((BinnedSpectrum& operator=(const BinnedSpectrum &source)))
{
  BinnedSpectrum copy(*bs1);
  bs1 = new BinnedSpectrum(1.5,2,s1);
  TEST_EQUAL(copy.getName(), bs1->getName());
  TEST_EQUAL(copy.getBinSize(), bs1->getBinSize());
  TEST_EQUAL((UInt)copy.getPrecursors()[0].getMZ(),(UInt)bs1->getPrecursors()[0].getMZ());
}
END_SECTION

START_SECTION((BinnedSpectrum& operator=(const PeakSpectrum &source)))
{
  bs1 = new BinnedSpectrum();
  *bs1 = s1;
  TEST_EQUAL(bs1->getPrecursors()[0].getMZ(),s1.getPrecursors()[0].getMZ());
  bs1->setBinSize(1.5);
  bs1->setBinSpread(2);
}
END_SECTION

START_SECTION((bool operator==(const BinnedSpectrum &rhs) const ))
 //yields false if given BinnedSpectrum size or spread differs from this one (comparing those might crash)
 bool BinnedSpectrum::checkCompliance(const BinnedSpectrum& bs) const
 {
   return (this->bin_size_ == bs.getBinSize()) &&
          (this->bin_spread_ == bs.getBinSpread());
 }