|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#define BOOST_TEST_MODULE Test Framework DataDescriptorQueryBuilder |
| 13 | +#define BOOST_TEST_MAIN |
| 14 | +#define BOOST_TEST_DYN_LINK |
| 15 | + |
| 16 | +#include "Framework/DataDescriptorMatcher.h" |
| 17 | +#include "Framework/DataDescriptorQueryBuilder.h" |
| 18 | +#include "Framework/DataSpecUtils.h" |
| 19 | +#include "Framework/Logger.h" |
| 20 | +#include "Framework/InputSpec.h" |
| 21 | +#include "Headers/Stack.h" |
| 22 | + |
| 23 | +#include <boost/test/unit_test.hpp> |
| 24 | +#include <variant> |
| 25 | + |
| 26 | +using namespace o2::framework; |
| 27 | +using namespace o2::header; |
| 28 | +using namespace o2::framework::data_matcher; |
| 29 | + |
| 30 | +BOOST_AUTO_TEST_CASE(TestQueryBuilder) |
| 31 | +{ |
| 32 | + VariableContext context; |
| 33 | + DataHeader header0{"CLUSTERS", "TPC", 1}; |
| 34 | + DataHeader header1{"CLUSTERS", "TPC", 2}; |
| 35 | + DataHeader header2{"CLUSTERS", "ITS", 1}; |
| 36 | + DataHeader header3{"TRACKLET", "TPC", 3}; |
| 37 | + |
| 38 | + auto ispecs = DataDescriptorQueryBuilder::parse("A:TPC/CLUSTERS/1;B:ITS/CLUSTERS/1"); |
| 39 | + BOOST_REQUIRE(ispecs.size() == 2); |
| 40 | + BOOST_CHECK(DataSpecUtils::match(ispecs[0], header0) == true); |
| 41 | + BOOST_CHECK(DataSpecUtils::match(ispecs[0], header1) == false); |
| 42 | + BOOST_CHECK(DataSpecUtils::match(ispecs[1], header2) == true); |
| 43 | + |
| 44 | + ispecs = DataDescriptorQueryBuilder::parse("A:TPC/CLUSTERS/!1;B:ITS/CLUSTERS/1"); |
| 45 | + BOOST_REQUIRE(ispecs.size() == 2); |
| 46 | + BOOST_CHECK(DataSpecUtils::match(ispecs[0], header0) == false); |
| 47 | + BOOST_CHECK(DataSpecUtils::match(ispecs[0], header1) == true); |
| 48 | + BOOST_CHECK(DataSpecUtils::match(ispecs[1], header2) == true); |
| 49 | +} |
0 commit comments