|
| 1 | +#include <sstream> |
| 2 | +#include "catch.hpp" |
| 3 | +#include <iostream> |
| 4 | +#include <iomanip> // std::setw |
| 5 | + |
| 6 | +// Include the headers for SiStripLatency and TrackerTopology |
| 7 | +#include "CondFormats/SiStripObjects/interface/SiStripLatency.h" |
| 8 | +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" |
| 9 | +#include "FWCore/Utilities/interface/Exception.h" |
| 10 | + |
| 11 | +// Test case to check the SiStripLatency::printSummary and printDebug |
| 12 | +TEST_CASE("SiStripLatency basic test", "[SiStripLatency]") { |
| 13 | + // Step 1: Create an empty SiStripLatency object |
| 14 | + SiStripLatency latency; |
| 15 | + |
| 16 | + // Step 2: Create a mock or dummy TrackerTopology object |
| 17 | + TrackerTopology* trackerTopo = nullptr; // Assuming null for now (replace with actual initialization if needed) |
| 18 | + |
| 19 | + // Step 3: Create a stringstream to capture the output |
| 20 | + std::stringstream ssSummary; |
| 21 | + std::stringstream ssDebug; |
| 22 | + |
| 23 | + // Step 4: Call printSummary and printDebug on the SiStripLatency object |
| 24 | + try { |
| 25 | + latency.printSummary(ssSummary, trackerTopo); |
| 26 | + latency.printDebug(ssDebug, trackerTopo); |
| 27 | + } catch (const cms::Exception& e) { |
| 28 | + FAIL("Exception caught during printSummary or printDebug: " << e.what()); |
| 29 | + } |
| 30 | + |
| 31 | + // Step 5: Optional - Check the output |
| 32 | + REQUIRE(!ssSummary.str().empty()); // Ensure the summary output is not empty |
| 33 | + REQUIRE(!ssDebug.str().empty()); // Ensure the debug output is not empty |
| 34 | + |
| 35 | + // Print outputs for manual inspection |
| 36 | + std::cout << "Summary Output:\n" << ssSummary.str() << std::endl; |
| 37 | + std::cout << "Debug Output:\n" << ssDebug.str() << std::endl; |
| 38 | +} |
0 commit comments