@@ -118,8 +118,8 @@ TEST_F(EntityFeatureMapFixture, AddCastRemoveEntity)
118
118
119
119
testMap.AddEntity (gazeboWorld1Entity, testWorld1);
120
120
121
- // After adding the entity, there should be one entry each in two maps
122
- EXPECT_EQ (2u , testMap.TotalMapEntryCount ());
121
+ // After adding the entity, there should be one entry each in three maps
122
+ EXPECT_EQ (3u , testMap.TotalMapEntryCount ());
123
123
EXPECT_EQ (testWorld1, testMap.Get (gazeboWorld1Entity));
124
124
EXPECT_EQ (gazeboWorld1Entity, testMap.Get (testWorld1));
125
125
@@ -128,42 +128,42 @@ TEST_F(EntityFeatureMapFixture, AddCastRemoveEntity)
128
128
testMap.EntityCast <TestOptionalFeatures1>(gazeboWorld1Entity);
129
129
ASSERT_NE (nullptr , testWorld1Feature1);
130
130
// After the cast, there should be one more entry in the cache map.
131
- EXPECT_EQ (3u , testMap.TotalMapEntryCount ());
131
+ EXPECT_EQ (4u , testMap.TotalMapEntryCount ());
132
132
133
133
// Cast to optional feature2
134
134
auto testWorld1Feature2 =
135
135
testMap.EntityCast <TestOptionalFeatures2>(gazeboWorld1Entity);
136
136
ASSERT_NE (nullptr , testWorld1Feature2);
137
137
// After the cast, the number of entries should remain the same because we
138
138
// have not added an entity.
139
- EXPECT_EQ (3u , testMap.TotalMapEntryCount ());
139
+ EXPECT_EQ (4u , testMap.TotalMapEntryCount ());
140
140
141
141
// Add another entity
142
142
WorldPtrType testWorld2 = this ->engine ->ConstructEmptyWorld (" world2" );
143
143
testMap.AddEntity (gazeboWorld2Entity, testWorld2);
144
- EXPECT_EQ (5u , testMap.TotalMapEntryCount ());
144
+ EXPECT_EQ (7u , testMap.TotalMapEntryCount ());
145
145
EXPECT_EQ (testWorld2, testMap.Get (gazeboWorld2Entity));
146
146
EXPECT_EQ (gazeboWorld2Entity, testMap.Get (testWorld2));
147
147
148
148
auto testWorld2Feature1 =
149
149
testMap.EntityCast <TestOptionalFeatures1>(testWorld2);
150
150
ASSERT_NE (nullptr , testWorld2Feature1);
151
151
// After the cast, there should be one more entry in the cache map.
152
- EXPECT_EQ (6u , testMap.TotalMapEntryCount ());
152
+ EXPECT_EQ (8u , testMap.TotalMapEntryCount ());
153
153
154
154
auto testWorld2Feature2 =
155
155
testMap.EntityCast <TestOptionalFeatures2>(testWorld2);
156
156
ASSERT_NE (nullptr , testWorld2Feature2);
157
157
// After the cast, the number of entries should remain the same because we
158
158
// have not added an entity.
159
- EXPECT_EQ (6u , testMap.TotalMapEntryCount ());
159
+ EXPECT_EQ (8u , testMap.TotalMapEntryCount ());
160
160
161
161
// Remove entitites
162
162
testMap.Remove (gazeboWorld1Entity);
163
163
EXPECT_FALSE (testMap.HasEntity (gazeboWorld1Entity));
164
164
EXPECT_EQ (nullptr , testMap.Get (gazeboWorld1Entity));
165
165
EXPECT_EQ (gazebo::kNullEntity , testMap.Get (testWorld1));
166
- EXPECT_EQ (3u , testMap.TotalMapEntryCount ());
166
+ EXPECT_EQ (4u , testMap.TotalMapEntryCount ());
167
167
168
168
testMap.Remove (testWorld2);
169
169
EXPECT_FALSE (testMap.HasEntity (gazeboWorld2Entity));
0 commit comments