Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:55:04

0001 #include <cppunit/extensions/HelperMacros.h>
0002 
0003 #include "DetectorDescription/DDCMS/interface/DDSolidShapes.h"
0004 
0005 #include <iostream>
0006 
0007 #include "cppunit/TestAssert.h"
0008 #include "cppunit/TestFixture.h"
0009 
0010 using namespace cms;
0011 using namespace std;
0012 
0013 class testDDSolidShapes : public CppUnit::TestFixture {
0014   CPPUNIT_TEST_SUITE(testDDSolidShapes);
0015   CPPUNIT_TEST(checkDDSolidShapes);
0016   CPPUNIT_TEST_SUITE_END();
0017 
0018 public:
0019   void setUp() override;
0020   void tearDown() override {}
0021   void checkDDSolidShapes();
0022 
0023 private:
0024   std::string solidName_;
0025 };
0026 
0027 CPPUNIT_TEST_SUITE_REGISTRATION(testDDSolidShapes);
0028 
0029 void testDDSolidShapes::setUp() { solidName_ = "Trap"; }
0030 
0031 void testDDSolidShapes::checkDDSolidShapes() {
0032   cms::DDSolidShape shape = cms::dd::value(cms::DDSolidShapeMap, solidName_);
0033   CPPUNIT_ASSERT(shape == cms::DDSolidShape::ddtrap);
0034 
0035   std::string name = cms::dd::name(cms::DDSolidShapeMap, shape);
0036   CPPUNIT_ASSERT(name == solidName_);
0037 
0038   cms::DDSolidShape invalidShape = cms::dd::value(cms::DDSolidShapeMap, "Blah Blah Blah");
0039   CPPUNIT_ASSERT(invalidShape == cms::DDSolidShape::dd_not_init);
0040 
0041   std::string invalidName = cms::dd::name(cms::DDSolidShapeMap, invalidShape);
0042   CPPUNIT_ASSERT(invalidName == std::string("Solid not initialized"));
0043 }