diff --git a/testApp/testpdb.cpp b/testApp/testpdb.cpp index ec789a4..b7eed2f 100644 --- a/testApp/testpdb.cpp +++ b/testApp/testpdb.cpp @@ -292,6 +292,45 @@ void testGroupMonitorTriggers(pvac::ClientProvider& client) #endif } +void testFilters(pvac::ClientProvider& client) +{ + testDiag("test w/ server side filters"); + + pvd::shared_vector expected; + { + pvd::shared_vector scratch(9); + scratch[0] = 9; + scratch[1] = 8; + scratch[2] = 7; + scratch[3] = 6; + scratch[4] = 5; + scratch[5] = 4; + scratch[6] = 3; + scratch[7] = 2; + scratch[8] = 1; + expected = pvd::freeze(scratch); + } + + client.connect("TEST").put().set("value", expected).exec(); + + pvd::PVStructure::const_shared_pointer root(client.connect("TEST").get()); + + testFieldEqual(root, "value", expected); + + root = client.connect("TEST.{\"arr\":{\"i\":2}}").get(); + { + pvd::shared_vector scratch(5); + scratch[0] = 9; + scratch[1] = 7; + scratch[2] = 5; + scratch[3] = 3; + scratch[4] = 1; + expected = pvd::freeze(scratch); + } + + testFieldEqual(root, "value", expected); +} + } // namespace extern "C" @@ -299,7 +338,7 @@ void p2pTestIoc_registerRecordDeviceDriver(struct dbBase *); MAIN(testpdb) { - testPlan(93); + testPlan(95); try{ QSRVRegistrar_counters(); epics::RefSnapshot ref_before; @@ -318,6 +357,7 @@ MAIN(testpdb) #ifdef USE_MULTILOCK testdbReadDatabase("testpdb-groups.db", NULL, NULL); #endif + testdbReadDatabase("testfilters.db", NULL, NULL); IOC.init(); @@ -333,6 +373,7 @@ MAIN(testpdb) testSingleMonitor(client); testGroupMonitor(client); testGroupMonitorTriggers(client); + testFilters(client); testEqual(epics::atomic::get(PDBProvider::num_instances), 1u); } diff --git a/testApp/testpvif.cpp b/testApp/testpvif.cpp index d08120d..9427877 100644 --- a/testApp/testpvif.cpp +++ b/testApp/testpvif.cpp @@ -562,15 +562,15 @@ void testFilters() IOC.init(); - static epicsInt32 arr[] = {9, 8, 7, 6, 5, 4, 3, 2, 1}; + static const epicsInt32 arr[] = {9, 8, 7, 6, 5, 4, 3, 2, 1}; testdbPutArrFieldOk("TEST", DBF_LONG, 9, arr); #if EPICS_VERSION_INT > VERSION_INT(7, 0, 5, 0) testdbGetArrFieldEqual("TEST", DBF_LONG, 10, 9, arr); - testdbGetArrFieldEqual("TEST.{arr:{s:5}}", DBF_LONG, 10, 4, arr+5); + testdbGetArrFieldEqual("TEST.{\"arr\":{\"s\":5}}", DBF_LONG, 10, 4, arr+5); - static epicsInt32 arr2[] = {9, 7, 5, 3, 1}; - testdbGetArrFieldEqual("TEST.{arr:{i:2}}", DBF_LONG, 10, 5, arr2); + static const epicsInt32 arr2[] = {9, 7, 5, 3, 1}; + testdbGetArrFieldEqual("TEST.{\"arr\":{\"i\":2}}", DBF_LONG, 10, 5, arr2); #else testSkip(3, "dbUnitTest doesn't use dbChannel"); @@ -579,7 +579,7 @@ void testFilters() pvd::PVStructurePtr root; p2p::auto_ptr pvif; - DBCH chan("TEST.{arr:{i:2}}"); + DBCH chan("TEST.{\"arr\":{\"i\":2}}"); ScalarBuilder builder(chan); root = pvd::FieldBuilder::begin()