Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-03 05:26:48

0001 #include <sstream>
0002 #include "catch.hpp"
0003 #include <iostream>
0004 #include <iomanip>  // std::setw
0005 
0006 // Include the headers for SiStripLatency and TrackerTopology
0007 #include "CondFormats/SiStripObjects/interface/SiStripLatency.h"
0008 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 
0011 // Test case to check the SiStripLatency::printSummary and printDebug
0012 TEST_CASE("SiStripLatency basic test", "[SiStripLatency]") {
0013   // Step 1: Create an empty SiStripLatency object
0014   SiStripLatency latency;
0015 
0016   // Step 2: Create a mock or dummy TrackerTopology object
0017   TrackerTopology* trackerTopo = nullptr;  // Assuming null for now (replace with actual initialization if needed)
0018 
0019   // Step 3: Create a stringstream to capture the output
0020   std::stringstream ssSummary;
0021   std::stringstream ssDebug;
0022 
0023   // Step 4: Call printSummary and printDebug on the SiStripLatency object
0024   try {
0025     latency.printSummary(ssSummary, trackerTopo);
0026     latency.printDebug(ssDebug, trackerTopo);
0027   } catch (const cms::Exception& e) {
0028     FAIL("Exception caught during printSummary or printDebug: " << e.what());
0029   }
0030 
0031   // Step 5: Optional - Check the output
0032   REQUIRE(!ssSummary.str().empty());  // Ensure the summary output is not empty
0033   REQUIRE(!ssDebug.str().empty());    // Ensure the debug output is not empty
0034 
0035   // Print outputs for manual inspection
0036   std::cout << "Summary Output:\n" << ssSummary.str() << std::endl;
0037   std::cout << "Debug Output:\n" << ssDebug.str() << std::endl;
0038 }