From 4de2f02235d523dfc45f76cb700fd38f160fb686 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Wed, 15 Jan 2020 11:13:00 +0100 Subject: [PATCH] DPL Analysis: introduce an AnalysisDataModel specific test This is to debug issues with ASoA which seem to appear only when using the AnalysisDataModel classes. --- Framework/Core/CMakeLists.txt | 1 + .../Core/test/test_AnalysisDataModel.cxx | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Framework/Core/test/test_AnalysisDataModel.cxx diff --git a/Framework/Core/CMakeLists.txt b/Framework/Core/CMakeLists.txt index f798e5e1a29ca..03b8fea33367c 100644 --- a/Framework/Core/CMakeLists.txt +++ b/Framework/Core/CMakeLists.txt @@ -124,6 +124,7 @@ o2_target_root_dictionary(Framework foreach(t AlgorithmSpec AnalysisTask + AnalysisDataModel ASoA BoostOptionsRetriever CallbackRegistry diff --git a/Framework/Core/test/test_AnalysisDataModel.cxx b/Framework/Core/test/test_AnalysisDataModel.cxx new file mode 100644 index 0000000000000..4cac2e776a839 --- /dev/null +++ b/Framework/Core/test/test_AnalysisDataModel.cxx @@ -0,0 +1,49 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#define BOOST_TEST_MODULE Test Framework ASoA +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK + +#include "Framework/ASoA.h" +#include "Framework/TableBuilder.h" +#include "Framework/AnalysisDataModel.h" +#include "gandiva/tree_expr_builder.h" +#include "arrow/status.h" +#include "gandiva/filter.h" +#include + +using namespace o2::framework; +using namespace arrow; +using namespace o2::soa; +using namespace o2::aod; + +BOOST_AUTO_TEST_CASE(TestJoinedTables) +{ + TableBuilder trackBuilder; + auto trackWriter = trackBuilder.cursor(); + trackWriter(0, 0, 0, 0, 0, 0, 0, 0, 0); + auto tracks = trackBuilder.finalize(); + + TableBuilder trackParCovBuilder; + auto trackParCovWriter = trackParCovBuilder.cursor(); + trackParCovWriter(0, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4); + auto covs = trackParCovBuilder.finalize(); + + using Test = Join; + + Test tests{tracks, covs}; + BOOST_REQUIRE(tests.asArrowTable()->num_columns() != 0); + BOOST_REQUIRE_EQUAL(tests.asArrowTable()->num_columns(), + tracks->num_columns() + covs->num_columns()); + auto tests2 = join(Tracks{tracks}, TracksCov{covs}); + static_assert(std::is_same_v, + "Joined tables should have the same type, regardless how we construct them"); +}