From a48ff756520e25540e4d40e83a76a6ba9094b1a7 Mon Sep 17 00:00:00 2001 From: Shaun Roe <shaun.roe@cern.ch> Date: Mon, 31 Mar 2025 12:46:17 +0200 Subject: [PATCH] address coverity defects from 31 March --- .../ColumnarTestFixtures/ColumnarMemoryTest.h | 2 +- .../ColumnarTestFixtures/Root/ColumnarMemoryTest.cxx | 2 +- .../ColumnarTestFixtures/Root/ColumnarPhysliteTest.cxx | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/ColumnarTestFixtures/ColumnarMemoryTest.h b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/ColumnarTestFixtures/ColumnarMemoryTest.h index 9042a1eb3059..fbed3f50222e 100644 --- a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/ColumnarTestFixtures/ColumnarMemoryTest.h +++ b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/ColumnarTestFixtures/ColumnarMemoryTest.h @@ -97,7 +97,7 @@ namespace columnar void addColumn (const std::string& name, std::vector<std::any> data); - void setExpectation (const std::string& name, std::vector<std::any> values); + void setExpectation (const std::string& name, const std::vector<std::any> & values); /// @brief add the columns we have to the tool void connectColumnsToTool (); diff --git a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarMemoryTest.cxx b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarMemoryTest.cxx index 3c35ca22e174..e52495760337 100644 --- a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarMemoryTest.cxx +++ b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarMemoryTest.cxx @@ -195,7 +195,7 @@ namespace columnar void ColumnarMemoryTest::ColumnMapType :: - setExpectation (const std::string& name, std::vector<std::any> values) + setExpectation (const std::string& name, const std::vector<std::any> & values) { auto column = m_columnMap.find (name); if (column == m_columnMap.end()) diff --git a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarPhysliteTest.cxx b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarPhysliteTest.cxx index 8389417eb2bb..9183f42bd008 100644 --- a/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarPhysliteTest.cxx +++ b/PhysicsAnalysis/Columnar/ColumnarTestFixtures/Root/ColumnarPhysliteTest.cxx @@ -254,7 +254,7 @@ namespace columnar if (iter == requestedColumns.end()) return false; - auto offsetName = iter->second.offsetName; + const auto & offsetName = iter->second.offsetName; if (offsetName.empty()) throw std::runtime_error ("missing offset column for: " + columnName); @@ -695,6 +695,9 @@ namespace columnar Benchmark benchmarkGetEntry (name + " getEntry"); const auto numberOfEvents = event.getEntries(); + if (numberOfEvents == 0){ + throw std::runtime_error ("ColumnarPhysLiteTest: numberOfEvents == 0"); + } Long64_t entry = 0; // Instead of running for a fixed number of events, we run for a -- GitLab