Skip to content

Commit

Permalink
Evolve the test driver framework and adopt it into NTS
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrm456 authored Oct 8, 2024
1 parent 72762ff commit c572a94
Show file tree
Hide file tree
Showing 121 changed files with 15,003 additions and 16,684 deletions.
1,592 changes: 687 additions & 905 deletions groups/nts/ntsa/ntsa_abstract.t.cpp

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions groups/nts/ntsa/ntsa_adapter.t.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2020-2023 Bloomberg Finance L.P.
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <ntscfg_test.h>

#include <bsls_ident.h>
BSLS_IDENT_RCSID(ntsa_adapter_t_cpp, "$Id$ $CSID$")

#include <ntsa_adapter.h>

using namespace BloombergLP;

namespace BloombergLP {
namespace ntsa {

// Provide tests for 'ntsa::Adapter'.
class AdapterTest
{
public:
// TODO
static void verify();
};

NTSCFG_TEST_FUNCTION(ntsa::AdapterTest::verify)
{
}

} // close namespace ntsa
} // close namespace BloombergLP
18 changes: 9 additions & 9 deletions groups/nts/ntsa/ntsa_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void ConstBuffer::copy(bdlbb::Blob* blob,
BSLS_ASSERT(0 < currentVecAvailable);
}

int currentVecOffset = static_cast<int>(offset) - prefixLength;
int currentVecOffset = static_cast<int>(offset) - prefixLength;
currentVecAvailable -= currentVecOffset;
BSLS_ASSERT(0 <= currentVecOffset);
BSLS_ASSERT(0 < currentVecAvailable);
Expand All @@ -318,7 +318,7 @@ void ConstBuffer::copy(bdlbb::Blob* blob,
// Compute number of bytes available to read or write in current vec or
// buffer. This must be done *after* setting the blob length.

int currentBufAvailable = blob->buffer(currentBufIndex).size();
int currentBufAvailable = blob->buffer(currentBufIndex).size();
currentBufAvailable -= currentBufOffset;
BSLS_ASSERT(0 < currentBufAvailable);

Expand All @@ -337,11 +337,11 @@ void ConstBuffer::copy(bdlbb::Blob* blob,
int numBytesCopied =
bsl::min(currentVecAvailable, currentBufAvailable);

bsl::memcpy(blob->buffer(currentBufIndex).data() + currentBufOffset,
static_cast<const char*>(
bufferArray[currentVecIndex].buffer()) +
currentVecOffset,
numBytesCopied);
bsl::memcpy(
blob->buffer(currentBufIndex).data() + currentBufOffset,
static_cast<const char*>(bufferArray[currentVecIndex].buffer()) +
currentVecOffset,
numBytesCopied);

currentBufOffset += numBytesCopied;
currentVecOffset += numBytesCopied;
Expand All @@ -352,8 +352,8 @@ void ConstBuffer::copy(bdlbb::Blob* blob,
return;
}
currentVecAvailable =
NTSCFG_WARNING_NARROW(
int, bufferArray[currentVecIndex].length());
NTSCFG_WARNING_NARROW(int,
bufferArray[currentVecIndex].length());
}
else {
currentVecAvailable -= numBytesCopied;
Expand Down
Loading

0 comments on commit c572a94

Please sign in to comment.