Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include <cmath>
0002 #include <iomanip>
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FWCore/Utilities/interface/StreamID.h"
0009 
0010 namespace edmtest {
0011 
0012   class UnitTestClient_C : public edm::global::EDAnalyzer<> {
0013   public:
0014     explicit UnitTestClient_C(edm::ParameterSet const&) {}
0015 
0016     void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
0017   };
0018 
0019   void UnitTestClient_C::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {
0020     int i = 145;
0021     edm::LogWarning("cat_A") << "Test of std::hex: " << i << std::hex << " in hex is " << i;
0022     edm::LogWarning("cat_A") << "Test of std::setw(n) and std::setfill('c'): "
0023                              << "The following should read ++abcdefg $$$12: " << std::setfill('+') << std::setw(9)
0024                              << "abcdefg" << std::setw(5) << std::setfill('$') << 12;
0025     double d = M_PI;
0026     edm::LogWarning("cat_A") << "Test of std::setprecision(p): "
0027                              << "Pi with precision 12 is " << std::setprecision(12) << d;
0028     edm::LogWarning("cat_A") << "Test of spacing: "
0029                              << "The following should read a b c dd: "
0030                              << "a" << std::setfill('+') << "b" << std::hex << "c" << std::setw(2) << "dd";
0031 
0032     edm::LogWarning("cat_A").format("Test of format hex: {0} in hex is {0:x}", i);
0033     edm::LogWarning("cat_A")
0034         .format("Test of format fill and width: ")
0035         .format("The following should read ++abcdefg $$$12: {:+>9} {:$>5}", "abcdefg", 12);
0036     edm::LogWarning("cat_A").vformat(std::string("Test of format precision: Pi with precision 12 is {:.12g}"),
0037                                      fmt::make_format_args(d));
0038     edm::LogWarning("cat_A").vformat("Test of format spacing: The following should read a b cc: {} {:+>} {:>2}",
0039                                      fmt::make_format_args("a", "b", "cc"));
0040   }
0041 
0042 }  // namespace edmtest
0043 
0044 using edmtest::UnitTestClient_C;
0045 DEFINE_FWK_MODULE(UnitTestClient_C);