Project
Loading...
Searching...
No Matches
testFlagTypes.cxx
Go to the documentation of this file.
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 quality_control FlagTypes class
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15
16#include <boost/test/unit_test.hpp>
17
18#include <type_traits>
19#include <iostream>
20
21// o2 includes
23#include "DataFormatsQualityControl/FlagTypeFactory.h"
24
25using namespace o2::quality_control;
26
28{
29 static_assert(std::is_constructible<FlagType, uint16_t, const char*, bool>::value == false,
30 "FlagType should not be constructible outside of its static methods and the factory.");
31
32 FlagType fDefault;
33 BOOST_CHECK_EQUAL(fDefault, FlagTypeFactory::Invalid());
34
35 auto f1 = FlagTypeFactory::Unknown();
36 BOOST_CHECK_EQUAL(f1.getID(), 14);
37 BOOST_CHECK_EQUAL(f1.getName(), "Unknown");
38 BOOST_CHECK_EQUAL(f1.getBad(), true);
39
40 BOOST_CHECK_NO_THROW(std::cout << f1 << std::endl);
41
42 auto f2 = f1;
43 BOOST_CHECK_EQUAL(f2.getID(), 14);
44 BOOST_CHECK_EQUAL(f1.getName(), f2.getName());
45 BOOST_CHECK_EQUAL(f2.getName(), "Unknown");
46 BOOST_CHECK_EQUAL(f2.getBad(), true);
47
48 BOOST_CHECK_EQUAL(f1, f2);
49 BOOST_CHECK((f1 != f2) == false);
50 BOOST_CHECK(!(f1 < f2));
51 BOOST_CHECK(!(f1 > f2));
52
53 auto f3 = FlagTypeFactory::LimitedAcceptanceMCNotReproducible();
54 BOOST_CHECK(f3 < f1);
55 BOOST_CHECK(!(f3 > f1));
56}
BOOST_AUTO_TEST_CASE(FlagTypes)
BOOST_CHECK_NO_THROW(algorithm::merge(target, other))
BOOST_CHECK(tree)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())