Skip to content

Commit

Permalink
Use a more correct value of Pi for MessageLogger unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Mar 15, 2022
1 parent 12c6ba5 commit ff9439e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
3 changes: 2 additions & 1 deletion FWCore/MessageService/bin/Standalone.cpp
Original file line number Diff line number Diff line change
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
9 changes: 5 additions & 4 deletions FWCore/MessageService/test/UnitTestClient_C.cc
Original file line number Diff line number Diff line change
@@ -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 @@ -21,7 +22,7 @@ namespace edmtest {
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;
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:"
Expand Down
11 changes: 6 additions & 5 deletions FWCore/MessageService/test/UnitTestClient_G.cc
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions FWCore/MessageService/test/unit_test_outputs/u10_warnings.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test of std::hex:145in hex is91
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 is3.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
Expand All @@ -17,7 +17,7 @@ Test of format hex: 145 in hex is 91
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
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions FWCore/MessageService/test/unit_test_outputs/u6_warnings.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test of std::hex:145in hex is91
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 is3.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
Expand All @@ -17,7 +17,7 @@ Test of format hex: 145 in hex is 91
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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ff9439e

Please sign in to comment.