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

Function runAlignmentOverrunTest

tests/DCPS/Serializer/AlignmentTest.cpp:263–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263bool runAlignmentOverrunTest()
264{
265 std::cerr << "\nRunning alignment overrun test...\n";
266
267 for (size_t encoding = 0; encoding < encoding_count; ++encoding) {
268 ACE_Message_Block mb(4);
269
270 Serializer s1(&mb, encodings[encoding]);
271 ACE_CDR::Long x = 42;
272 if (!(s1 << x)) {
273 std::cerr << "runAlignmentOverrunTest: 1st serialization using " <<
274 encodings[encoding].to_string() << " failed\n";
275 return false;
276 }
277 if (s1 << x) {
278 std::cerr << "runAlignmentOverrunTest: 2st serialization using " <<
279 encodings[encoding].to_string() << " succeeded when it should've failed\n";
280 return false;
281 }
282
283 Serializer s2(&mb, encodings[encoding]);
284 if (!(s2 >> x)) {
285 std::cerr << "runAlignmentOverrunTest: 1st deserialization using " <<
286 encodings[encoding].to_string() << " failed\n";
287 return false;
288 }
289 if (s2 >> x) {
290 std::cerr << "runAlignmentOverrunTest: 2nd deserialization using " <<
291 encodings[encoding].to_string() << " succeeded when it should've failed\n";
292 return false;
293 }
294 }
295
296 return true;
297}

Callers 1

ACE_TMAINFunction · 0.85

Calls 1

to_stringMethod · 0.45

Tested by

no test coverage detected