MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / test_passed

Method test_passed

tests/DCPS/FooTest5/InstanceDataMap.cpp:187–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185
186
187bool
188InstanceDataMap::test_passed(int expected)
189{
190 ACE_GUARD_RETURN (ACE_Thread_Mutex,
191 guard,
192 this->lock_,
193 false);
194
195 bool expect_receive_all = expected == num_messages_expected_;
196 int received_messages = 0;
197
198 bool result = true;
199
200 for (int i = 0; i < num_datawriters; i++)
201 {
202 DataMap& map = maps_[i];
203
204 if (expect_receive_all
205 && map.current_size () != (unsigned) num_instances_per_writer)
206 {
207 ACE_ERROR ((LM_ERROR,
208 ACE_TEXT("(%P|%t) ERROR: get %d instances expected %d!\n"),
209 map.current_size (), num_instances_per_writer));
210 return false;
211 }
212
213 DataMap::ENTRY* entry = 0;
214 for (DataMap::ITERATOR itr(map);
215 itr.next(entry);
216 itr.advance())
217 {
218 for (int i = 0; i < num_samples_per_instance; i ++)
219 {
220 if (expect_receive_all && (entry->int_id_)[i] < num_receives_per_sample_)
221 {
222 ACE_ERROR ((LM_ERROR,
223 ACE_TEXT("(%P|%t) ERROR: received %d msg from %d instance ")
224 ACE_TEXT("for %d times, expected %d!\n"),
225 i, entry->ext_id_, (entry->int_id_)[i], num_receives_per_sample_));
226 result = false;
227 }
228 else
229 {
230 received_messages ++;
231 }
232 }
233 }
234 }
235
236 // If we are not expect receive all messages that the publisher called
237 // write() then we make sure we received the number of expected messages
238 // which excludes the failed writes.
239 if (! expect_receive_all
240 && received_messages == expected)
241 {
242 result = true;
243 }
244

Callers 1

ACE_TMAINFunction · 0.80

Calls 2

advanceMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected