testServer/testChannelAccess: channel array fix

This commit is contained in:
Matej Sekoranja
2013-12-03 13:43:22 +01:00
parent 344ba439ba
commit 1125ec3437
2 changed files with 14 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ std::string ChannelAccessIFTest::TEST_COUNTER_CHANNEL_NAME = "testCounter";
std::string ChannelAccessIFTest::TEST_CHANNEL_NAME = "testValue";
std::string ChannelAccessIFTest::TEST_VALUEONLY_CHANNEL_NAME = "testValueOnly";
std::string ChannelAccessIFTest::TEST_SUMRPC_CHANNEL_NAME = "testSum";
std::string ChannelAccessIFTest::TEST_ARRAY_CHANNEL_NAME = "testArray";
std::string ChannelAccessIFTest::TEST_ARRAY_CHANNEL_NAME = "testArray1";
int ChannelAccessIFTest::runAllTest() {
@@ -1790,7 +1790,7 @@ void ChannelAccessIFTest::test_channelArray() {
testOk(data1[2] == 2.2 , "%s: check 2: %f", CURRENT_FUNCTION, data1[2]);
succStatus = arrayReq->syncSetLength(false, 4, 3, -1);
succStatus = arrayReq->syncSetLength(false, 3, -1, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array setLength failed ", CURRENT_FUNCTION);
return;

View File

@@ -1393,12 +1393,17 @@ public:
{
typename APVF::shared_pointer from = std::tr1::static_pointer_cast<APVF>(pvfrom);
typename APVF::shared_pointer to = std::tr1::static_pointer_cast<APVF>(pvto);
typename APVF::svector temp(to->reuse());
typename APVF::const_svector ref(from->view());
// TODO range check
if (offset > ref.size())
offset = ref.size();
if (count + offset > ref.size())
count = ref.size() - offset;
typename APVF::svector temp(to->reuse());
if (offset + count > temp.size())
temp.resize(offset + count);
std::copy(ref.begin(), ref.begin() + count, temp.begin() + offset);
to->replace(freeze(temp));
@@ -1495,16 +1500,14 @@ public:
virtual void setLength(bool lastRequest, int length, int capacity)
{
if (capacity > 0) {
m_pvArray->setCapacity(capacity);
m_pvStructureArray->setCapacity(capacity);
}
if (length > 0) {
m_pvArray->setLength(length);
m_pvStructureArray->setLength(length);
}
m_channelArrayRequester->setLengthDone(Status::Ok);
cout << "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD" << endl;
if (lastRequest)
destroy();
}