|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | + |
| 11 | +#define BOOST_TEST_MODULE Test Framework ASoA |
| 12 | +#define BOOST_TEST_MAIN |
| 13 | +#define BOOST_TEST_DYN_LINK |
| 14 | + |
| 15 | +#include "Framework/ASoA.h" |
| 16 | +#include "Framework/TableBuilder.h" |
| 17 | +#include "Framework/AnalysisDataModel.h" |
| 18 | +#include "gandiva/tree_expr_builder.h" |
| 19 | +#include "arrow/status.h" |
| 20 | +#include "gandiva/filter.h" |
| 21 | +#include <boost/test/unit_test.hpp> |
| 22 | + |
| 23 | +using namespace o2::framework; |
| 24 | +using namespace arrow; |
| 25 | +using namespace o2::soa; |
| 26 | +using namespace o2::aod; |
| 27 | + |
| 28 | +BOOST_AUTO_TEST_CASE(TestJoinedTables) |
| 29 | +{ |
| 30 | + TableBuilder trackBuilder; |
| 31 | + auto trackWriter = trackBuilder.cursor<Tracks>(); |
| 32 | + trackWriter(0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 33 | + auto tracks = trackBuilder.finalize(); |
| 34 | + |
| 35 | + TableBuilder trackParCovBuilder; |
| 36 | + auto trackParCovWriter = trackParCovBuilder.cursor<TracksCov>(); |
| 37 | + trackParCovWriter(0, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4); |
| 38 | + auto covs = trackParCovBuilder.finalize(); |
| 39 | + |
| 40 | + using Test = Join<Tracks, TracksCov>; |
| 41 | + |
| 42 | + Test tests{tracks, covs}; |
| 43 | + BOOST_REQUIRE(tests.asArrowTable()->num_columns() != 0); |
| 44 | + BOOST_REQUIRE_EQUAL(tests.asArrowTable()->num_columns(), |
| 45 | + tracks->num_columns() + covs->num_columns()); |
| 46 | + auto tests2 = join(Tracks{tracks}, TracksCov{covs}); |
| 47 | + static_assert(std::is_same_v<Test::table_t, decltype(tests2)>, |
| 48 | + "Joined tables should have the same type, regardless how we construct them"); |
| 49 | +} |
0 commit comments