8#include <tracking/trackFindingCDC/utilities/Functional.h>
10#include <gtest/gtest.h>
13using namespace TrackFindingCDC;
16 TEST(TrackFindingCDCTest, utilities_clearIfApplicable)
19 std::vector<float> v{0, 1};
20 EXPECT_FALSE(v.empty());
23 invokeIfApplicable(
Clear(), v);
26 EXPECT_TRUE(v.empty());
32 const typename T::value_type& operator()(
const T& container)
const
34 return container.back();
38 TEST(TrackFindingCDCTest, utilities_getIfApplicable)
41 const std::vector<float> v{0.0, 1.0};
42 EXPECT_FALSE(v.empty());
46 EXPECT_EQ(1.0, back(v));
49 EXPECT_EQ(1.0, Back()(v));
50 EXPECT_EQ(1.0, getIfApplicable<float>(Back(), v, -1.0));
53 EXPECT_EQ(-1.0, getIfApplicable<float>(Back(), f, -1.0));
Abstract base class for different kinds of events.
Functor to get the .clear() from an arbitrary objects.