use verify instead of assert (in tests)
This commit is contained in:
@@ -21,9 +21,13 @@
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "casdef.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "casEventRegistry.h"
|
||||
|
||||
#ifdef TEST
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
main ()
|
||||
{
|
||||
casEventRegistry reg;
|
||||
@@ -49,20 +53,20 @@ main ()
|
||||
art2.show(10u);
|
||||
reg.show(10u);
|
||||
|
||||
assert (bill1 == bill2);
|
||||
assert (bill1 == bill3);
|
||||
assert (jane != bill1);
|
||||
assert (jane != art1);
|
||||
assert (bill1 != art1);
|
||||
assert (art1 == art2);
|
||||
verify (bill1 == bill2);
|
||||
verify (bill1 == bill3);
|
||||
verify (jane != bill1);
|
||||
verify (jane != art1);
|
||||
verify (bill1 != art1);
|
||||
verify (art1 == art2);
|
||||
|
||||
artBill = art1 | bill1;
|
||||
tmp = artBill & art1;
|
||||
assert (tmp.eventsSelected());
|
||||
verify (tmp.eventsSelected());
|
||||
tmp = artBill & bill1;
|
||||
assert (tmp.eventsSelected());
|
||||
verify (tmp.eventsSelected());
|
||||
tmp = artBill&jane;
|
||||
assert (tmp.noEventsSelected());
|
||||
verify (tmp.noEventsSelected());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -128,10 +132,8 @@ casEventMaskEntry::casEventMaskEntry (
|
||||
casEventRegistry & regIn, casEventMask maskIn, const char * pName ) :
|
||||
casEventMask ( maskIn ), stringId ( pName ), reg ( regIn )
|
||||
{
|
||||
int stat;
|
||||
|
||||
assert ( this->resourceName() != NULL );
|
||||
stat = this->reg.add ( *this );
|
||||
int stat = this->reg.add ( *this );
|
||||
assert ( stat == 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ typedef intId<unsigned,8,16> testIntId;
|
||||
typedef intId<unsigned,8> testIntId;
|
||||
#endif
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
static void empty()
|
||||
{
|
||||
}
|
||||
@@ -34,7 +37,7 @@ public:
|
||||
albert (resTable< albert, testIntId > &atIn, unsigned idIn) :
|
||||
testIntId(idIn), at(atIn)
|
||||
{
|
||||
assert (at.add (*this)==0);
|
||||
verify (at.add (*this)==0);
|
||||
}
|
||||
void show (unsigned /* level */)
|
||||
{
|
||||
@@ -125,52 +128,52 @@ int main()
|
||||
|
||||
intTbl.setTableSize ( 100000 );
|
||||
|
||||
assert (intTbl.add(fred0)==0);
|
||||
verify (intTbl.add(fred0)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred1)==0);
|
||||
verify (intTbl.add(fred1)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred2)==0);
|
||||
verify (intTbl.add(fred2)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred3)==0);
|
||||
verify (intTbl.add(fred3)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred4)==0);
|
||||
verify (intTbl.add(fred4)==0);
|
||||
intTbl.verify ();
|
||||
|
||||
intTbl.setTableSize ( 200000 );
|
||||
|
||||
assert (intTbl.add(fred5)==0);
|
||||
verify (intTbl.add(fred5)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred6)==0);
|
||||
verify (intTbl.add(fred6)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred7)==0);
|
||||
verify (intTbl.add(fred7)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred8)==0);
|
||||
verify (intTbl.add(fred8)==0);
|
||||
intTbl.verify ();
|
||||
assert (intTbl.add(fred9)==0);
|
||||
verify (intTbl.add(fred9)==0);
|
||||
intTbl.verify ();
|
||||
|
||||
start = clock();
|
||||
for (i=0; i<LOOPS; i++) {
|
||||
pFred = intTbl.lookup(intId1);
|
||||
assert(pFred==&fred1);
|
||||
verify(pFred==&fred1);
|
||||
pFred = intTbl.lookup(intId2);
|
||||
assert(pFred==&fred2);
|
||||
verify (pFred==&fred2);
|
||||
pFred = intTbl.lookup(intId3);
|
||||
assert(pFred==&fred3);
|
||||
verify (pFred==&fred3);
|
||||
pFred = intTbl.lookup(intId4);
|
||||
assert(pFred==&fred4);
|
||||
verify (pFred==&fred4);
|
||||
pFred = intTbl.lookup(intId5);
|
||||
assert(pFred==&fred5);
|
||||
verify (pFred==&fred5);
|
||||
pFred = intTbl.lookup(intId6);
|
||||
assert(pFred==&fred6);
|
||||
verify (pFred==&fred6);
|
||||
pFred = intTbl.lookup(intId7);
|
||||
assert(pFred==&fred7);
|
||||
verify (pFred==&fred7);
|
||||
pFred = intTbl.lookup(intId8);
|
||||
assert(pFred==&fred8);
|
||||
verify (pFred==&fred8);
|
||||
pFred = intTbl.lookup(intId9);
|
||||
assert(pFred==&fred9);
|
||||
verify (pFred==&fred9);
|
||||
pFred = intTbl.lookup(intId0);
|
||||
assert(pFred==&fred0);
|
||||
verify (pFred==&fred0);
|
||||
}
|
||||
finish = clock();
|
||||
|
||||
@@ -187,35 +190,35 @@ int main()
|
||||
intTbl.remove(intId1);
|
||||
intTbl.remove(intId2);
|
||||
pFred = intTbl.lookup(intId1);
|
||||
assert(pFred==0);
|
||||
verify (pFred==0);
|
||||
pFred = intTbl.lookup(intId2);
|
||||
assert(pFred==0);
|
||||
verify (pFred==0);
|
||||
|
||||
assert (strTbl.add(jane1)==0);
|
||||
assert (strTbl.add(jane2)==0);
|
||||
verify (strTbl.add(jane1)==0);
|
||||
verify (strTbl.add(jane2)==0);
|
||||
|
||||
start = clock();
|
||||
for(i=0; i<LOOPS; i++){
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId1);
|
||||
assert(pJane==&jane1);
|
||||
verify (pJane==&jane1);
|
||||
pJane = strTbl.lookup(strId2);
|
||||
assert(pJane==&jane2);
|
||||
verify (pJane==&jane2);
|
||||
}
|
||||
finish = clock();
|
||||
|
||||
@@ -264,7 +267,7 @@ int main()
|
||||
|
||||
for (i=0; i<elementCount; i++) {
|
||||
pAlbert[i] = new albert (alTbl, i);
|
||||
assert ( pAlbert[i] );
|
||||
verify ( pAlbert[i] );
|
||||
}
|
||||
alTbl.verify ();
|
||||
alTbl.show (1u);
|
||||
@@ -276,26 +279,26 @@ int main()
|
||||
i++;
|
||||
alTblIter++;
|
||||
}
|
||||
assert ( i == elementCount );
|
||||
verify ( i == elementCount );
|
||||
alTbl.verify ();
|
||||
|
||||
for ( i = 0; i < elementCount; i++ ) {
|
||||
assert ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) );
|
||||
verify ( pAlbert[i] == alTbl.lookup( pAlbert[i]->getId() ) );
|
||||
}
|
||||
alTbl.verify ();
|
||||
|
||||
for ( i = 0; i < elementCount; i += 2 ) {
|
||||
assert ( pAlbert[i] == alTbl.remove ( pAlbert[i]->getId() ) );
|
||||
verify ( pAlbert[i] == alTbl.remove ( pAlbert[i]->getId() ) );
|
||||
}
|
||||
alTbl.verify ();
|
||||
|
||||
for ( i = 0; i < elementCount; i += 2 ) {
|
||||
assert ( 0 == alTbl.lookup ( pAlbert[i]->getId() ) );
|
||||
verify ( 0 == alTbl.lookup ( pAlbert[i]->getId() ) );
|
||||
}
|
||||
alTbl.verify ();
|
||||
|
||||
for ( i = 1; i < elementCount; i += 2 ) {
|
||||
assert ( pAlbert[i] == alTbl.lookup ( pAlbert[i]->getId() ) );
|
||||
verify ( pAlbert[i] == alTbl.lookup ( pAlbert[i]->getId() ) );
|
||||
}
|
||||
alTbl.verify ();
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ int main ()
|
||||
|
||||
clk = clock ();
|
||||
for (i=0u; i<LOOPCOUNT; i++) {
|
||||
assert ( tree.verify(a) );
|
||||
bool success = tree.verify(a);
|
||||
assert ( success );
|
||||
}
|
||||
diff = clock () - clk;
|
||||
delay = diff;
|
||||
@@ -77,13 +78,14 @@ int main ()
|
||||
|
||||
clk = clock ();
|
||||
while ( ( pA = list.get () ) ) {
|
||||
assert (tree.remove(*pA));
|
||||
bool success = tree.remove(*pA);
|
||||
assert ( success );
|
||||
}
|
||||
diff = clock () - clk;
|
||||
delay = diff;
|
||||
delay = delay/CLOCKS_PER_SEC;
|
||||
delay = delay/LOOPCOUNT;
|
||||
printf ("delay = %15.10f\n", delay);
|
||||
delay = diff;
|
||||
delay = delay/CLOCKS_PER_SEC;
|
||||
delay = delay/LOOPCOUNT;
|
||||
printf ("delay = %15.10f\n", delay);
|
||||
|
||||
tree.traverse (&A::show);
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#include "tsBTree.h"
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
class A : public tsBTreeNode<A> {
|
||||
public:
|
||||
A(const char *pNameIn) : pName(pNameIn) {}
|
||||
@@ -57,30 +60,30 @@ int main ()
|
||||
|
||||
tree.traverse (&A::show);
|
||||
|
||||
assert (tree.remove(a6)==tsbtrrNotFound);
|
||||
verify (tree.remove(a6)==tsbtrrNotFound);
|
||||
tree.insert (a6);
|
||||
assert (tree.remove(a6)==tsbtrrFound);
|
||||
assert (tree.remove(a5)==tsbtrrFound);
|
||||
assert (tree.remove(a5)==tsbtrrNotFound);
|
||||
assert (!tree.verify(a5));
|
||||
assert (tree.verify(a4));
|
||||
assert (tree.remove(a0)==tsbtrrFound);
|
||||
assert (!tree.verify(a0));
|
||||
assert (tree.remove(a0)==tsbtrrNotFound);
|
||||
verify (tree.remove(a6)==tsbtrrFound);
|
||||
verify (tree.remove(a5)==tsbtrrFound);
|
||||
verify (tree.remove(a5)==tsbtrrNotFound);
|
||||
verify (!tree.verify(a5));
|
||||
verify (tree.verify(a4));
|
||||
verify (tree.remove(a0)==tsbtrrFound);
|
||||
verify (!tree.verify(a0));
|
||||
verify (tree.remove(a0)==tsbtrrNotFound);
|
||||
tree.insert (a5);
|
||||
assert (tree.verify(a5));
|
||||
assert (tree.verify(a2));
|
||||
assert (tree.remove(a2)==tsbtrrFound);
|
||||
assert (!tree.verify(a2));
|
||||
assert (tree.remove(a2)==tsbtrrNotFound);
|
||||
assert (tree.verify(a5));
|
||||
assert (tree.remove(a5)==tsbtrrFound);
|
||||
assert (tree.remove(a5)==tsbtrrNotFound);
|
||||
assert (tree.remove(a0)==tsbtrrNotFound);
|
||||
assert (tree.remove(a4)==tsbtrrFound);
|
||||
assert (tree.remove(a3)==tsbtrrFound);
|
||||
assert (tree.remove(a4)==tsbtrrNotFound);
|
||||
assert (tree.remove(a1)==tsbtrrFound);
|
||||
verify (tree.verify(a5));
|
||||
verify (tree.verify(a2));
|
||||
verify (tree.remove(a2)==tsbtrrFound);
|
||||
verify (!tree.verify(a2));
|
||||
verify (tree.remove(a2)==tsbtrrNotFound);
|
||||
verify (tree.verify(a5));
|
||||
verify (tree.remove(a5)==tsbtrrFound);
|
||||
verify (tree.remove(a5)==tsbtrrNotFound);
|
||||
verify (tree.remove(a0)==tsbtrrNotFound);
|
||||
verify (tree.remove(a4)==tsbtrrFound);
|
||||
verify (tree.remove(a3)==tsbtrrFound);
|
||||
verify (tree.remove(a4)==tsbtrrNotFound);
|
||||
verify (tree.remove(a1)==tsbtrrFound);
|
||||
|
||||
tree.traverse (&A::show);
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
class fred : public tsDLNode<fred> {
|
||||
public:
|
||||
fred(const char * const pNameIn) : pName(pNameIn){}
|
||||
@@ -46,16 +49,16 @@ int main ()
|
||||
list.add (*pFred);
|
||||
list.add (*pFredII);
|
||||
tsDLIter <fred> iter = list.firstIter();
|
||||
assert (iter.pointer() == pFred);
|
||||
verify (iter.pointer() == pFred);
|
||||
iter++;
|
||||
assert (iter.pointer() == pFredII);
|
||||
verify (iter.pointer() == pFredII);
|
||||
list.remove(*pFred);
|
||||
list.add(*pFred);
|
||||
pFredBack = list.get();
|
||||
assert (pFredBack == pFredII);
|
||||
verify (pFredBack == pFredII);
|
||||
pFredBack = list.get();
|
||||
assert (pFredBack == pFred);
|
||||
assert (list.count() == 0u);
|
||||
verify (pFredBack == pFred);
|
||||
verify (list.count() == 0u);
|
||||
list.add(*pFred);
|
||||
list.add(*pFredII);
|
||||
list.add(* new fred("C"));
|
||||
@@ -70,9 +73,9 @@ int main ()
|
||||
pJane = new jane("JA");
|
||||
janeList.add(*pJane);
|
||||
pJane = new jane("JB");
|
||||
assert ( janeList.find ( *pJane ) == -1 );
|
||||
verify ( janeList.find ( *pJane ) == -1 );
|
||||
janeList.add(*pJane);
|
||||
assert ( janeList.find ( *pJane ) == 1 );
|
||||
verify ( janeList.find ( *pJane ) == 1 );
|
||||
|
||||
while ( janeFwdIter.valid() ) {
|
||||
janeFwdIter->show();
|
||||
@@ -96,21 +99,21 @@ int main ()
|
||||
i++;
|
||||
bdIter++;
|
||||
}
|
||||
assert ( i == janeList.count () );
|
||||
verify ( i == janeList.count () );
|
||||
|
||||
iter = list.firstIter();
|
||||
while ( iter.pointer() ) {
|
||||
list.remove( * iter.pointer() );
|
||||
iter++;
|
||||
}
|
||||
assert(list.count()==0);
|
||||
verify (list.count()==0);
|
||||
|
||||
janeFwdIter = janeList.firstIter();
|
||||
while ( janeFwdIter.valid() ) {
|
||||
janeList.remove( * janeFwdIter.pointer() );
|
||||
janeFwdIter++;
|
||||
}
|
||||
assert(janeList.count()==0);
|
||||
verify (janeList.count()==0);
|
||||
|
||||
pJane = new jane("JA");
|
||||
janeList.add(*pJane);
|
||||
@@ -121,7 +124,7 @@ int main ()
|
||||
janeList.remove( * janeBwdIter.pointer() );
|
||||
janeBwdIter--;
|
||||
}
|
||||
assert(janeList.count()==0);
|
||||
verify (janeList.count()==0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#include "epicsUnitTest.h"
|
||||
#include "testMain.h"
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
union address {
|
||||
struct sockaddr_in ia;
|
||||
struct sockaddr sa;
|
||||
@@ -73,7 +76,7 @@ circuit::circuit ( SOCKET sockIn ) :
|
||||
recvWakeup ( false ),
|
||||
sendWakeup ( false )
|
||||
{
|
||||
assert ( this->sock != INVALID_SOCKET );
|
||||
verify ( this->sock != INVALID_SOCKET );
|
||||
}
|
||||
|
||||
bool circuit::recvWakeupDetected () const
|
||||
@@ -89,7 +92,7 @@ bool circuit::sendWakeupDetected () const
|
||||
void circuit::shutdown ()
|
||||
{
|
||||
int status = ::shutdown ( this->sock, SHUT_RDWR );
|
||||
assert ( status == 0 );
|
||||
verify ( status == 0 );
|
||||
}
|
||||
|
||||
void circuit::signal ()
|
||||
@@ -141,14 +144,14 @@ clientCircuit::clientCircuit ( const address & addrIn ) :
|
||||
address tmpAddr = addrIn;
|
||||
int status = ::connect (
|
||||
this->sock, & tmpAddr.sa, sizeof ( tmpAddr ) );
|
||||
assert ( status == 0 );
|
||||
verify ( status == 0 );
|
||||
|
||||
circuit * pCir = this;
|
||||
this->id = epicsThreadCreate (
|
||||
"client circuit", epicsThreadPriorityMedium,
|
||||
epicsThreadGetStackSize(epicsThreadStackMedium),
|
||||
socketRecvTest, pCir );
|
||||
assert ( this->id );
|
||||
verify ( this->id );
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +169,7 @@ server::server ( const address & addrIn ) :
|
||||
sock ( epicsSocketCreate ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ),
|
||||
id ( 0 ), exit ( false )
|
||||
{
|
||||
assert ( this->sock != INVALID_SOCKET );
|
||||
verify ( this->sock != INVALID_SOCKET );
|
||||
|
||||
// setup server side
|
||||
address tmpAddr = addrIn;
|
||||
@@ -177,7 +180,7 @@ server::server ( const address & addrIn ) :
|
||||
testAbort ( "Stop all CA servers before running this test." );
|
||||
}
|
||||
status = listen ( this->sock, 10 );
|
||||
assert ( status == 0 );
|
||||
verify ( status == 0 );
|
||||
}
|
||||
|
||||
void server::start ()
|
||||
@@ -186,7 +189,7 @@ void server::start ()
|
||||
"server daemon", epicsThreadPriorityMedium,
|
||||
epicsThreadGetStackSize(epicsThreadStackMedium),
|
||||
serverDaemon, this );
|
||||
assert ( this->id );
|
||||
verify ( this->id );
|
||||
}
|
||||
|
||||
void server::daemon ()
|
||||
@@ -197,9 +200,9 @@ void server::daemon ()
|
||||
osiSocklen_t addressSize = sizeof ( addr );
|
||||
SOCKET ns = accept ( this->sock,
|
||||
& addr.sa, & addressSize );
|
||||
assert ( ns != INVALID_SOCKET );
|
||||
verify ( ns != INVALID_SOCKET );
|
||||
circuit * pCir = new serverCircuit ( ns );
|
||||
assert ( pCir );
|
||||
verify ( pCir );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +214,7 @@ serverCircuit::serverCircuit ( SOCKET sockIn ) :
|
||||
"server circuit", epicsThreadPriorityMedium,
|
||||
epicsThreadGetStackSize(epicsThreadStackMedium),
|
||||
socketRecvTest, pCir );
|
||||
assert ( threadId );
|
||||
verify ( threadId );
|
||||
}
|
||||
|
||||
const char * serverCircuit::pName ()
|
||||
@@ -253,7 +256,7 @@ MAIN(blockingSockTest)
|
||||
clientCircuit client ( addr );
|
||||
|
||||
epicsThreadSleep ( 1.0 );
|
||||
assert ( ! client.recvWakeupDetected () );
|
||||
verify ( ! client.recvWakeupDetected () );
|
||||
|
||||
client.shutdown ();
|
||||
epicsThreadSleep ( 1.0 );
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#include "bucketLib.h"
|
||||
#include "testMain.h"
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
MAIN(buckTest)
|
||||
{
|
||||
unsigned id1;
|
||||
@@ -36,35 +39,35 @@ MAIN(buckTest)
|
||||
id1 = 0x1000a432;
|
||||
pValSave1 = "fred";
|
||||
s = bucketAddItemUnsignedId(pb, &id1, pValSave1);
|
||||
assert (s == S_bucket_success);
|
||||
verify (s == S_bucket_success);
|
||||
|
||||
pValSave2 = "jane";
|
||||
id2 = 0x0000a432;
|
||||
s = bucketAddItemUnsignedId(pb, &id2, pValSave2);
|
||||
assert (s == S_bucket_success);
|
||||
verify (s == S_bucket_success);
|
||||
|
||||
start = clock();
|
||||
for(i=0; i<LOOPS; i++){
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id1);
|
||||
assert(pVal == pValSave1);
|
||||
verify (pVal == pValSave1);
|
||||
pVal = bucketLookupItemUnsignedId(pb, &id2);
|
||||
assert(pVal == pValSave2);
|
||||
verify (pVal == pValSave2);
|
||||
}
|
||||
finish = clock();
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "epicsUnitTest.h"
|
||||
#include "testMain.h"
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
static const double delayVerifyOffset = 1.0; // sec
|
||||
|
||||
@@ -368,7 +370,7 @@ epicsTimerNotify::expireStatus periodicVerify::expire ( const epicsTime & )
|
||||
for ( unsigned i = 0u; i < 1000; i++ ) {
|
||||
root = sqrt ( root );
|
||||
}
|
||||
assert ( ! this->cancelCalled );
|
||||
verify ( ! this->cancelCalled );
|
||||
double delay = rand ();
|
||||
delay = delay / RAND_MAX;
|
||||
delay /= 10.0;
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include "epicsAssert.h"
|
||||
#include "cadef.h"
|
||||
|
||||
#define verify(exp) ((exp) ? (void)0 : \
|
||||
epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
|
||||
|
||||
static const unsigned uSecPerSec = 1000000;
|
||||
|
||||
typedef struct cbStructCreateDestroyFD {
|
||||
@@ -38,12 +41,12 @@ void fdCreateDestroyHandler (void *pArg, int fd, int open)
|
||||
if (open) {
|
||||
printf ("new fd = %d\n", fd);
|
||||
status = fdmgr_add_callback (pCBFD->pfdm, fd, fdi_read, fdHandler, pArg);
|
||||
assert (status==0);
|
||||
verify (status==0);
|
||||
}
|
||||
else {
|
||||
printf ("terminated fd = %d\n", fd);
|
||||
status = fdmgr_clear_callback (pCBFD->pfdm, fd, fdi_read);
|
||||
assert (status==0);
|
||||
verify (status==0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,13 +77,13 @@ void testTimer (fdctx *pfdm, double delay)
|
||||
tmo.tv_sec = (unsigned long) delay;
|
||||
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
|
||||
aid = fdmgr_add_timeout (pfdm, &tmo, alarmCB, &cbs);
|
||||
assert (aid!=fdmgrNoAlarm);
|
||||
verify (aid!=fdmgrNoAlarm);
|
||||
|
||||
while (!cbs.done) {
|
||||
tmo.tv_sec = (unsigned long) delay;
|
||||
tmo.tv_usec = (unsigned long) ((delay - tmo.tv_sec) * uSecPerSec);
|
||||
status = fdmgr_pend_event (pfdm, &tmo);
|
||||
assert (status==0);
|
||||
verify (status==0);
|
||||
}
|
||||
|
||||
measuredDelay = epicsTimeDiffInSeconds (&cbs.time, &begin);
|
||||
@@ -98,7 +101,7 @@ int main (int argc, char **argv)
|
||||
chid chan;
|
||||
|
||||
pfdm = fdmgr_init ();
|
||||
assert (pfdm);
|
||||
verify (pfdm);
|
||||
|
||||
SEVCHK (ca_task_initialize(), NULL);
|
||||
cbsfd.pfdm = pfdm;
|
||||
@@ -121,12 +124,12 @@ int main (int argc, char **argv)
|
||||
tmo.tv_usec = 100000;
|
||||
cbsfd.trig = 0;
|
||||
status = fdmgr_pend_event (pfdm, &tmo);
|
||||
assert (status==0);
|
||||
verify (status==0);
|
||||
ca_poll ();
|
||||
}
|
||||
|
||||
status = fdmgr_delete (pfdm);
|
||||
assert (status==0);
|
||||
verify (status==0);
|
||||
|
||||
printf ( "Test Complete\n" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user