/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include "ua_securechannel.h" #include "ua_types_encoding_binary.h" #include UA_ByteString *buffers; size_t bufIndex; size_t counter; size_t dataCount; static UA_StatusCode sendChunkMockUp(void *_, UA_Byte **bufPos, const UA_Byte **bufEnd) { size_t offset = (uintptr_t)(*bufPos - buffers[bufIndex].data); bufIndex++; *bufPos = buffers[bufIndex].data; *bufEnd = &(*bufPos)[buffers[bufIndex].length]; counter++; dataCount += offset; return UA_STATUSCODE_GOOD; } START_TEST(encodeArrayIntoFiveChunksShallWork) { size_t arraySize = 30; //number of elements within the array which should be encoded size_t chunkCount = 6; // maximum chunk count size_t chunkSize = 30; //size in bytes of each chunk bufIndex = 0; counter = 0; dataCount = 0; buffers = (UA_ByteString*)UA_Array_new(chunkCount, &UA_TYPES[UA_TYPES_BYTESTRING]); for(size_t i=0;i