ioc: test PUT to scalar mapping

This commit is contained in:
Michael Davidsaver
2026-01-05 11:00:01 -08:00
parent 91dd4d4592
commit 78b0cf4e18
3 changed files with 60 additions and 1 deletions
+1
View File
@@ -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
+41
View File
@@ -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:"*"
}
}
})
}
+18 -1
View File
@@ -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<int32_t>(), 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