testExpandedNodes

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#include <cppunit/extensions/HelperMacros.h>

#include "DetectorDescription/DDCMS/interface/ExpandedNodes.h"

#include <iostream>

#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"

using namespace cms;
using namespace std;

class testExpandedNodes : public CppUnit::TestFixture {
  CPPUNIT_TEST_SUITE(testExpandedNodes);
  CPPUNIT_TEST(checkExpandedNodes);
  CPPUNIT_TEST_SUITE_END();

public:
  void setUp() override;
  void tearDown() override {}
  void checkExpandedNodes();

private:
  ExpandedNodes nodes_;
};

CPPUNIT_TEST_SUITE_REGISTRATION(testExpandedNodes);

void testExpandedNodes::setUp() {
  nodes_.tags = {1., 2., 3.};
  nodes_.offsets = {1., 2., 3.};
  nodes_.copyNos = {1, 2, 3};
}

void testExpandedNodes::checkExpandedNodes() {
  cout << "Expanded Nodes...\n";
  CPPUNIT_ASSERT(nodes_.tags.size() == nodes_.offsets.size());
  CPPUNIT_ASSERT(nodes_.tags.size() == nodes_.copyNos.size());

  for (auto const& i : nodes_.tags)
    cout << i << " ";
}