Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:39

0001 #define CATCH_CONFIG_MAIN
0002 #include "catch.hpp"
0003 #include "DataFormats/Provenance/interface/ProcessConfiguration.h"
0004 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "FWCore/Utilities/interface/Exception.h"
0007 
0008 #include <cassert>
0009 #include <iostream>
0010 #include <string>
0011 
0012 TEST_CASE("test ProcessConfiguration", "[ProcessConfiguration]") {
0013   edm::ParameterSet dummyPset;
0014   dummyPset.registerIt();
0015   edm::ParameterSetID id = dummyPset.id();
0016   SECTION("default initialize") {
0017     SECTION("self operator==") {
0018       edm::ProcessConfiguration pc1;
0019       pc1.setParameterSetID(id);
0020       REQUIRE(pc1 == pc1);
0021     }
0022     SECTION("equivalence") {
0023       edm::ProcessConfiguration pc1;
0024       edm::ProcessConfiguration pc2;
0025       pc1.setParameterSetID(id);
0026       pc2.setParameterSetID(id);
0027       REQUIRE(pc1 == pc2);
0028     }
0029   }
0030   SECTION("non-default initialized") {
0031     edm::ProcessConfiguration pc1;
0032     edm::ProcessConfiguration pc2("reco2", edm::ParameterSetID(), std::string(), std::string());
0033     edm::ProcessConfiguration pc3("reco3", edm::ParameterSetID(), std::string(), std::string());
0034     pc1.setParameterSetID(id);
0035     pc2.setParameterSetID(id);
0036     pc3.setParameterSetID(id);
0037     edm::ProcessConfigurationID id1 = pc1.id();
0038     edm::ProcessConfigurationID id2 = pc2.id();
0039     edm::ProcessConfigurationID id3 = pc3.id();
0040 
0041     SECTION("non-equivalence") {
0042       REQUIRE(id1 != id2);
0043       REQUIRE(id2 != id3);
0044       REQUIRE(id3 != id1);
0045     }
0046 
0047     SECTION("equivalence") {
0048       edm::ProcessConfiguration pc4("reco2", edm::ParameterSetID(), std::string(), std::string());
0049       pc4.setParameterSetID(id);
0050       edm::ProcessConfigurationID id4 = pc4.id();
0051       REQUIRE(pc4 == pc2);
0052       REQUIRE(id4 == id2);
0053     }
0054   }
0055 }