/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
CondCore/CondHDF5ESSource/test/test_catch2_findMatchFirst.cc
64 строки
2 KB
Christopher Jones
Convert to catch2 v3 API
12 окт 2025, 01:38
12 окт 2025, 01:38
2edf1db
Код
Авторство
О чём код?
#include "catch2/catch_all.hpp" #include "CondCore/CondHDF5ESSource/plugins/IOVSyncValue.h" //can't link to plugin so must include source #include "CondCore/CondHDF5ESSource/plugins/IOVSyncValue.cc" using namespace cond::hdf5; TEST_CASE("test cond::hdf5::findMatchingFirst", "[findMatchingFirst]") { SECTION("empty IOVs") { std::vector<IOVSyncValue> iovs; auto itFind = findMatchingFirst(iovs, {1, 0}); REQUIRE(itFind == iovs.end()); } SECTION("First element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {1, 0}); REQUIRE(itFind == iovs.begin()); } SECTION("Second element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {10, 0}); REQUIRE(itFind == iovs.begin() + 1); } SECTION("Last element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {20, 0}); REQUIRE(itFind == iovs.begin() + 2); } SECTION("Between first and second element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {5, 0}); REQUIRE(itFind == iovs.begin()); } SECTION("Between second and third element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {15, 0}); REQUIRE(itFind == iovs.begin() + 1); } SECTION("After last element") { std::vector<IOVSyncValue> iovs = {{1, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {25, 0}); REQUIRE(itFind == iovs.begin() + 2); } SECTION("Before first element") { std::vector<IOVSyncValue> iovs = {{2, 0}, {10, 0}, {20, 0}}; auto itFind = findMatchingFirst(iovs, {1, 0}); REQUIRE(itFind == iovs.end()); } }