std/rec/test: start linkInitTest
This commit is contained in:
@@ -39,6 +39,13 @@ testHarness_SRCS += linkRetargetLinkTest.c
|
||||
TESTFILES += ../linkRetargetLink.db
|
||||
TESTS += linkRetargetLinkTest
|
||||
|
||||
TESTPROD_HOST += linkInitTest
|
||||
linkInitTest_SRCS += linkInitTest.c
|
||||
linkInitTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
|
||||
testHarness_SRCS += linkInitTest.c
|
||||
TESTFILES += ../linkInitTest.db
|
||||
TESTS += linkInitTest
|
||||
|
||||
TESTPROD_HOST += compressTest
|
||||
compressTest_SRCS += compressTest.c
|
||||
compressTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
|
||||
|
||||
@@ -17,6 +17,7 @@ int compressTest(void);
|
||||
int arrayOpTest(void);
|
||||
int asTest(void);
|
||||
int linkRetargetLinkTest(void);
|
||||
int linkInitTest(void);
|
||||
|
||||
void epicsRunRecordTests(void)
|
||||
{
|
||||
@@ -32,5 +33,7 @@ void epicsRunRecordTests(void)
|
||||
|
||||
runTest(linkRetargetLinkTest);
|
||||
|
||||
runTest(linkInitTest);
|
||||
|
||||
epicsExit(0); /* Trigger test harness */
|
||||
}
|
||||
|
||||
104
src/std/rec/test/linkInitTest.c
Normal file
104
src/std/rec/test/linkInitTest.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2015 Michael Davidsaver
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
|
||||
#define EPICS_DBCA_PRIVATE_API
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "alarm.h"
|
||||
#include "dbUnitTest.h"
|
||||
#include "errlog.h"
|
||||
#include "epicsThread.h"
|
||||
|
||||
#include "testMain.h"
|
||||
|
||||
void recTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
static void testLongStringInit()
|
||||
{
|
||||
testDiag("testLongStringInit");
|
||||
|
||||
testdbPrepare();
|
||||
|
||||
testdbReadDatabase("recTestIoc.dbd", NULL, NULL);
|
||||
|
||||
recTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
|
||||
testdbReadDatabase("linkInitTest.db", NULL, NULL);
|
||||
|
||||
eltc(0);
|
||||
testIocInitOk();
|
||||
eltc(1);
|
||||
|
||||
{
|
||||
const char buf[] = "!----------------------------------------------!";
|
||||
testdbGetArrFieldEqual("longstr1.VAL$", DBF_CHAR, NELEMENTS(buf)+2, NELEMENTS(buf), buf);
|
||||
testdbGetFieldEqual("longstr1.VAL", DBR_STRING, "!--------------------------------------");
|
||||
}
|
||||
|
||||
{
|
||||
const char buf[] = "!----------------------------------------------!";
|
||||
testdbGetArrFieldEqual("longstr2.VAL$", DBF_CHAR, NELEMENTS(buf)+2, NELEMENTS(buf), buf);
|
||||
testdbGetFieldEqual("longstr2.VAL", DBR_STRING, "!--------------------------------------");
|
||||
}
|
||||
|
||||
{
|
||||
const char buf[] = "!----------------------------------------------!";
|
||||
testdbGetArrFieldEqual("longstr3.VAL$", DBF_CHAR, NELEMENTS(buf)+2, NELEMENTS(buf), buf);
|
||||
testdbGetFieldEqual("longstr3.VAL", DBR_STRING, "!--------------------------------------");
|
||||
}
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
testdbCleanup();
|
||||
}
|
||||
|
||||
static void testCalcInit()
|
||||
{
|
||||
testDiag("testCalcInit");
|
||||
|
||||
testdbPrepare();
|
||||
|
||||
testdbReadDatabase("recTestIoc.dbd", NULL, NULL);
|
||||
|
||||
recTestIoc_registerRecordDeviceDriver(pdbbase);
|
||||
|
||||
testdbReadDatabase("linkInitTest.db", NULL, NULL);
|
||||
|
||||
eltc(0);
|
||||
testIocInitOk();
|
||||
eltc(1);
|
||||
|
||||
testdbGetFieldEqual("emptylink.VAL", DBR_DOUBLE, 0.0);
|
||||
testdbGetFieldEqual("emptylink.SEVR", DBR_LONG, INVALID_ALARM);
|
||||
|
||||
testdbPutFieldOk("emptylink.PROC", DBF_LONG, 1);
|
||||
|
||||
testdbGetFieldEqual("emptylink.VAL", DBR_DOUBLE, 0.0);
|
||||
testdbGetFieldEqual("emptylink.SEVR", DBR_LONG, 0);
|
||||
|
||||
testdbGetFieldEqual("emptylink1.VAL", DBR_DOUBLE, 0.0);
|
||||
testdbGetFieldEqual("emptylink1.SEVR", DBR_LONG, INVALID_ALARM);
|
||||
|
||||
testdbPutFieldOk("emptylink1.PROC", DBF_LONG, 1);
|
||||
|
||||
testdbGetFieldEqual("emptylink1.VAL", DBR_DOUBLE, 1.0);
|
||||
testdbGetFieldEqual("emptylink1.SEVR", DBR_LONG, 0);
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
testdbCleanup();
|
||||
}
|
||||
|
||||
MAIN(linkInitTest)
|
||||
{
|
||||
testPlan(16);
|
||||
testLongStringInit();
|
||||
testCalcInit();
|
||||
return testDone();
|
||||
}
|
||||
23
src/std/rec/test/linkInitTest.db
Normal file
23
src/std/rec/test/linkInitTest.db
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
record(lsi, "longstr1") {
|
||||
field(SIZV, "100")
|
||||
field(INP, ["!----------------------------------------------!"])
|
||||
}
|
||||
|
||||
record(lsi, "longstr2") {
|
||||
field(SIZV, "100")
|
||||
field(INP, {const: ["!----------------------------------------------!"]})
|
||||
}
|
||||
|
||||
record(lsi, "longstr3") {
|
||||
field(SIZV, "100")
|
||||
field(INP, {const: "!----------------------------------------------!"})
|
||||
}
|
||||
|
||||
record(ai, "emptylink" ) {
|
||||
field(INP, {calc: {expr:"0"}})
|
||||
}
|
||||
|
||||
record(ai, "emptylink1" ) {
|
||||
field(INP, {calc: {expr:"1"}})
|
||||
}
|
||||
Reference in New Issue
Block a user