std/rec/test: recMiscTest check in64in/out

This commit is contained in:
Michael Davidsaver
2017-05-03 19:18:52 -04:00
parent 5e0dc5d1c9
commit 2a81e0b338
4 changed files with 108 additions and 0 deletions

View File

@@ -32,6 +32,13 @@ testHarness_SRCS += arrayOpTest.c
TESTFILES += ../arrayOpTest.db
TESTS += arrayOpTest
TESTPROD_HOST += recMiscTest
recMiscTest_SRCS += recMiscTest.c
recMiscTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp
testHarness_SRCS += recMiscTest.c
TESTFILES += ../recMiscTest.db
TESTS += recMiscTest
TESTPROD_HOST += linkRetargetLinkTest
linkRetargetLinkTest_SRCS += linkRetargetLinkTest.c
linkRetargetLinkTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp

View File

@@ -14,6 +14,7 @@
int analogMonitorTest(void);
int compressTest(void);
int recMiscTest(void);
int arrayOpTest(void);
int asTest(void);
int linkRetargetLinkTest(void);
@@ -26,6 +27,8 @@ void epicsRunRecordTests(void)
runTest(compressTest);
runTest(recMiscTest);
runTest(arrayOpTest);
runTest(asTest);

View File

@@ -0,0 +1,88 @@
/*************************************************************************\
* Copyright (c) 2017 Michael Davidsaver
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include <string.h>
#include "dbAccess.h"
#include "errlog.h"
#include "dbStaticLib.h"
#include "dbUnitTest.h"
#include "testMain.h"
static
void testint64BeforeInit(void)
{
const char *S;
DBENTRY dbent;
/* check dbGet/PutString */
testDiag("In %s", EPICS_FUNCTION);
dbInitEntryFromRecord(testdbRecordPtr("out64"), &dbent);
if(dbFindField(&dbent, "VAL"))
testAbort("Failed to find out64.VAL");
S = dbGetString(&dbent);
testOk(S && strcmp(S, "0")==0, "initial value \"%s\"", S);
testOk1(dbPutString(&dbent, "0x12345678abcdef00")==0);
S = dbGetString(&dbent);
testOk(S && strcmp(S, "1311768467750121216")==0, "1311768467750121216 \"%s\"", S);
dbFinishEntry(&dbent);
}
static
void testint64AfterInit(void)
{
testDiag("In %s", EPICS_FUNCTION);
/* check dbGet/PutField and DB links */
testdbGetFieldEqual("in64", DBF_UINT64, 0llu);
testdbGetFieldEqual("out64", DBF_UINT64, 0x12345678abcdef00llu);
testdbPutFieldOk("out64.PROC", DBF_LONG, 1);
testdbGetFieldEqual("in64", DBF_UINT64, 0x12345678abcdef00llu);
testdbPutFieldOk("out64.VAL", DBF_UINT64, 0x22345678abcdef00llu);
testdbPutFieldOk("in64.PROC", DBF_LONG, 1);
testdbGetFieldEqual("in64", DBF_UINT64, 0x22345678abcdef00llu);
}
void recTestIoc_registerRecordDeviceDriver(struct dbBase *);
MAIN(recMiscTest)
{
testPlan(0);
testdbPrepare();
testdbReadDatabase("recTestIoc.dbd", NULL, NULL);
recTestIoc_registerRecordDeviceDriver(pdbbase);
testdbReadDatabase("recMiscTest.db", NULL, NULL);
testint64BeforeInit();
eltc(0);
testIocInitOk();
eltc(1);
testint64AfterInit();
testIocShutdownOk();
testdbCleanup();
return testDone();
}

View File

@@ -0,0 +1,10 @@
# check int64in/out
record(int64in, "in64") {
field(INP , "out64 NPP")
}
record(int64out, "out64") {
field(OUT , "in64 NPP")
}