Project
Loading...
Searching...
No Matches
test_CheckTypes.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#include <catch_amalgamated.hpp>
14
15using namespace o2::framework;
16
17struct Foo {
18 bool foo;
19};
20
21TEST_CASE("CallIfUndefined")
22{
23 bool shouldBeCalled = false;
24 bool shouldNotBeCalled = false;
25 bool shouldBeCalledOnUndefined = false;
26
27 call_if_defined<struct Foo>([&shouldBeCalled](auto) { shouldBeCalled = true; });
28 call_if_defined<struct Bar>([&shouldNotBeCalled](auto) { shouldNotBeCalled = true; });
29 REQUIRE(shouldBeCalled == true);
30 REQUIRE(shouldNotBeCalled == false);
31
32 shouldBeCalled = false;
33 shouldNotBeCalled = false;
34 shouldBeCalledOnUndefined = false;
35
36 call_if_defined_full<struct Bar>([&shouldNotBeCalled](auto) { shouldNotBeCalled = true; }, []() {});
37 REQUIRE(shouldNotBeCalled == false);
38 REQUIRE(shouldBeCalledOnUndefined == false);
39 call_if_defined_full<struct Bar>([&shouldNotBeCalled](auto) { shouldNotBeCalled = true; }, [&shouldBeCalledOnUndefined]() { shouldBeCalledOnUndefined = true; });
40 REQUIRE(shouldNotBeCalled == false);
41 REQUIRE(shouldBeCalledOnUndefined == true);
42}
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
TEST_CASE("CallIfUndefined")