Event test added

This commit is contained in:
Matej Sekoranja
2014-11-25 10:43:07 +01:00
parent 2e4a8b2e23
commit de1478d7ba
6 changed files with 74 additions and 6 deletions
+5
View File
@@ -7,6 +7,11 @@ testThread_SRCS += testThread.cpp
testHarness_SRCS += testThread.cpp
TESTS += testThread
TESTPROD_HOST += testEvent
testEvent_SRCS += testEvent.cpp
testHarness_SRCS += testEvent.cpp
TESTS += testEvent
TESTPROD_HOST += testTimer
testTimer_SRCS += testTimer.cpp
testHarness_SRCS += testTimer.cpp
+51
View File
@@ -0,0 +1,51 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <epicsUnitTest.h>
#include <testMain.h>
#include <pv/event.h>
using namespace epics::pvData;
static void testBasicEvent()
{
testDiag("testBasicEvent");
Event e;
// 0 signals, 2 waits
testOk1(!e.tryWait());
testOk1(!e.tryWait());
// signal, wait, signal, wait
e.signal();
testOk1(e.tryWait());
e.signal();
testOk1(e.tryWait());
// 1 signal, 2 waits
e.signal();
testOk1(e.tryWait());
testOk1(!e.tryWait());
// 2 signals, 2 waits
e.signal();
e.signal();
testOk1(e.tryWait());
testOk1(!e.tryWait());
// 0 signals, 1 wait
testOk1(!e.tryWait());
}
MAIN(testEvent)
{
testPlan(9);
testBasicEvent();
return testDone();
}
+2
View File
@@ -23,6 +23,7 @@ int testQueue(void);
int testSerialization(void);
int testSharedVector(void);
int testThread(void);
int testEvent(void);
int testTimeStamp(void);
int testTimer(void);
int testTypeCast(void);
@@ -72,6 +73,7 @@ void pvDataAllTests(void)
runTest(testSerialization);
runTest(testSharedVector);
runTest(testThread);
runTest(testEvent);
runTest(testTimeStamp);
runTest(testTimer);
runTest(testTypeCast);