Skip to content

Commit

Permalink
Improve spacing in MessageLogger unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Mar 15, 2022
1 parent ff9439e commit 7ca45f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions FWCore/MessageService/test/UnitTestClient_C.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,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 = 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:"
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
12 changes: 6 additions & 6 deletions FWCore/MessageService/test/unit_test_outputs/u10_warnings.log
Original file line number Diff line number Diff line change
@@ -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.14159265359
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.14159265359
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
12 changes: 6 additions & 6 deletions FWCore/MessageService/test/unit_test_outputs/u6_warnings.log
Original file line number Diff line number Diff line change
@@ -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.14159265359
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.14159265359
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

0 comments on commit 7ca45f9

Please sign in to comment.