-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathtest_InputSpec.cxx
More file actions
57 lines (52 loc) · 1.83 KB
/
test_InputSpec.cxx
File metadata and controls
57 lines (52 loc) · 1.83 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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.
#include "Framework/InputSpec.h"
#include "Framework/DataSpecUtils.h"
#include "Headers/DataHeader.h"
#include <catch_amalgamated.hpp>
#include <algorithm>
#include <vector>
#include <fmt/format.h>
#include "Framework/Formatters.h"
#include <fmt/ostream.h>
using namespace o2::framework;
using namespace o2::framework::data_matcher;
TEST_CASE("TestSorting")
{
// At some point
std::vector<InputSpec> inputs{
InputSpec{"foo", {"TST", "B"}},
InputSpec{"bar", {"TST", "A"}}};
std::swap(inputs[0], inputs[1]);
auto sorter = [](InputSpec const& a, InputSpec const& b) {
return a.binding < b.binding;
};
std::stable_sort(inputs.begin(), inputs.end(), sorter);
}
TEST_CASE("TestInputSpecCreation")
{
// At some point
std::vector<InputSpec> inputs{
InputSpec{"everything", "TST", "B", 0},
InputSpec{"0-subspec", "TST", "B"},
InputSpec{"wildcard-subspec", {"TST", "A"}},
InputSpec{"wildcard-desc-and-subspec", o2::header::DataOrigin{"TST"}},
InputSpec{"everything-again", {"TST", "B", 0}}};
std::swap(inputs[0], inputs[1]);
auto sorter = [](InputSpec const& a, InputSpec const& b) {
return a.binding < b.binding;
};
std::stable_sort(inputs.begin(), inputs.end(), sorter);
}
TEST_CASE("TestFormattersLifetime")
{
CHECK(fmt::format("{}", Lifetime::Timeframe) == "timeframe");
}