Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in MessageLogger tests #37244

Merged
merged 2 commits into from Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion FWCore/MessageService/bin/Standalone.cpp
Expand Up @@ -9,6 +9,7 @@

----------------------------------------------------------------------*/

#include <cmath>
#include <exception>
#include <iostream>
#include <iomanip>
Expand Down Expand Up @@ -41,7 +42,7 @@ void DoMyStuff() {
// be substantially more complex. This example is about as simple
// as can be.

double d = 3.14159265357989;
double d = M_PI;
edm::LogWarning("cat_A") << "Test of std::setprecision(p):"
<< " Pi with precision 12 is " << std::setprecision(12) << d;

Expand Down
27 changes: 14 additions & 13 deletions FWCore/MessageService/test/UnitTestClient_C.cc
@@ -1,11 +1,12 @@
#include <cmath>
#include <iomanip>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.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"

#include <iomanip>

namespace edmtest {

class UnitTestClient_C : public edm::global::EDAnalyzer<> {
Expand All @@ -17,22 +18,22 @@ namespace edmtest {

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)
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 = 3.14159265357989;
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:"
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("Test of format fill and width: ")
.format("The following should read ++abcdefg $$$12: {:+>9} {:$>5}", "abcdefg", 12);
edm::LogWarning("cat_A").format("Test of format precision:Pi with precision 12 is {:.12g}", d);
edm::LogWarning("cat_A").format("Test of format precision: Pi with precision 12 is {:.12g}", d);
edm::LogWarning("cat_A").format(
"Test of format spacing: The following should read a b cc: {} {:+>} {:>2}", "a", "b", "cc");
}
Expand Down
11 changes: 6 additions & 5 deletions FWCore/MessageService/test/UnitTestClient_G.cc
@@ -1,12 +1,13 @@
#include <cmath>
#include <iomanip>
#include <iostream>

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.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"

#include <iomanip>
#include <iostream>

namespace edmtest {

class UnitTestClient_G : public edm::global::EDAnalyzer<> {
Expand All @@ -21,7 +22,7 @@ namespace edmtest {
std::cerr << "??? It appears that Message Processing is not Set Up???\n\n";
}

double d = 3.14159265357989;
double d = M_PI;
edm::LogWarning("cat_A") << "Test of std::setprecision(p):"
<< " Pi with precision 12 is " << std::setprecision(12) << d;

Expand Down
2 changes: 1 addition & 1 deletion FWCore/MessageService/test/unit_test_outputs/infos.log
@@ -1,6 +1,6 @@
Begin processing the 1st record. Run 1, Event 1, LumiSection 1 on stream 0 at {Timestamp}
%MSG-w cat_A: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Test of std::setprecision(p): Pi with precision 12 is 3.14159265358
Test of std::setprecision(p): Pi with precision 12 is 3.14159265359
%MSG
%MSG-i cat_B: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Emit Info level message 1
Expand Down
12 changes: 6 additions & 6 deletions FWCore/MessageService/test/unit_test_outputs/u10_warnings.log
@@ -1,23 +1,23 @@
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::hex:145in hex is91
Test of std::hex: 145 in hex is 91
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::setw(n) and std::setfill('c'):The following should read ++abcdefg $$$12:++abcdefg$$$12
Test of std::setw(n) and std::setfill('c'): The following should read ++abcdefg $$$12: ++abcdefg$$$12
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::setprecision(p):Pi with precision 12 is3.14159265358
Test of std::setprecision(p): Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of spacing:The following should read a b c dd:abcdd
Test of spacing: The following should read a b c dd: abcdd
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format hex: 145 in hex is 91
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format fill and width:The following should read ++abcdefg $$$12: ++abcdefg $$$12
Test of format fill and width: The following should read ++abcdefg $$$12: ++abcdefg $$$12
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format precision:Pi with precision 12 is 3.14159265358
Test of format precision: Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format spacing: The following should read a b cc: a b cc
Expand Down
2 changes: 1 addition & 1 deletion FWCore/MessageService/test/unit_test_outputs/u20_cerr.log
@@ -1,6 +1,6 @@
Begin processing the 1st record. Run 1, Event 1, LumiSection 1 on stream 0 at {Timestamp}
%MSG-w cat_A: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Test of std::setprecision(p): Pi with precision 12 is 3.14159265358
Test of std::setprecision(p): Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_C: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Emit Warning level message 1
Expand Down
12 changes: 6 additions & 6 deletions FWCore/MessageService/test/unit_test_outputs/u6_warnings.log
@@ -1,23 +1,23 @@
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::hex:145in hex is91
Test of std::hex: 145 in hex is 91
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::setw(n) and std::setfill('c'):The following should read ++abcdefg $$$12:++abcdefg$$$12
Test of std::setw(n) and std::setfill('c'): The following should read ++abcdefg $$$12: ++abcdefg$$$12
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of std::setprecision(p):Pi with precision 12 is3.14159265358
Test of std::setprecision(p): Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of spacing:The following should read a b c dd:abcdd
Test of spacing: The following should read a b c dd: abcdd
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format hex: 145 in hex is 91
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format fill and width:The following should read ++abcdefg $$$12: ++abcdefg $$$12
Test of format fill and width: The following should read ++abcdefg $$$12: ++abcdefg $$$12
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format precision:Pi with precision 12 is 3.14159265358
Test of format precision: Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_A: UnitTestClient_C:sendSomeMessages Run: 1 Event: 1
Test of format spacing: The following should read a b cc: a b cc
Expand Down
2 changes: 1 addition & 1 deletion FWCore/MessageService/test/unit_test_outputs/warnings.log
@@ -1,5 +1,5 @@
%MSG-w cat_A: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Test of std::setprecision(p): Pi with precision 12 is 3.14159265358
Test of std::setprecision(p): Pi with precision 12 is 3.14159265359
%MSG
%MSG-w cat_C: UnitTestClient_G:sendSomeMessages Run: 1 Event: 1
Emit Warning level message 1
Expand Down