11 #include <tracking/trackFindingCDC/collectors/matchers/MatcherInterface.h>
13 #include <tracking/trackFindingCDC/numerics/WeightComperator.h>
15 #include <gtest/gtest.h>
18 using namespace TrackFindingCDC;
22 class SimpleMatcher :
public MatcherInterface<int, double> {
23 Weight match(
int& a,
const double& b)
override
29 TEST(TrackFindingCDCTest, matcher_interface)
31 SimpleMatcher matcher;
33 std::vector<WeightedRelation<int, const double>> relations;
35 std::vector<int> collectorItems = {1, 2};
36 std::vector<double> collectionItems = {2.1, 2.2, 2.3};
38 std::sort(relations.begin(), relations.end());
39 matcher.apply(collectorItems, collectionItems, relations);
41 std::sort(relations.begin(), relations.end(), GreaterWeight());
43 ASSERT_EQ(relations.size(), 6);
44 ASSERT_EQ(relations[5].getWeight(), 3.1);
45 ASSERT_EQ(relations[4].getWeight(), 3.2);
46 ASSERT_EQ(relations[3].getWeight(), 3.3);
47 ASSERT_EQ(relations[2].getWeight(), 4.1);
48 ASSERT_EQ(relations[1].getWeight(), 4.2);
49 ASSERT_EQ(relations[0].getWeight(), 4.3);