|
1 | 1 | #include "podio/Reader.h" |
| 2 | +#include "podio/utilities/Glob.h" |
2 | 3 | #if PODIO_ENABLE_DATASOURCE |
3 | 4 | #include "podio/DataSource.h" |
4 | 5 | #endif |
|
11 | 12 | int main() { |
12 | 13 | const auto pattern = "example_frame_?.root"; |
13 | 14 | const auto expected_events = 20; |
14 | | - const auto reader = podio::makeReader(pattern); |
15 | | - reader.getEvents(); |
16 | | - ASSERT((reader.getEntries(podio::Category::Event) == expected_events), "Reader read invalid number of events"); |
| 15 | + // standalone globbing |
| 16 | + |
| 17 | + ASSERT(podio::utils::is_glob_pattern(pattern), "Failed to recognize glob pattern"); |
| 18 | + auto files = podio::utils::expand_glob(pattern); |
| 19 | + ASSERT(files.size() == 2, "Glob expanded to a wrong number of files"); |
| 20 | + ASSERT(files[0] == "example_frame_0.root", "Glob expanded to an unexpected file"); |
| 21 | + ASSERT(files[1] == "example_frame_1.root", "Glob expanded to an unexpected file"); |
| 22 | + { |
| 23 | + // externally resolved glob |
| 24 | + const auto reader = podio::makeReader(files); |
| 25 | + ASSERT((reader.getEvents() == expected_events), "Reader read invalid number of events"); |
17 | 26 | #if PODIO_ENABLE_DATASOURCE |
18 | | - auto rdf = podio::CreateDataFrame(pattern); |
19 | | - ASSERT(rdf.Count().GetValue() == expected_events, "DataSource read invalid number of events"); |
| 27 | + auto rdf = podio::CreateDataFrame(files); |
| 28 | + ASSERT(rdf.Count().GetValue() == expected_events, "DataSource read invalid number of events"); |
20 | 29 | #endif // PODIO_ENABLE_DATASOURCE |
| 30 | + } |
| 31 | + { |
| 32 | + // implicit globbing |
| 33 | + const auto reader = podio::makeReader(pattern); |
| 34 | + ASSERT((reader.getEvents() == expected_events), "Reader read invalid number of events"); |
| 35 | +#if PODIO_ENABLE_DATASOURCE |
| 36 | + auto rdf = podio::CreateDataFrame(pattern); |
| 37 | + ASSERT(rdf.Count().GetValue() == expected_events, "DataSource read invalid number of events"); |
| 38 | +#endif // PODIO_ENABLE_DATASOURCE |
| 39 | + } |
21 | 40 | } |
0 commit comments