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
43
44
45
|
#include <cmath>
#include <iomanip>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/StreamID.h"
namespace edmtest {
class UnitTestClient_C : public edm::global::EDAnalyzer<> {
public:
explicit UnitTestClient_C(edm::ParameterSet const&) {}
void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
};
void UnitTestClient_C::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {
int i = 145;
edm::LogWarning("cat_A") << "Test of std::hex: " << i << std::hex << " in hex is " << i;
edm::LogWarning("cat_A") << "Test of std::setw(n) and std::setfill('c'): "
<< "The following should read ++abcdefg $$$12: " << std::setfill('+') << std::setw(9)
<< "abcdefg" << std::setw(5) << std::setfill('$') << 12;
double d = M_PI;
edm::LogWarning("cat_A") << "Test of std::setprecision(p): "
<< "Pi with precision 12 is " << std::setprecision(12) << d;
edm::LogWarning("cat_A") << "Test of spacing: "
<< "The following should read a b c dd: "
<< "a" << std::setfill('+') << "b" << std::hex << "c" << std::setw(2) << "dd";
edm::LogWarning("cat_A").format("Test of format hex: {0} in hex is {0:x}", i);
edm::LogWarning("cat_A")
.format("Test of format fill and width: ")
.format("The following should read ++abcdefg $$$12: {:+>9} {:$>5}", "abcdefg", 12);
edm::LogWarning("cat_A").vformat(std::string("Test of format precision: Pi with precision 12 is {:.12g}"),
fmt::make_format_args(d));
edm::LogWarning("cat_A").vformat("Test of format spacing: The following should read a b cc: {} {:+>} {:>2}",
fmt::make_format_args("a", "b", "cc"));
}
} // namespace edmtest
using edmtest::UnitTestClient_C;
DEFINE_FWK_MODULE(UnitTestClient_C);
|