Begin work on general NT validator
This commit is contained in:

committed by
mdavidsaver

parent
2d186d40d5
commit
b76c91a885
@ -72,6 +72,10 @@ TESTPROD_HOST += ntutilsTest
|
||||
ntutilsTest_SRCS = ntutilsTest.cpp
|
||||
TESTS += ntutilsTest
|
||||
|
||||
TESTPROD_HOST += ntvalidatorTest
|
||||
ntutilsTest_SRCS = ntvalidatorTest.cpp
|
||||
TESTS += ntvalidatorTest
|
||||
|
||||
TESTSCRIPTS_HOST += $(TESTS:%=%.t)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
37
test/ntvalidatorTest.cpp
Normal file
37
test/ntvalidatorTest.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright information and license terms for this software can be
|
||||
* found in the file LICENSE that is included with the distribution
|
||||
*/
|
||||
|
||||
#include <epicsUnitTest.h>
|
||||
#include <testMain.h>
|
||||
|
||||
#include <pv/ntvalidator.h>
|
||||
#include <pv/ntndarray.h>
|
||||
|
||||
using namespace epics::nt;
|
||||
using epics::pvData::StructureConstPtr;
|
||||
using epics::pvData::Field;
|
||||
|
||||
void test_isCompatible()
|
||||
{
|
||||
testDiag("test_isCompatible");
|
||||
|
||||
StructureConstPtr ref(NTNDArray::createBuilder()->addAlarm()->createStructure());
|
||||
|
||||
Validator::Definition def;
|
||||
def.structure = std::static_pointer_cast<const Field>(ref);
|
||||
def.optional.insert(ref->getField("alarm").get());
|
||||
|
||||
StructureConstPtr struc(NTNDArray::createBuilder()->createStructure());
|
||||
|
||||
testOk1(Validator::isCompatible(def, struc));
|
||||
}
|
||||
|
||||
MAIN(testNTValidator) {
|
||||
testPlan(1);
|
||||
test_isCompatible();
|
||||
return testDone();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user