Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:40

0001 #include "catch.hpp"
0002 
0003 #include "DQMOffline/Trigger/interface/EgHLTComCodes.h"
0004 #include "DQMOffline/Trigger/interface/EgHLTEgCutCodes.h"
0005 
0006 TEST_CASE("EgHLTComCodes", "[EgHLTComCodes]") {
0007   egHLT::ComCodes codes;
0008 
0009   constexpr unsigned int kFoo = 0b1;
0010   constexpr unsigned int kBar = 0b10;
0011   constexpr unsigned int kIsh = 0b100;
0012   constexpr unsigned int kTar = 0b1000;
0013   constexpr unsigned int kash = 0b10000;
0014 
0015   codes.setCode("Foo", kFoo);
0016   codes.setCode("Bar", kBar);
0017   codes.setCode("Ish", kIsh);
0018   codes.setCode("Tar", kTar);
0019   codes.setCode("ash", kash);
0020   codes.sort();
0021 
0022   SECTION("Sorted") {
0023     REQUIRE(codes.getCode("ash") == kash);
0024     REQUIRE(codes.getCode("Bar") == kBar);
0025     REQUIRE(codes.getCode("Foo") == kFoo);
0026     REQUIRE(codes.getCode("Ish") == kIsh);
0027     REQUIRE(codes.getCode("Tar") == kTar);
0028   }
0029 
0030   SECTION("Select multiple") {
0031     REQUIRE(codes.getCode("ash:Ish") == (kash | kIsh));
0032     REQUIRE(codes.getCode("Bar:Foo:Tar") == (kBar | kFoo | kTar));
0033     REQUIRE(codes.getCode("Tar:Foo:Bar") == (kTar | kFoo | kBar));
0034   }
0035 
0036   SECTION("Missing") {
0037     REQUIRE(codes.getCode("BAD") == 0);
0038     REQUIRE(codes.getCode("Tar:BAD:Bar") == (kTar | kBar));
0039 
0040     //no partial match
0041     REQUIRE(codes.getCode("as") == 0);
0042     REQUIRE(codes.getCode("ashton") == 0);
0043   }
0044 }
0045 
0046 TEST_CASE("EgHLTCutCodes", "[EgHLTCutCodes]") {
0047   SECTION("get good codes") {
0048     REQUIRE(egHLT::EgCutCodes::getCode("et") == egHLT::EgCutCodes::ET);
0049     REQUIRE(egHLT::EgCutCodes::getCode("maxr9") == egHLT::EgCutCodes::MAXR9);
0050   }
0051 }