-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathtest_AnalysisDataModel.cxx
More file actions
62 lines (52 loc) · 1.96 KB
/
test_AnalysisDataModel.cxx
File metadata and controls
62 lines (52 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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 <boost/test/unit_test.hpp>
using namespace o2::framework;
using namespace arrow;
DECLARE_SOA_STORE();
namespace col
{
DECLARE_SOA_COLUMN(X, x, float);
DECLARE_SOA_COLUMN(Y, y, float);
DECLARE_SOA_COLUMN(Z, z, float);
DECLARE_SOA_COLUMN(D, d, float);
} // namespace col
DECLARE_SOA_TABLE(XY, "AOD", "XY", col::X, col::Y);
DECLARE_SOA_TABLE(ZD, "AOD", "ZD", col::Z, col::D);
BOOST_AUTO_TEST_CASE(TestJoinedTables)
{
TableBuilder XYBuilder;
//FIXME: using full tracks, instead of stored because of unbound dynamic
// column (normalized phi)
auto xyWriter = XYBuilder.cursor<XY>();
xyWriter(0, 0, 0);
auto tXY = XYBuilder.finalize();
TableBuilder ZDBuilder;
auto zdWriter = ZDBuilder.cursor<ZD>();
zdWriter(0, 7, 1);
auto tZD = ZDBuilder.finalize();
using Test = o2::soa::Join<XY, ZD>;
Test tests{0, tXY, tZD};
BOOST_REQUIRE(tests.asArrowTable()->num_columns() != 0);
BOOST_REQUIRE_EQUAL(tests.asArrowTable()->num_columns(),
tXY->num_columns() + tZD->num_columns());
auto tests2 = join(XY{tXY}, ZD{tZD});
static_assert(std::is_same_v<Test::table_t, decltype(tests2)>,
"Joined tables should have the same type, regardless how we construct them");
}