20 #include "gtest/gtest.h" 23 #include "asr_msgs/AsrTypeAndId.h" 28 TEST(DirectSearchHandlerTest, FilterSearchedObjectTypes) {
32 filterSOT.push_back(
"PlateDeep");
33 filterSOT.push_back(
"Marker0");
34 filterSOT.push_back(
"Marker1");
35 filterSOT.push_back(
"Marker1");
39 ASSERT_EQ(0, SOTToFilter.size());
41 SOTToFilter.push_back(
"PlateDeep");
42 SOTToFilter.push_back(
"Marker1");
43 SOTToFilter.push_back(
"PlateDeep");
45 ASSERT_EQ(0, SOTToFilter.size());
47 SOTToFilter.push_back(
"Marker1");
48 SOTToFilter.push_back(
"PlateDeep");
49 SOTToFilter.push_back(
"Marker10");
50 SOTToFilter.push_back(
"Marker1");
51 SOTToFilter.push_back(
"Marker1");
52 SOTToFilter.push_back(
"PlateDeep");
54 ASSERT_EQ(1, SOTToFilter.size());
55 ASSERT_EQ(
"Marker10", SOTToFilter[0]);
62 filterSOT.push_back(
"PlateDeep");
63 filterSOT.push_back(
"Marker0");
64 filterSOT.push_back(
"Marker1");
65 filterSOT.push_back(
"Marker1");
69 ASSERT_EQ(0, SOTToFilter.size());
71 asr_msgs::AsrTypeAndId typeAndId1;
72 typeAndId1.type =
"PlateDeep";
73 typeAndId1.identifier =
"2";
74 SOTToFilter.push_back(typeAndId1);
75 asr_msgs::AsrTypeAndId typeAndId2;
76 typeAndId2.type =
"Marker1";
77 typeAndId2.identifier =
"3";
78 SOTToFilter.push_back(typeAndId2);
79 asr_msgs::AsrTypeAndId typeAndId3;
80 typeAndId3.type =
"PlateDeep";
81 typeAndId3.identifier =
"2";
82 SOTToFilter.push_back(typeAndId3);
84 ASSERT_EQ(0, SOTToFilter.size());
86 asr_msgs::AsrTypeAndId typeAndId4;
87 typeAndId4.type =
"Marker1";
88 typeAndId4.identifier =
"3";
89 SOTToFilter.push_back(typeAndId4);
90 asr_msgs::AsrTypeAndId typeAndId5;
91 typeAndId5.type =
"PlateDeep";
92 typeAndId5.identifier =
"4";
93 SOTToFilter.push_back(typeAndId5);
94 asr_msgs::AsrTypeAndId typeAndId6;
95 typeAndId6.type =
"Marker10";
96 typeAndId6.identifier =
"4";
97 SOTToFilter.push_back(typeAndId6);
98 asr_msgs::AsrTypeAndId typeAndId7;
99 typeAndId7.type =
"Marker1";
100 typeAndId7.identifier =
"2";
101 SOTToFilter.push_back(typeAndId7);
102 asr_msgs::AsrTypeAndId typeAndId8;
103 typeAndId8.type =
"Marker1";
104 typeAndId8.identifier =
"3";
105 SOTToFilter.push_back(typeAndId8);
106 asr_msgs::AsrTypeAndId typeAndId9;
107 typeAndId9.type =
"PlateDeep";
108 typeAndId9.identifier =
"3";
109 SOTToFilter.push_back(typeAndId9);
111 ASSERT_EQ(1, SOTToFilter.size());
112 ASSERT_EQ(
"Marker10", SOTToFilter[0].type);
113 ASSERT_EQ(
"4", SOTToFilter[0].identifier);
116 TEST(DirectSearchHandlerTest, GetIntersectionOfSearchObjectTypes) {
122 ASSERT_EQ(0, intersectionSOT.size());
124 SOT1.push_back(
"PlateDeep");
125 SOT1.push_back(
"Marker0");
126 SOT1.push_back(
"Marker10");
128 SOT2.push_back(
"Marker2");
129 SOT2.push_back(
"Marker3");
130 SOT2.push_back(
"Marker4");
133 ASSERT_EQ(0, intersectionSOT.size());
136 SOT2.push_back(
"Marker0");
137 SOT2.push_back(
"Marker3");
138 SOT2.push_back(
"Marker0");
141 ASSERT_EQ(1, intersectionSOT.size());
142 ASSERT_EQ(
"Marker0", intersectionSOT[0]);
145 SOT1.push_back(
"Marker0");
147 ASSERT_EQ(2, intersectionSOT.size());
148 ASSERT_EQ(
"Marker0", intersectionSOT[0]);
149 ASSERT_EQ(
"Marker0", intersectionSOT[1]);
152 SOT1.push_back(
"Marker3");
154 ASSERT_EQ(3, intersectionSOT.size());
155 ASSERT_NE(intersectionSOT.end(), std::find(intersectionSOT.begin(), intersectionSOT.end(),
"Marker0"));
156 ASSERT_NE(intersectionSOT.end(), std::find(intersectionSOT.begin(), intersectionSOT.end(),
"Marker3"));
void filterSearchedObjectTypes(SearchedObjectTypes &searched_object_types_to_filter, const SearchedObjectTypes &filter_searched_object_types)
std::vector< std::string > SearchedObjectTypes
std::vector< asr_msgs::AsrTypeAndId > SearchedObjectTypesAndIds
void filterSearchedObjectTypesAndIds(SearchedObjectTypesAndIds &searched_object_types_and_ids_to_filter, const SearchedObjectTypes &filter_searched_object_types)
TEST(DirectSearchHandlerTest, FilterSearchedObjectTypes)
SearchedObjectTypes getIntersectionOfSearchObjectTypes(const SearchedObjectTypes &first_searched_object_types, const SearchedObjectTypes &second_searched_object_types)