ChannelArray.getLength() test added

This commit is contained in:
Matej Sekoranja
2014-06-03 14:17:09 +02:00
parent 0419fc6a38
commit 90ca073f45
2 changed files with 44 additions and 5 deletions
+17 -2
View File
@@ -43,9 +43,9 @@ std::string ChannelAccessIFTest::TEST_ARRAY_CHANNEL_NAME = "testArray1";
int ChannelAccessIFTest::runAllTest() {
#ifdef ENABLE_STRESS_TESTS
testPlan(157);
testPlan(159);
#else
testPlan(152);
testPlan(154);
#endif
test_implementation();
@@ -1973,6 +1973,21 @@ void ChannelAccessIFTest::test_channelArray() {
}
*/
// test setLength with capacity 0 (no change) and getLength
size_t newLen = bigCapacity/2;
succStatus = arrayReq->syncSetLength(false, newLen, bigCapacity, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array setLength failed (4) ", CURRENT_FUNCTION);
return;
}
succStatus = arrayReq->syncGetLength(false, getTimeoutSec());
if (!succStatus) {
testFail("%s: an array getLength failed", CURRENT_FUNCTION);
return;
}
testOk(arrayReq->getLength() == newLen, "%s: retrieved length should be %zu", CURRENT_FUNCTION, newLen);
testOk(arrayReq->getCapacity() == bigCapacity, "%s: retrieved capacity should be %zu", CURRENT_FUNCTION, bigCapacity);
channel->destroy();
}
+27 -3
View File
@@ -1250,6 +1250,19 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
return waitUntilSetLengthDone(timeOut);
}
bool syncGetLength(bool lastRequest, long timeOut)
{
if (!getConnectedStatus()) {
return false;
}
if (lastRequest)
m_channelArray->lastRequest();
m_channelArray->getLength();
return waitUntilSetLengthDone(timeOut);
}
ChannelArray::shared_pointer getChannelArray()
{
@@ -1359,13 +1372,22 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
Lock lock(m_pointerMutex);
m_channelArray = channelArray;
// TODO !!!
//m_length = length;
//m_capacity = capacity;
m_length = length;
m_capacity = capacity;
m_lengthArrayStatus = status.isSuccess();
signalEvent();
}
size_t getLength()
{
return m_length;
}
size_t getCapacity()
{
return m_capacity;
}
private:
@@ -1429,6 +1451,8 @@ class SyncChannelArrayRequesterImpl : public ChannelArrayRequester, public SyncB
Mutex m_pointerMutex;
ChannelArray::shared_pointer m_channelArray;
epics::pvData::PVArray::shared_pointer m_pvArray;
size_t m_length;
size_t m_capacity;
};
#endif