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

Function runTest

tests/DCPS/Serializer/SerializerTest.cpp:669–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667const int chaindefs[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 30, 35, 40, 45, 50, 128, 256, 512, 1024};
668
669void runTest(const Values& expected, const ArrayValues& expectedArray,
670 const Encoding& encoding, const bool checkPos)
671{
672 ACE_Message_Block* testchain = getchain(sizeof(chaindefs)/sizeof(chaindefs[0]), chaindefs);
673 const char* out = encoding.endianness() == OpenDDS::DCPS::ENDIAN_NATIVE ? "OUT" : "";
674 std::cout << std::endl << "STARTING INSERTION OF SINGLE VALUES WITH" << out << " SWAPPING" << std::endl;
675 insertions(testchain, expected, encoding);
676 size_t bytesWritten = testchain->total_length();
677 std::cout << std::endl << "BYTES WRITTEN: " << bytesWritten << std::endl;
678 displayChain(testchain);
679 std::cout << "EXTRACTING SINGLE VALUES WITH" << out << " SWAPPING" << std::endl;
680 Values observed = {
681 0,
682#if OPENDDS_HAS_EXPLICIT_INTS
683 0,
684#endif
685 0, 0, 0,
686#if OPENDDS_HAS_EXPLICIT_INTS
687 0,
688#endif
689 0, 0, 0, 0, 0,
690 ACE_CDR_LONG_DOUBLE_INITIALIZER, 0, 0, 0
691#ifndef OPENDDS_SAFETY_PROFILE
692 , ""
693#endif
694#ifdef DDS_HAS_WCHAR
695 , 0
696#ifndef OPENDDS_SAFETY_PROFILE
697 , L""
698#endif
699#endif
700 };
701 Serializer serializer(testchain, encoding);
702 bool readPosOk = extractions(serializer, observed, encoding, checkPos);
703 if (!readPosOk) {
704 failed = true;
705 }
706 if (testchain->total_length()) {
707 std::cerr << "ERROR: BYTES READ != BYTES WRITTEN" << std::endl;
708 failed = true;
709 }
710 checkValues(expected, observed);
711
712 serializer.free_string(observed.stringValue);
713#ifdef DDS_HAS_WCHAR
714 serializer.free_string(observed.wstringValue);
715#endif
716 testchain->release();
717
718 testchain = getchain(sizeof(chaindefs)/sizeof(chaindefs[0]), chaindefs);
719 std::cout << std::endl << "STARTING INSERTION OF ARRAY VALUES WITH" << out << " SWAPPING" << std::endl;
720 array_insertions(testchain, expectedArray, ARRAYSIZE, encoding);
721 bytesWritten = testchain->total_length();
722 std::cout << std::endl << "BYTES WRITTEN: " << bytesWritten << std::endl;
723 displayChain(testchain);
724 std::cout << "EXTRACTING ARRAY VALUES WITH" << out << " SWAPPING" << std::endl;
725 ArrayValues observedArray;
726 array_extractions(testchain, observedArray, ARRAYSIZE, encoding);

Callers 1

ACE_TMAINFunction · 0.85

Calls 10

getchainFunction · 0.85
insertionsFunction · 0.85
displayChainFunction · 0.85
extractionsFunction · 0.85
checkValuesFunction · 0.85
array_insertionsFunction · 0.85
array_extractionsFunction · 0.85
checkArrayValuesFunction · 0.85
free_stringMethod · 0.80
releaseMethod · 0.45

Tested by

no test coverage detected