diff --git a/test/Makefile b/test/Makefile index d26f935..80b62a1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -156,6 +156,7 @@ TESTFILES += ../image.json TESTFILES += ../iq.db TESTFILES += ../ntenum.db TESTFILES += ../const.db +TESTFILES += ../batch.db TESTFILES += ../qgroup.cmd TESTFILES += ../qgroup.json TESTS += testqgroup diff --git a/test/batch.db b/test/batch.db new file mode 100644 index 0000000..8471622 --- /dev/null +++ b/test/batch.db @@ -0,0 +1,41 @@ + +record(ao, "$(P)A") { + info(Q:group, { + "$(P)":{ + "A":{+channel:"VAL", +putorder:0} + } + }) +} + +record(ao, "$(P)B") { + field(FLNK, "$(P)SUM") + info(Q:group, { + "$(P)":{ + "B":{+channel:"VAL", +putorder:1} + } + }) +} + +record(ao, "$(P)C") { + info(Q:group, { + "$(P)":{ + "C":{+channel:"VAL"} # omit +putorder to prevent write + } + }) +} + +record(calc, "$(P)SUM") { + field(INPA, "$(P)A NPP MSS") + field(INPB, "$(P)B NPP MSS") + field(INPC, "$(P)C NPP MSS") + field(CALC, "A+B+C") + info(Q:group, { + "$(P)":{ + "SUM":{ + +channel:"VAL", + +putorder:2, + +trigger:"*" + } + } + }) +} diff --git a/test/testqgroup.cpp b/test/testqgroup.cpp index b9f61e3..c6699d5 100644 --- a/test/testqgroup.cpp +++ b/test/testqgroup.cpp @@ -716,6 +716,21 @@ void testConst() ); } +void testBatch() +{ + testDiag("%s", __func__); + TestClient ctxt; + + ctxt.put("tst:b:") + .set("A.value", 1.0) + .set("B.value", 2.0) + .set("C.value", 4.0) // ignored + .exec()->wait(5.0); + + auto ret(ctxt.get("tst:b:").exec()->wait(5.0)); + testEq(ret["SUM.value"].as(), 3); +} + void testDbLoadGroup() { testDiag("%s", __func__); @@ -738,7 +753,7 @@ void testDbLoadGroup() MAIN(testqgroup) { - testPlan(38); + testPlan(39); testSetup(); { generalTimeRegisterCurrentProvider("test", 1, &testTimeCurrent); @@ -753,6 +768,7 @@ MAIN(testqgroup) testdbReadDatabase("ntenum.db", nullptr, "P=enm"); testdbReadDatabase("iq.db", nullptr, "N=iq:"); testdbReadDatabase("const.db", nullptr, "P=tst:"); + testdbReadDatabase("batch.db", nullptr, "P=tst:b:"); iocsh("../qgroup.cmd"); ioc.init(); testTable(); @@ -760,6 +776,7 @@ MAIN(testqgroup) testImage(); testIQ(); testConst(); + testBatch(); testDbLoadGroup(); } // call epics atexits explicitly to handle older base w/o de-init hooks