diff --git a/test/Makefile b/test/Makefile index cac18293..e7584c89 100644 --- a/test/Makefile +++ b/test/Makefile @@ -155,6 +155,7 @@ testqgroup_SRCS += testqgroup testqgroup_SRCS += testioc_registerRecordDeviceDriver.cpp testqgroup_LIBS = pvxsIoc pvxs $(EPICS_BASE_IOC_LIBS) TESTFILES += ../table.db +TESTFILES += ../tableorder.db TESTFILES += ../image.db TESTFILES += ../image.json TESTFILES += ../iq.db diff --git a/test/tableorder.db b/test/tableorder.db new file mode 100644 index 00000000..633ef016 --- /dev/null +++ b/test/tableorder.db @@ -0,0 +1,36 @@ +record(aai, "$(N)LabelsOrder_"){ + field(FTVL, STRING) + field(NELM, 2) + field(INP, {const:["Label $(VALA)", "Label $(VALB)"]}) + info(Q:group, { + "$(N)TblOrder:$(VALA)-$(VALB)": { + +id: "epics:nt/NTTable:1.0", + labels: {+type: "plain", +channel: "VAL"}, + } + }) +} + +record(aai, "$(N)DataFirst$(VALA)"){ + field(NELM, 2) + field(FTVL, LONG) + field(INP, {const:[0]}) + info(Q:group, { + "$(N)TblOrder:$(VALA)-$(VALB)": { + "value.$(VALA)": {+type: "plain", +channel: "VAL"} + } + }) + field(PINI, YES) +} + +record(aai, "$(N)DataSecond$(VALB)"){ + field(NELM, 2) + field(FTVL, LONG) + field(INP, {const:[1]}) + info(Q:group, { + "$(N)TblOrder:$(VALA)-$(VALB)": { + "":{+type:"meta", +channel:"VAL"}, + "value.$(VALB)": {+type: "plain", +channel: "VAL"} + } + }) + field(PINI, YES) +} diff --git a/test/testqgroup.cpp b/test/testqgroup.cpp index b9f61e38..09969b85 100644 --- a/test/testqgroup.cpp +++ b/test/testqgroup.cpp @@ -157,6 +157,28 @@ void testTable() } +void testTableOrder() +{ + testDiag("%s", __func__); + TestClient ctxt; + + const char *orders[][2] = {{"A", "B"}, {"B", "A"}, {"event", "timestamp"}, {"timestamp", "event"}}; + + std::string prefix = "tbl:TblOrder:"; + for (auto order: orders) { + std::string pv = prefix + order[0] + "-" + order[1]; + auto val(ctxt.get(pv.c_str()).exec()->wait(5.0)); + checkUTAG(val, 0); + + unsigned i = 0; + std::string value_str = "value"; + auto value = val["value"]; + for (auto const &fld: value.ichildren()) { + testStrEq(value.nameOf(fld), order[i++]); + } + } +} + void testEnum() { testDiag("%s", __func__); @@ -738,7 +760,7 @@ void testDbLoadGroup() MAIN(testqgroup) { - testPlan(38); + testPlan(46); testSetup(); { generalTimeRegisterCurrentProvider("test", 1, &testTimeCurrent); @@ -750,12 +772,17 @@ MAIN(testqgroup) ioc::dbLoadGroup("../image.json", "N=img"); testdbReadDatabase("table.db", nullptr, "N=tbl:,LBL1=Column A,LBL2=Column B,PO1=0,PO2=1"); testdbReadDatabase("table.db", nullptr, "N=tbl2:,LBL1=Column B,LBL2=Column A,PO1=1,PO2=0"); + testdbReadDatabase("tableorder.db", nullptr, "N=tbl:,VALA=A,VALB=B"); + testdbReadDatabase("tableorder.db", nullptr, "N=tbl:,VALA=B,VALB=A"); + testdbReadDatabase("tableorder.db", nullptr, "N=tbl:,VALA=event,VALB=timestamp"); + testdbReadDatabase("tableorder.db", nullptr, "N=tbl:,VALA=timestamp,VALB=event"); testdbReadDatabase("ntenum.db", nullptr, "P=enm"); testdbReadDatabase("iq.db", nullptr, "N=iq:"); testdbReadDatabase("const.db", nullptr, "P=tst:"); iocsh("../qgroup.cmd"); ioc.init(); testTable(); + testTableOrder(); testEnum(); testImage(); testIQ();